]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/6753 (gcc 3.1 produces wrong code when optimizing for pentium4)
authorJakub Jelinek <jakub@redhat.com>
Thu, 23 May 2002 09:24:37 +0000 (11:24 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 23 May 2002 09:24:37 +0000 (11:24 +0200)
PR target/6753
* config/i386/i386.md (sse_movdfcc, sse_movdfcc_eq): Use Y instead
of x in constraints for clarity.
(sse_mov?fcc split): abort if op2 == op3.
(sse_movsfcc_const0_1, sse_movsfcc_const0_2, sse_movsfcc_const0_3,
sse_movsfcc_const0_4): Add earlyclobber.
(sse_movdfcc_const0_1, sse_movdfcc_const0_2, sse_movdfcc_const0_3,
sse_movdfcc_const0_4): Likewise.  Use DFmode, not SFmode.
Use Y instead of x in constraints.

* gcc.dg/20020523-1.c: New test.

From-SVN: r53782

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20020523-1.c [new file with mode: 0644]

index 009d69fb6c5092f72f645af0c59faa8ec1d21b33..29635944121256e4eb60058c747b2a0004c6ce2d 100644 (file)
@@ -1,3 +1,15 @@
+2002-05-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/6753
+       * config/i386/i386.md (sse_movdfcc, sse_movdfcc_eq): Use Y instead
+       of x in constraints for clarity.
+       (sse_mov?fcc split): abort if op2 == op3.
+       (sse_movsfcc_const0_1, sse_movsfcc_const0_2, sse_movsfcc_const0_3,
+       sse_movsfcc_const0_4): Add earlyclobber.
+       (sse_movdfcc_const0_1, sse_movdfcc_const0_2, sse_movdfcc_const0_3,
+       sse_movdfcc_const0_4): Likewise.  Use DFmode, not SFmode.
+       Use Y instead of x in constraints.
+
 2002-05-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/6643
index cc2e3e8d9803c41a0fbfab1f5b8bfd191139acaf..46a612a30d52c466c74e03a8dacdf74cf1169817 100644 (file)
@@ -2,6 +2,8 @@
 
        * gcc.dg/20020517-1.c: New test.
 
+       * gcc.dg/20020523-1.c: New test.
+
 2002-05-22  Andreas Jaeger  <aj@suse.de>
 
        * gcc.c-torture/execute/loop-2c.x: Remove, the test should pass
diff --git a/gcc/testsuite/gcc.dg/20020523-1.c b/gcc/testsuite/gcc.dg/20020523-1.c
new file mode 100644 (file)
index 0000000..5ae3da5
--- /dev/null
@@ -0,0 +1,65 @@
+/* PR target/6753
+   This testcase was miscompiled because sse_mov?fcc_const0*
+   patterns were missing earlyclobber.  */
+/* { dg-do run { target i386-*-* } } */
+/* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
+
+extern void abort (void);
+extern void exit (int);
+
+float one = 1.f;
+
+void bar (float f)
+{
+  if (__builtin_memcmp (&one, &f, sizeof (float)))
+    abort ();
+}
+
+float foo (void)
+{
+  return 1.f;
+}
+
+typedef struct
+{
+  float t;
+} T;
+
+void bail_if_no_sse (void)
+{
+  int fl1, fl2;
+
+  /* See if we can use cpuid.  */
+  __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
+          "pushl %0; popfl; pushfl; popl %0; popfl"
+          : "=&r" (fl1), "=&r" (fl2)
+          : "i" (0x00200000));
+  if (((fl1 ^ fl2) & 0x00200000) == 0)
+    exit (0);
+
+  /* See if cpuid gives capabilities.  */
+  __asm__ ("cpuid" : "=a" (fl1) : "0" (0) : "ebx", "ecx", "edx", "cc");
+  if (fl1 == 0)
+    exit (0);
+
+  /* See if capabilities include SSE (25th bit; 26 for SSE2).  */
+  __asm__ ("cpuid" : "=a" (fl1), "=d" (fl2) : "0" (1) : "ebx", "ecx", "cc");
+  if ((fl2 & (1 << 25)) == 0)
+    exit (0);
+}
+
+int main (void)
+{
+  int i;
+  T x[1];
+
+  bail_if_no_sse ();
+  for (i = 0; i < 1; i++)
+    {
+      x[i].t = foo ();
+      x[i].t = 0.f > x[i].t ? 0.f : x[i].t;
+      bar (x[i].t);
+    }
+
+  exit (0);
+}