This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/42968] New: _mm_cvtsi128_si32() should always be assigned to movd.
- From: "herumi at nifty dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Feb 2010 08:21:14 -0000
- Subject: [Bug c/42968] New: _mm_cvtsi128_si32() should always be assigned to movd.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
_mm_cvtsi128_si32() is an intrinsic function corresponding to movd.
So I think gcc should always generate movd for _mm_cvtsi128_si32().
But gcc with -msse4 option generates pextrd.
So we can't make an application which selects to use SSE4 or not by detecting
cpuid.
For example.
---
% cat t.c
#include <xmmintrin.h>
int main(int argc)
{
__m128i a = _mm_cvtsi32_si128(argc);
return _mm_cvtsi128_si32(a);
}
---
% gcc t.c -S -O3 -msse3 && cat t.s
(snip)
main:
pushl %ebp
movl %esp, %ebp
subl $4, %esp
movd 8(%ebp), %xmm0
movd %xmm0, (%esp)
movl (%esp), %eax
leave
ret
(snip)
gcc uses movd.
---
% gcc t.c -S -O3 -msse4 && cat t.s
(snip)
main:
pushl %ebp
movl %esp, %ebp
movd 8(%ebp), %xmm0
popl %ebp
pextrd $0, %xmm0, %eax
ret
(snip)
gcc uses pextrd, which is SSE4.1 mnemonic.
--
Microsoft Visual Studio 2010 beta2.
cl /Ox /FAsc t.c
_main proc
movd xmm0, DWORD PTR _argc$[esp-4]
movd eax, xmm0
ret
---
% gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.4.3/configure --enable-__cxa_atexit --enable-shared
--enable-threads=posix --enable-languages=c,c++ --with-arch=i686 --with-ppl
Thread model: posix
gcc version 4.4.3 (GCC)
--
Summary: _mm_cvtsi128_si32() should always be assigned to movd.
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: herumi at nifty dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42968