re PR target/78738 (ICE in extract_insn, at recog.c:2311)
authorUros Bizjak <ubizjak@gmail.com>
Mon, 12 Dec 2016 16:02:28 +0000 (17:02 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 12 Dec 2016 16:02:28 +0000 (17:02 +0100)
PR target/78738
* config/i386/i386.h (X87_ENABLE_ARITH): Also enable for
flag_unsafe_math_optimizations.
(X87_ENABLE_FLOAT): Ditto.

testsuite/ChangeLog:

PR target/78738
* gcc.target/i386/pr78738.c: New test.

From-SVN: r243559

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

index 81b0a3b48e769b6cd3c3109742b45cab8f17b855..4e99e1fac86c2d3ecf93b74d74fbc7b4ab8571db 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-12  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/78738
+       * config/i386/i386.h (X87_ENABLE_ARITH): Also enable for
+       flag_unsafe_math_optimizations.
+       (X87_ENABLE_FLOAT): Ditto.
+
 2016-12-12  Marek Polacek  <polacek@redhat.com>
 
        PR middle-end/78716
index 8bc31f9187d5a2c319754510a921dc4a6d849b30..4d96a4525fb798b18ea47c3caf95cb6aa3873a0a 100644 (file)
@@ -693,13 +693,16 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 /* Whether to allow x87 floating-point arithmetic on MODE (one of
    SFmode, DFmode and XFmode) in the current excess precision
    configuration.  */
-#define X87_ENABLE_ARITH(MODE) \
-  (flag_excess_precision == EXCESS_PRECISION_FAST || (MODE) == XFmode)
+#define X87_ENABLE_ARITH(MODE)                         \
+  (flag_unsafe_math_optimizations                      \
+   || flag_excess_precision == EXCESS_PRECISION_FAST   \
+   || (MODE) == XFmode)
 
 /* Likewise, whether to allow direct conversions from integer mode
    IMODE (HImode, SImode or DImode) to MODE.  */
 #define X87_ENABLE_FLOAT(MODE, IMODE)                  \
-  (flag_excess_precision == EXCESS_PRECISION_FAST      \
+  (flag_unsafe_math_optimizations                      \
+   || flag_excess_precision == EXCESS_PRECISION_FAST   \
    || (MODE) == XFmode                                 \
    || ((MODE) == DFmode && (IMODE) == SImode)          \
    || (IMODE) == HImode)
index 35db8198c28a42f7e49541458a4d82bb9860c5de..510586915627287e2a84f3c96cf2076a801b0a6d 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-12  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/78738
+       * gcc.target/i386/pr78738.c: New test.
+
 2016-12-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * lib/target-supports.exp
diff --git a/gcc/testsuite/gcc.target/i386/pr78738.c b/gcc/testsuite/gcc.target/i386/pr78738.c
new file mode 100644 (file)
index 0000000..d2a2a62
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR middle-end/78738 */
+/* { dg-do compile } */
+/* { dg-options "-O -std=c99 -ffast-math -mfpmath=387" } */
+
+double round (double);
+
+int foo (double a)
+{
+  return round (a);
+}