This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

target/7396: ix86: cmpgt_ss, cmpge_ss, cmpngt_ss, and cmpnge_ss SSE intriniscs are broken


>Number:         7396
>Category:       target
>Synopsis:       ix86:  cmpgt_ss, cmpge_ss, cmpngt_ss, and cmpnge_ss SSE intriniscs are broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 24 12:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Jaeger
>Release:        GCC 3.1, GCC 3.2 CVS
>Organization:
>Environment:
i686-linux-gnu
>Description:
The cmpgt_ss (and also the others) intrinsic copies the value
from the wrong argument.  The example program outputs:
$ ./a.out 
Return values: -1 6.000000 2.000000 1.000000
Aborted

but the correct value is:
-1  3.000000 4.000000 1.000000
The last three values should come from m1.

Btw. cmplt_ss works correctly, but it seems that the arguments are switched in the intrinsic.
>How-To-Repeat:
#include <xmmintrin.h>
#include <stdlib.h>
#include <stdio.h>

typedef union
{
  __m128 m;
  float f[4];
  double d[2];
  int i[4];
} munion;

int
test_it (void)
{
  __m128 m1, m2;
  munion res;

  m1 = _mm_set_ps (1.0f, 4.0f, 3.0f, 8.0f);
  m2 = _mm_set_ps (1.0f, 2.0f, 6.0f, 4.0f);
  
  res.m = _mm_cmpgt_ss (m1, m2);

  printf ("Return values: %d %f %f %f\n",
	  res.i[0], res.f[1], res.f[2], res.f[3]);
  
  if (res.i[0] != -1)
    abort ();
  if (res.f[1] != 3.0f)
    abort ();
  if (res.f[2] != 4.0f)
    abort ();
  if (res.f[3] != 1.0f)
    abort ();

  return 0;
}

int
main (void)
{
  return test_it ();
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]