epiphany.c (epiphany_override_options): If TARGET_SOFT_CMPSF is not enabled, set...
authorJoern Rennecke <joern.rennecke@embecosm.com>
Wed, 3 Dec 2014 16:25:25 +0000 (16:25 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Wed, 3 Dec 2014 16:25:25 +0000 (16:25 +0000)
gcc:
        * config/epiphany/epiphany.c (epiphany_override_options):
        If TARGET_SOFT_CMPSF is not enabled, set flag_finite_math_only.
        * config/epiphany/epiphany.md (mov<mode>cc): Don't use
        reverse_condition_maybe_unordered if flag_finite_math_only is set.
gcc/testsuite:
        * gcc.target/epiphany/fcmp-1.c: New test.

From-SVN: r218323

gcc/ChangeLog
gcc/config/epiphany/epiphany.c
gcc/config/epiphany/epiphany.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/epiphany/fcmp-1.c [new file with mode: 0644]

index 67cc0e12156de39202aa5837818e432c68689525..f361ce2e24ce88136fe0506ad87a14352514886c 100644 (file)
@@ -1,3 +1,10 @@
+2014-12-03  Joern Rennecke  <joern.rennecke@embecosm.com>
+
+       * config/epiphany/epiphany.c (epiphany_override_options):
+       If TARGET_SOFT_CMPSF is not enabled, set flag_finite_math_only.
+       * config/epiphany/epiphany.md (mov<mode>cc): Don't use
+       reverse_condition_maybe_unordered if flag_finite_math_only is set.
+
 2014-12-03  Andrew Stubbs  <ams@codesourcery.com>
 
        Revert:
index 3890149f1e39b5413281b6310e83b12a55238d80..92024aa91f6178b057fd471b952caf25c7b43ee2 100644 (file)
@@ -1542,6 +1542,8 @@ epiphany_override_options (void)
   if (epiphany_stack_offset & 3)
     error ("stack_offset must be a multiple of 4");
   epiphany_stack_offset = (epiphany_stack_offset + 3) & -4;
+ if (!TARGET_SOFT_CMPSF)
+   flag_finite_math_only = 1;
 
   /* This needs to be done at start up.  It's convenient to do it here.  */
   epiphany_init ();
index 822c701c4638d17c4b994a06720309ae6613c9de..a6f6b74b193fe3301a80f27d1b7fb2bacc780dbe 100644 (file)
       && !rtx_equal_p (operands[0], operands[3]))
     {
       rtx tmp = operands[2]; operands[2] = operands[3]; operands[3] = tmp;
-      code = (FLOAT_MODE_P (GET_MODE (cmp_op0))
+      code = (FLOAT_MODE_P (GET_MODE (cmp_op0)) && !flag_finite_math_only
              ? reverse_condition_maybe_unordered (code)
              : reverse_condition (code));
     }
index 38f1d7bc9b5382c157ece4a9ab08273be0337fe6..52fdc16018808a11095a7bb0876e3aba66f25e7a 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-03  Joern Rennecke  <joern.rennecke@embecosm.com>
+
+       * gcc.target/epiphany/fcmp-1.c: New test.
+
 2014-12-03  Petr Murzin  <petr.murzin@intel.com>
 
        * gcc.target/i386/avx512bw-kunpckdq-1.c: Fix regexps for assembler
diff --git a/gcc/testsuite/gcc.target/epiphany/fcmp-1.c b/gcc/testsuite/gcc.target/epiphany/fcmp-1.c
new file mode 100644 (file)
index 0000000..d935eb4
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-options "-Ofast -mno-soft-cmpsf" } */
+
+#if 0
+#include <math.h>
+#else
+extern float fminf (float, float);
+#endif
+void test(int a, float *b, int n)
+{
+    if (n < 10) {
+        *b = a*fminf(0.0,1.0*a);
+    }
+}