This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix __GCC_IEC_559 determination for 32-bit x86

HJ's regression tester shows the new test gcc.dg/iec-559-macros-9.c
failing for 32-bit x86.  It turns out the excess precision handling
for determining the value of __GCC_IEC_559 has two problems:
flag_excess_precision hasn't been initialized at the point it's
tested, so flag_excess_precision_cmdline (which *has* been updated
based on flag_iso) needs testing instead, and on x86 with standard
excess precision enabled there is no adddf3 pattern (because all x87
arithmetic is in XFmode) so the default hook wrongly thinks it's a
soft-float target.  This can be fixed by adding an x86-specific hook
implementation; the issue doesn't affect any other target defining
TARGET_FLT_EVAL_METHOD, because only x86 makes sure to disable the
problematic insn patterns for -fexcess-precision=standard.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit (the x86 target hook addition)?

2013-11-05  Joseph Myers  <>

	* config/i386/i386.c (ix86_float_exceptions_rounding_supported_p):
	New function.

2013-11-05  Joseph Myers  <>

	* c-cppbuiltin.c (cpp_iec_559_value): Test
	flag_excess_precision_cmdline not flag_excess_precision.

Index: gcc/config/i386/i386.c
--- gcc/config/i386/i386.c	(revision 204351)
+++ gcc/config/i386/i386.c	(working copy)
@@ -43375,6 +43375,18 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val)
   return val;
+static bool
+ix86_float_exceptions_rounding_supported_p (void)
+  /* For x87 floating point with standard excess precision handling,
+     there is no adddf3 pattern (since x87 floating point only has
+     XFmode operations) so the default hook implementation gets this
+     wrong.  */
+  return TARGET_80387 || TARGET_SSE_MATH;
 /* Initialize the GCC target structure.  */
 #define TARGET_RETURN_IN_MEMORY ix86_return_in_memory
@@ -43747,6 +43759,10 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val)
 #define TARGET_SPILL_CLASS ix86_spill_class
+  ix86_float_exceptions_rounding_supported_p
 struct gcc_target targetm = TARGET_INITIALIZER;
 #include "gt-i386.h"
Index: gcc/c-family/c-cppbuiltin.c
--- gcc/c-family/c-cppbuiltin.c	(revision 204351)
+++ gcc/c-family/c-cppbuiltin.c	(working copy)
@@ -734,7 +734,7 @@ cpp_iec_559_value (void)
   if (flag_iso
       && !c_dialect_cxx ()
-      && flag_excess_precision != EXCESS_PRECISION_STANDARD)
+      && flag_excess_precision_cmdline != EXCESS_PRECISION_STANDARD)
     ret = 0;
   /* Various options are contrary to IEEE 754 semantics.  */

Joseph S. Myers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]