public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd
@ 2005-07-04  9:19 kostikbel at ukr dot net
  2005-07-04  9:26 ` [Bug c/22292] " pluto at agmk dot net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kostikbel at ukr dot net @ 2005-07-04  9:19 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/22292] ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd
  2005-07-04  9:19 [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd kostikbel at ukr dot net
@ 2005-07-04  9:26 ` pluto at agmk dot net
  2005-07-04  9:56 ` [Bug target/22292] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pluto at agmk dot net @ 2005-07-04  9:26 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22292


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/22292] ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd
  2005-07-04  9:19 [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd kostikbel at ukr dot net
  2005-07-04  9:26 ` [Bug c/22292] " pluto at agmk dot net
@ 2005-07-04  9:56 ` pinskia at gcc dot gnu dot org
  2005-07-04 10:01 ` pinskia at gcc dot gnu dot org
  2005-07-04 16:05 ` [Bug target/22292] [3.4 Regression] ICE " pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-04  9:56 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22292


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/22292] ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd
  2005-07-04  9:19 [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd kostikbel at ukr dot net
  2005-07-04  9:26 ` [Bug c/22292] " pluto at agmk dot net
  2005-07-04  9:56 ` [Bug target/22292] " pinskia at gcc dot gnu dot org
@ 2005-07-04 10:01 ` pinskia at gcc dot gnu dot org
  2005-07-04 16:05 ` [Bug target/22292] [3.4 Regression] ICE " pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-04 10:01 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code, ssemmx,
                   |                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22292


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/22292] [3.4 Regression] ICE with _mm_loadl_pd/__builtin_ia32_loadlpd
  2005-07-04  9:19 [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd kostikbel at ukr dot net
                   ` (2 preceding siblings ...)
  2005-07-04 10:01 ` pinskia at gcc dot gnu dot org
@ 2005-07-04 16:05 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-04 16:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-04 16:05 -------
The code does not do what you want it to do:
You want:
#include <xmmintrin.h>

extern "C" double
fadd(double a, double b)
{
        __m128d a1;
        __m128d b1;
        __m128d c;
        double res;

        a1 = _mm_loadl_pd(a1, &a);
        b1 =_mm_loadl_pd(b1, &b);
        c = _mm_add_sd(a1, b1);
        _mm_storel_pd(&res, c);
        return res;
}


But the ICE is a regression from 3.3 so confirming on that

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|ssemmx, wrong-code          |
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-04 16:05:07
               date|                            |
            Summary|ICE and wrong code gen with |[3.4 Regression] ICE with
                   |_mm_loadl_pd/__builtin_ia32_|_mm_loadl_pd/__builtin_ia32_
                   |loadlpd                     |loadlpd
   Target Milestone|---                         |3.4.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22292


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-07-04 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-04  9:19 [Bug c/22292] New: ICE and wrong code gen with _mm_loadl_pd/__builtin_ia32_loadlpd kostikbel at ukr dot net
2005-07-04  9:26 ` [Bug c/22292] " pluto at agmk dot net
2005-07-04  9:56 ` [Bug target/22292] " pinskia at gcc dot gnu dot org
2005-07-04 10:01 ` pinskia at gcc dot gnu dot org
2005-07-04 16:05 ` [Bug target/22292] [3.4 Regression] ICE " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).