[PATCH, middle-end]: Fix PR78738, unrecognized insn with -ffast-math

Uros Bizjak ubizjak@gmail.com
Thu Dec 8 21:44:00 GMT 2016


Hello!

Attached patch fixes fall-out from excess-precision improvements
patch. As shown in the PR, the code throughout the compiler assumes
FLAG_PRECISION_FAST when flag_unsafe_math_optimizations flag is in
effect. The patch puts back two lines, removed by excess-precision
improvements patch.

2016-12-08  Uros Bizjak  <ubizjak@gmail.com>

    PR middle-end/78738
    * toplev.c (init_excess_precision): Initialize flag_excess_precision
    to EXCESS_PRECISION_FAST for flag_unsafe_math_optimizations.

testsuite/ChangeLog:

2016-12-08  Uros Bizjak  <ubizjak@gmail.com>

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

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for mainline?

Uros.
-------------- next part --------------
Index: testsuite/gcc.target/i386/pr78738.c
===================================================================
--- testsuite/gcc.target/i386/pr78738.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr78738.c	(working copy)
@@ -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);
+}
Index: toplev.c
===================================================================
--- toplev.c	(revision 243456)
+++ toplev.c	(working copy)
@@ -1691,6 +1691,8 @@ init_excess_precision (void)
 {
   gcc_assert (flag_excess_precision_cmdline != EXCESS_PRECISION_DEFAULT);
   flag_excess_precision = flag_excess_precision_cmdline;
+  if (flag_unsafe_math_optimizations)
+    flag_excess_precision = EXCESS_PRECISION_FAST;
 }
 
 /* Initialize things that are both lang-dependent and target-dependent.


More information about the Gcc-patches mailing list