re PR target/84827 (ICE in extract_insn, at recog.c:2311)
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 Mar 2018 08:05:58 +0000 (09:05 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 13 Mar 2018 08:05:58 +0000 (09:05 +0100)
PR target/84827
* config/i386/i386.md (round<mode>2): For 387 fancy math, disable
pattern if -ftrapping-math -fno-fp-int-builtin-inexact.

* gcc.target/i386/pr84827.c: New test.

From-SVN: r258477

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr84827.c [new file with mode: 0644]

index dd1259351ec90326f18031019ae2531eef1302e5..20dbd41d9e33f354576694db9a0307c54f12bb4b 100644 (file)
@@ -1,5 +1,9 @@
 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/84827
+       * config/i386/i386.md (round<mode>2): For 387 fancy math, disable
+       pattern if -ftrapping-math -fno-fp-int-builtin-inexact.
+
        PR target/84828
        * reg-stack.c (change_stack): Change update_end var from int to
        rtx_insn *, if non-NULL don't update just BB_END (current_block), but
index f4f01c3c0f405ae5767ca54863085c4126f9d09a..bd44243cd2f0f1bd1c104e28eee22f855f33bf4e 100644 (file)
   "(TARGET_USE_FANCY_MATH_387
     && (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
        || TARGET_MIX_SSE_I387)
-    && flag_unsafe_math_optimizations)
+    && flag_unsafe_math_optimizations
+    && (flag_fp_int_builtin_inexact || !flag_trapping_math))
    || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
        && !flag_trapping_math && !flag_rounding_math)"
 {
index 7083c16cd24fcdb5474ec629b539291cc42069c2..db73151c6f3b34644ad097ce362776f182a7456e 100644 (file)
@@ -1,5 +1,8 @@
 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/84827
+       * gcc.target/i386/pr84827.c: New test.
+
        PR target/84828
        * g++.dg/ext/pr84828.C: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr84827.c b/gcc/testsuite/gcc.target/i386/pr84827.c
new file mode 100644 (file)
index 0000000..003258c
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR target/84827 */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -fno-fp-int-builtin-inexact -ftrapping-math -fno-associative-math -mfpmath=387" } */
+
+double
+f1 (double a)
+{
+  return __builtin_round (a);
+}
+
+float
+f2 (float a)
+{
+  return __builtin_roundf (a);
+}
+
+long double
+f3 (long double a)
+{
+  return __builtin_roundl (a);
+}