aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2007-06-12 16:28:01 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2007-06-12 16:28:01 +0000
commit52a39a4c5db03b2e614f4bde1632e025348d1ebe (patch)
treeb55b0e708825d64adcda26d97ed19745dc046ede /gcc/simplify-rtx.c
parent1c2abe5e5ca716e91b6c6befc9551c48c03a10ff (diff)
downloadgcc-52a39a4c5db03b2e614f4bde1632e025348d1ebe.zip
gcc-52a39a4c5db03b2e614f4bde1632e025348d1ebe.tar.gz
gcc-52a39a4c5db03b2e614f4bde1632e025348d1ebe.tar.bz2
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
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index cb79aa9..ade3968 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1772,10 +1772,14 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case MINUS:
/* 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
- 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)
&& ! 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);
/* Change subtraction from zero into negation. (0 - x) is the