This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] -ffinite-math-only A-A
-Inf - -Inf is Nan, Inf - -Inf would be Inf and Inf - Inf is NaN.
This A-A optimisation would give 0.0 so the !HONOR_INFINITY is required
in all the cases.
rereading myself, Inf - -Inf is not A - A so this case doesn't exist.
Geert and you are right only !HONOR_NANS is required.
>>
Geert is right with that only !HONOR_NANS is required).
!NONOR_INFINITY was already checked, I didn't add it. So maybe it was
missing in its wiki ? CCing him.
patch simpified as attached,
Richard.
Best Regards,
Christian
Index: fold-const.c
===================================================================
--- fold-const.c (revision 127666)
+++ fold-const.c (working copy)
@@ -10149,10 +10149,7 @@
Also note that operand_equal_p is always false if an operand
is volatile. */
- if ((! FLOAT_TYPE_P (type)
- || (flag_unsafe_math_optimizations
- && !HONOR_NANS (TYPE_MODE (type))
- && !HONOR_INFINITIES (TYPE_MODE (type))))
+ if ((! FLOAT_TYPE_P (type) || !HONOR_NANS (TYPE_MODE (type)))
&& operand_equal_p (arg0, arg1, 0))
return fold_convert (type, integer_zero_node);
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c (revision 127666)
+++ simplify-rtx.c (working copy)
@@ -1773,10 +1773,7 @@
-ffinite-math-only. */
if (rtx_equal_p (trueop0, trueop1)
&& ! side_effects_p (op0)
- && (! FLOAT_MODE_P (mode)
- || (flag_unsafe_math_optimizations
- && !HONOR_NANS (mode)
- && !HONOR_INFINITIES (mode))))
+ && (! FLOAT_MODE_P (mode) || !HONOR_NANS (mode)))
return CONST0_RTX (mode);
/* Change subtraction from zero into negation. (0 - x) is the