public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: aj@suse.de
To: gcc-gnats@gcc.gnu.org
Subject: target/7396: ix86:  cmpgt_ss, cmpge_ss, cmpngt_ss, and cmpnge_ss SSE intriniscs are broken
Date: Wed, 24 Jul 2002 12:16:00 -0000	[thread overview]
Message-ID: <20020724191009.3796.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-07-24 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24 12:16 aj [this message]
2002-10-15 13:14 hubicka
2002-10-16 10:30 hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020724191009.3796.qmail@sources.redhat.com \
    --to=aj@suse.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).