[Patch i386] PR78509 - TARGET_C_EXCESS_PRECISION should not return
authorJames Greenhalgh <james.greenhalgh@arm.com>
Fri, 25 Nov 2016 09:25:31 +0000 (09:25 +0000)
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>
Fri, 25 Nov 2016 09:25:31 +0000 (09:25 +0000)
 "unpredictable" for EXCESS_PRECISION_TYPE_STANDARD

gcc/

PR target/78509
* config/i386/i386.c (i386_excess_precision): Do not return
FLT_EVAL_METHOD_UNPREDICTABLE when "type" is
EXCESS_PRECISION_TYPE_STANDARD.
* target.def (excess_precision): Document that targets should
not return FLT_EVAL_METHOD_UNPREDICTABLE when "type" is
EXCESS_PRECISION_TYPE_STANDARD or EXCESS_PRECISION_TYPE_FAST.
Fix typo in first sentence.
* doc/tm.texi: Regenerate.

From-SVN: r242866

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/doc/tm.texi
gcc/target.def

index a0db22e199a7578741823cd58ed658562724bf60..0878c30be5f2e8600be6f5247826806bc6b7dbaa 100644 (file)
@@ -1,3 +1,15 @@
+2016-11-24  James Greenahlgh  <james.greenhalgh@arm.com>
+
+       PR target/78509
+       * config/i386/i386.c (i386_excess_precision): Do not return
+       FLT_EVAL_METHOD_UNPREDICTABLE when "type" is
+       EXCESS_PRECISION_TYPE_STANDARD.
+       * target.def (excess_precision): Document that targets should
+       not return FLT_EVAL_METHOD_UNPREDICTABLE when "type" is
+       EXCESS_PRECISION_TYPE_STANDARD or EXCESS_PRECISION_TYPE_FAST.
+       Fix typo in first sentence.
+       * doc/tm.texi: Regenerate.
+
 2016-11-25  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/78396
index 0e8dda958c399e3bfa35feef1b628e5472adb0f3..a96d597d0ed00280c6240b3ea8afe5c9d03ee574 100644 (file)
@@ -51039,17 +51039,26 @@ ix86_excess_precision (enum excess_precision_type type)
       case EXCESS_PRECISION_TYPE_IMPLICIT:
        /* Otherwise, the excess precision we want when we are
           in a standards compliant mode, and the implicit precision we
-          provide can be identical.  */
+          provide would be identical were it not for the unpredictable
+          cases.  */
        if (!TARGET_80387)
          return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
-       else if (TARGET_MIX_SSE_I387)
-         return FLT_EVAL_METHOD_UNPREDICTABLE;
-       else if (!TARGET_SSE_MATH)
-         return FLT_EVAL_METHOD_PROMOTE_TO_LONG_DOUBLE;
-       else if (TARGET_SSE2)
-         return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
-       else
-         return FLT_EVAL_METHOD_UNPREDICTABLE;
+       else if (!TARGET_MIX_SSE_I387)
+         {
+           if (!TARGET_SSE_MATH)
+             return FLT_EVAL_METHOD_PROMOTE_TO_LONG_DOUBLE;
+           else if (TARGET_SSE2)
+             return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
+         }
+
+       /* If we are in standards compliant mode, but we know we will
+          calculate in unpredictable precision, return
+          FLT_EVAL_METHOD_FLOAT.  There is no reason to introduce explicit
+          excess precision if the target can't guarantee it will honor
+          it.  */
+       return (type == EXCESS_PRECISION_TYPE_STANDARD
+               ? FLT_EVAL_METHOD_PROMOTE_TO_FLOAT
+               : FLT_EVAL_METHOD_UNPREDICTABLE);
       default:
        gcc_unreachable ();
     }
index bd820392b6dfc5d472547033631dc97127bc2baa..ebcadacbe9aa2596181b732b2a5f1df46849e6f8 100644 (file)
@@ -948,7 +948,7 @@ Do not define this macro if it would never modify @var{m}.
 @end defmac
 
 @deftypefn {Target Hook} {enum flt_eval_method} TARGET_C_EXCESS_PRECISION (enum excess_precision_type @var{type})
-Return a value, with the same meaning as @code{FLT_EVAL_METHOD} C that describes which excess precision should be applied.  @var{type} is either @code{EXCESS_PRECISION_TYPE_IMPLICIT}, @code{EXCESS_PRECISION_TYPE_FAST}, or @code{EXCESS_PRECISION_TYPE_STANDARD}.  For @code{EXCESS_PRECISION_TYPE_IMPLICIT}, the target should return which precision and range operations will be implictly evaluated in regardless of the excess precision explicitly added.  For @code{EXCESS_PRECISION_TYPE_STANDARD} and @code{EXCESS_PRECISION_TYPE_FAST}, the target should return the explicit excess precision that should be added depending on the value set for @option{-fexcess-precision=@r{[}standard@r{|}fast@r{]}}.
+Return a value, with the same meaning as the C99 macro @code{FLT_EVAL_METHOD} that describes which excess precision should be applied.  @var{type} is either @code{EXCESS_PRECISION_TYPE_IMPLICIT}, @code{EXCESS_PRECISION_TYPE_FAST}, or @code{EXCESS_PRECISION_TYPE_STANDARD}.  For @code{EXCESS_PRECISION_TYPE_IMPLICIT}, the target should return which precision and range operations will be implictly evaluated in regardless of the excess precision explicitly added.  For @code{EXCESS_PRECISION_TYPE_STANDARD} and @code{EXCESS_PRECISION_TYPE_FAST}, the target should return the explicit excess precision that should be added depending on the value set for @option{-fexcess-precision=@r{[}standard@r{|}fast@r{]}}. Note that unpredictable explicit excess precision does not make sense, so a target should never return @code{FLT_EVAL_METHOD_UNPREDICTABLE} when @var{type} is @code{EXCESS_PRECISION_TYPE_STANDARD} or @code{EXCESS_PRECISION_TYPE_FAST}.
 @end deftypefn
 
 @deftypefn {Target Hook} machine_mode TARGET_PROMOTE_FUNCTION_MODE (const_tree @var{type}, machine_mode @var{mode}, int *@var{punsignedp}, const_tree @var{funtype}, int @var{for_return})
index efcc336593b04bcfeb7712dbd9c154f1a440f193..85a0ac03092e152c642b4104d791f8b68ffadc15 100644 (file)
@@ -5466,9 +5466,9 @@ DEFHOOK_UNDOC
 
 DEFHOOK
 (excess_precision,
- "Return a value, with the same meaning as @code{FLT_EVAL_METHOD} C that\
describes which excess precision should be applied.  @var{type} is\
- either @code{EXCESS_PRECISION_TYPE_IMPLICIT},\
+ "Return a value, with the same meaning as the C99 macro\
@code{FLT_EVAL_METHOD} that describes which excess precision should be\
applied.  @var{type} is either @code{EXCESS_PRECISION_TYPE_IMPLICIT},\
  @code{EXCESS_PRECISION_TYPE_FAST}, or\
  @code{EXCESS_PRECISION_TYPE_STANDARD}.  For\
  @code{EXCESS_PRECISION_TYPE_IMPLICIT}, the target should return which\
@@ -5477,7 +5477,11 @@ DEFHOOK
  @code{EXCESS_PRECISION_TYPE_STANDARD} and\
  @code{EXCESS_PRECISION_TYPE_FAST}, the target should return the\
  explicit excess precision that should be added depending on the\
- value set for @option{-fexcess-precision=@r{[}standard@r{|}fast@r{]}}.",
+ value set for @option{-fexcess-precision=@r{[}standard@r{|}fast@r{]}}.\
+ Note that unpredictable explicit excess precision does not make sense,\
+ so a target should never return @code{FLT_EVAL_METHOD_UNPREDICTABLE}\
+ when @var{type} is @code{EXCESS_PRECISION_TYPE_STANDARD} or\
+ @code{EXCESS_PRECISION_TYPE_FAST}.",
  enum flt_eval_method, (enum excess_precision_type type),
  default_excess_precision)