This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd
- From: "kostikbel at ukr dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jul 2005 09:18:54 -0000
- Subject: [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code
#include <xmmintrin.h>
extern "C" double
fadd(double a, double b)
{
__m128d a1;
__m128d b1;
__m128d c;
double res;
_mm_loadl_pd(a1, &a);
_mm_loadl_pd(b1, &b);
c = _mm_add_sd(a1, b1);
_mm_storel_pd(&res, c);
return res;
}
when compiled with
CC3 -msse3 -march=prescott -c fadd.C
leads to ICE:
/usr/local/opt/gcc-3.4.4/lib/gcc/i386-little-freebsd5/3.4.4/include/emmintrin.h:
In function `void _mm_storel_pd(double*, double __vector__)':
/usr/local/opt/gcc-3.4.4/lib/gcc/i386-little-freebsd5/3.4.4/include/emmintrin.h:959:
internal compiler error: in instantiate_virtual_regs_lossage, at function.c:3765
CC3 is
deviant% CC3 -v
Reading specs from /usr/local/opt/gcc-3.4.4/lib/gcc/i386-little-freebsd5/3.4.4/specs
Configured with: ../gcc-3.4.4/configure --prefix=/usr/local/opt/gcc-3.4.4
--enable-shared --enable-threads --with-as=/usr/local/opt/binutils/bin/as
--with-ld=/usr/local/opt/binutils/bin/ld
--enable-languages=c,c++,f77,objc,ada,java --disable-nls --enable-long-long
--host=i386-little-freebsd5
Thread model: posix
gcc version 3.4.4
When compiled with
deviant% CC3 -msse3 -march=prescott -O -c fadd.C
it leads to wrong code:
deviant% objdump --disassemble fadd.o ~/work/gcc-xmm
fadd.o: file format elf32-i386-freebsd
Disassembly of section .text:
00000000 <_Z4fadddd>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 08 sub $0x8,%esp
6: f2 0f 58 c0 addsd %xmm0,%xmm0
a: 66 0f 13 45 f8 movlpd %xmm0,0xfffffff8(%ebp)
f: dd 45 f8 fldl 0xfffffff8(%ebp)
12: c9 leave
13: c3 ret
Note that arguments of the fadd function are never accessed.
gcc 4.0.0 does not ICE without optimization, but with or without -O, it
generates wrong code (for -O, the code is identical to gcc 3.4.4).
Substitution of _mm_loadl_pd with __builtin_ia32_loadlpd does not change
anything.
N.B. I do not insert preprocessed file since code snippet that shows problem
uses only headers supplied by gcc itself. Also, this problem appears both
under 3.4 and 4.0. If needed, I will attach (relatively large) .i files.
--
Summary: ICE and wrong code gen with
_mm_loadl_pd/__builtin_ia32_loadlpd
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kostikbel at ukr dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-*-freebsd5
GCC host triplet: i386-*-freebsd5
GCC target triplet: i386-*-freebsd5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22292