public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc
@ 2005-04-21 13:07 julien dot pommier at insa-toulouse dot fr
  2005-04-21 13:14 ` [Bug target/21149] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: julien dot pommier at insa-toulouse dot fr @ 2005-04-21 13:07 UTC (permalink / raw)
  To: gcc-bugs

The following code does generate wrong results when optimization is turned on :

#include <stdio.h>
#include <xmmintrin.h>

void pv(const char *s, __m128 v) {
  float *p = (float*)&v;
  printf("%s=[%g %g %g %g]\n", s,p[0],p[1],p[2],p[3]);
}

#define P(x) pv(#x,x)


static void plop(__m128 *Y) {
  __m128 zero = _mm_setzero_ps();
  __m128 foo = _mm_movehl_ps(zero, *Y);
  __m128 bar = _mm_movehl_ps(*Y, zero);
  P(*Y);P(foo);P(bar);
}

int main() {
  __m128 y=_mm_set_ps(-3,2,1,9);
  plop(&y); 
  return 0;
}

Here are some outputs:

> gcc-3.4 -O3 -Wall -W -msse  -o toto toto.c && ./toto
*Y=[9 1 2 -3]
foo=[0 0 9 1]
bar=[9 1 0 0]

> gcc-4.0 -g -O0 -Wall -W -msse -o toto toto.c && ./toto
*Y=[9 1 2 -3]
foo=[2 -3 0 0]
bar=[0 0 2 -3]   (this one is correct)

> gcc-4.0 -O3 -Wall -W -msse  -o toto toto.c && ./toto
*Y=[9 1 2 -3]
foo=[9 1 0 0]
bar=[0 0 2 -3]
(same output with gcc-4.1 from cvs)


Tested with:
gcc-3.4 (GCC) 3.4.4 20050314 (prerelease) (Debian 3.4.3-12)
gcc-4.0 (GCC) 4.0.0 20050410 (prerelease) (Debian 4.0-0pre10)
gcc (GCC) 4.0.0 20050418 (prerelease)
gcc (GCC) 4.1.0 20050421 (experimental)

-- 
           Summary: invalid code generation for _mm_movehl_ps SSE intrisinc
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: julien dot pommier at insa-toulouse dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 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=21149


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
@ 2005-04-21 13:14 ` pinskia at gcc dot gnu dot org
  2005-07-06 14:36 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-21 13:14 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target
           Keywords|                            |ssemmx, wrong-code


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
  2005-04-21 13:14 ` [Bug target/21149] " pinskia at gcc dot gnu dot org
@ 2005-07-06 14:36 ` pinskia at gcc dot gnu dot org
  2005-07-20 15:26 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-06 14:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-06 14:36 -------
Note You are validing C aliasing rules:
  float *p = (float*)&v;

Use an union or -fno-strict-aliasing.
But that does not change the problem.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
  2005-04-21 13:14 ` [Bug target/21149] " pinskia at gcc dot gnu dot org
  2005-07-06 14:36 ` pinskia at gcc dot gnu dot org
@ 2005-07-20 15:26 ` pinskia at gcc dot gnu dot org
  2005-07-21 19:59 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-20 15:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-20 15:20 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01318.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |07/msg01318.html
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-20 15:20:16
               date|                            |


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
                   ` (2 preceding siblings ...)
  2005-07-20 15:26 ` pinskia at gcc dot gnu dot org
@ 2005-07-21 19:59 ` cvs-commit at gcc dot gnu dot org
  2005-07-21 20:03 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-21 19:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-21 19:58 -------
Subject: Bug 21149

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	rth@gcc.gnu.org	2005-07-21 19:58:31

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: sse.md 

Log message:
	PR target/21149
	* config/i386/i386.md (sse_movhlps): Fix vec_select values.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.326&r2=2.7592.2.327
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/sse.md.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.7&r2=1.7.14.1



-- 


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
                   ` (3 preceding siblings ...)
  2005-07-21 19:59 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-21 20:03 ` cvs-commit at gcc dot gnu dot org
  2005-07-21 20:33 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-21 20:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-21 19:59 -------
Subject: Bug 21149

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2005-07-21 19:59:09

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: sse.md 

Log message:
	PR target/21149
	* config/i386/i386.md (sse_movhlps): Fix vec_select values.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9505&r2=2.9506
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/sse.md.diff?cvsroot=gcc&r1=1.21&r2=1.22



-- 


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
                   ` (4 preceding siblings ...)
  2005-07-21 20:03 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-21 20:33 ` pinskia at gcc dot gnu dot org
  2005-07-28 14:39 ` cvs-commit at gcc dot gnu dot org
  2005-07-28 14:47 ` cvs-commit at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-21 20:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-21 20:33 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.2


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
                   ` (5 preceding siblings ...)
  2005-07-21 20:33 ` pinskia at gcc dot gnu dot org
@ 2005-07-28 14:39 ` cvs-commit at gcc dot gnu dot org
  2005-07-28 14:47 ` cvs-commit at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-28 14:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-28 14:38 -------
Subject: Bug 21149

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-07-28 14:38:13

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.target/i386: sse-3.c 

Log message:
	PR target/21149
	* gcc.target/i386/sse-3.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5838&r2=1.5839
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/sse-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug target/21149] invalid code generation for _mm_movehl_ps SSE intrisinc
  2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
                   ` (6 preceding siblings ...)
  2005-07-28 14:39 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-28 14:47 ` cvs-commit at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-28 14:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-28 14:41 -------
Subject: Bug 21149

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jakub@gcc.gnu.org	2005-07-28 14:41:25

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.target/i386: sse-3.c 

Log message:
	PR target/21149
	* gcc.target/i386/sse-3.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.305&r2=1.5084.2.306
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/sse-3.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

end of thread, other threads:[~2005-07-28 14:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-21 13:07 [Bug c/21149] New: invalid code generation for _mm_movehl_ps SSE intrisinc julien dot pommier at insa-toulouse dot fr
2005-04-21 13:14 ` [Bug target/21149] " pinskia at gcc dot gnu dot org
2005-07-06 14:36 ` pinskia at gcc dot gnu dot org
2005-07-20 15:26 ` pinskia at gcc dot gnu dot org
2005-07-21 19:59 ` cvs-commit at gcc dot gnu dot org
2005-07-21 20:03 ` cvs-commit at gcc dot gnu dot org
2005-07-21 20:33 ` pinskia at gcc dot gnu dot org
2005-07-28 14:39 ` cvs-commit at gcc dot gnu dot org
2005-07-28 14:47 ` cvs-commit 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).