Commit 52a39a4c by Kaveh R. Ghazi Committed by Kaveh Ghazi

fold-const.c (fold_binary): Guard (X-X) -> 0 transformation with !HONOR_NANS and !HONOR_INFINITIES.

	* fold-const.c (fold_binary): Guard (X-X) -> 0 transformation
	with !HONOR_NANS and !HONOR_INFINITIES.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.

From-SVN: r125652
parent 1c2abe5e
2007-06-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fold-const.c (fold_binary): Guard (X-X) -> 0 transformation
with !HONOR_NANS and !HONOR_INFINITIES.
* simplify-rtx.c (simplify_binary_operation_1): Likewise.
2007-06-12 Tristan Gingold <gingold@adacore.com> 2007-06-12 Tristan Gingold <gingold@adacore.com>
* gcov.c: Comments updated. * gcov.c: Comments updated.
......
...@@ -9585,7 +9585,10 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) ...@@ -9585,7 +9585,10 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
Also note that operand_equal_p is always false if an operand Also note that operand_equal_p is always false if an operand
is volatile. */ is volatile. */
if ((! FLOAT_TYPE_P (type) || flag_unsafe_math_optimizations) if ((! FLOAT_TYPE_P (type)
|| (flag_unsafe_math_optimizations
&& !HONOR_NANS (TYPE_MODE (type))
&& !HONOR_INFINITIES (TYPE_MODE (type))))
&& operand_equal_p (arg0, arg1, 0)) && operand_equal_p (arg0, arg1, 0))
return fold_convert (type, integer_zero_node); return fold_convert (type, integer_zero_node);
......
...@@ -1772,10 +1772,14 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, ...@@ -1772,10 +1772,14 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case MINUS: case MINUS:
/* We can't assume x-x is 0 even with non-IEEE floating point, /* We can't assume x-x is 0 even with non-IEEE floating point,
but since it is zero except in very strange circumstances, we but since it is zero except in very strange circumstances, we
will treat it as zero with -funsafe-math-optimizations. */ will treat it as zero with -funsafe-math-optimizations and
-ffinite-math-only. */
if (rtx_equal_p (trueop0, trueop1) if (rtx_equal_p (trueop0, trueop1)
&& ! side_effects_p (op0) && ! side_effects_p (op0)
&& (! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations)) && (! FLOAT_MODE_P (mode)
|| (flag_unsafe_math_optimizations
&& !HONOR_NANS (mode)
&& !HONOR_INFINITIES (mode))))
return CONST0_RTX (mode); return CONST0_RTX (mode);
/* Change subtraction from zero into negation. (0 - x) is the /* Change subtraction from zero into negation. (0 - x) is the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment