OSDN Git Service

2005-08-26 Uros Bizjak <uros@kss-loka.si>
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Sep 2005 19:19:43 +0000 (19:19 +0000)
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Sep 2005 19:19:43 +0000 (19:19 +0000)
* gcc.target/i386/builtin-apply-mmx.c: New test.

PR target/22576
* gcc.target/i386/pr22576.c: New test.

PR target/22585
* gcc.target/i386/pr22585.c: New test.

PR target/23268
* gcc.target/i386/pr23268.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104656 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr22576.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr22585.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr23268.c [new file with mode: 0644]

index d397b2d..9725d20 100644 (file)
@@ -1,5 +1,16 @@
 2005-09-26  Uros Bizjak  <uros@kss-loka.si>
 
+       * gcc.target/i386/builtin-apply-mmx.c: New test.
+
+       PR target/22576
+       * gcc.target/i386/pr22576.c: New test.
+
+       PR target/22585
+       * gcc.target/i386/pr22585.c: New test.
+
+       PR target/23268
+       * gcc.target/i386/pr23268.c: New test.
+
        PR middle-end/23831
        * gcc.dg/vect/pr23831.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c b/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c
new file mode 100644 (file)
index 0000000..4762140
--- /dev/null
@@ -0,0 +1,51 @@
+/* __builtin_apply_args () and __builtin_return () built-in functions does
+   not function properly when -mmmx is used in compile flags.
+   __builtin_apply_args () saves all registers that pass arguments to a
+   function, including %mm0-%mm3, to a memory block, and __builtin_return ()
+   restores %mm0, from a return memory block, as it can be used as a
+   function return register.  Unfortunatelly, when MMX registers are touched,
+   i387 FPU switches to MMX mode, and no FP operation is possible until emms
+   instruction is issued.  */
+
+/* This test case is adapted from gcc.dg/builtin-apply4.c.  */
+/* { dg-do run { xfail "*-*-*" } } */
+/* { dg-options "-O2 -mmmx" } */
+
+#include "../../gcc.dg/i386-cpuid.h"
+
+extern void abort (void);
+
+double
+foo (double arg)
+{
+  if (arg != 116.0)
+    abort ();
+
+  return arg + 1.0;
+}
+
+inline double
+bar (double arg)
+{
+  foo (arg);
+  __builtin_return (__builtin_apply ((void (*)()) foo,
+                                    __builtin_apply_args (), 16));
+}
+
+int
+main (int argc, char **argv)
+{
+  unsigned long cpu_facilities;
+
+  cpu_facilities = i386_cpuid ();
+
+  if (!(cpu_facilities & bit_MMX))
+    /* If host has no MMX support, pass.  */
+    return 0;
+
+  if (bar (116.0) != 117.0)
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr22576.c b/gcc/testsuite/gcc.target/i386/pr22576.c
new file mode 100644 (file)
index 0000000..083fbf6
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR target/22576 */
+/* Testcase reduced by Volker Reichelt */
+/* { dg-do compile } */
+/* { dg-options "-ffast-math" } */
+
+int
+foo (long double d)
+{
+  return d == 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr22585.c b/gcc/testsuite/gcc.target/i386/pr22585.c
new file mode 100644 (file)
index 0000000..879ba66
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/22585 */
+/* Testcase reduced by Volker Reichelt */
+/* { dg-do compile } */
+/* { dg-options "-march=i386 -O -ffast-math" } */
+
+int
+foo (long double d, int i)
+{
+  if (d == (long double) i)
+    return 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr23268.c b/gcc/testsuite/gcc.target/i386/pr23268.c
new file mode 100644 (file)
index 0000000..b5645b2
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/23268 */
+/* Testcase reduced by Andrew Pinski */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ffast-math" } */
+
+int
+f (float x)
+{
+  int a, b;
+  a = __builtin_log (2.f);
+  b = __builtin_lrint (x);
+  return (a + b);
+}