summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-16 17:15:23 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-16 17:15:23 +0000
commitf2e0dda3066e3d34f0c5424885bf4b1e5591fd81 (patch)
tree6894347795260dbf98ccdad4e02632f18f90f9e7 /gcc/simplify-rtx.c
parent363d487eb26583d7e66b35d055543cf7e3348dd9 (diff)
downloadgcc-f2e0dda3066e3d34f0c5424885bf4b1e5591fd81.tar.gz
* fold-const.c (const_binop): Don't constant fold the operation
if the result has overflowed and flag_trapping_math. * simplify-rtx.c (simplify_const_binary_operation): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107092 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 44a1660e688..657b2b59c23 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2242,6 +2242,17 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
&f0, &f1);
real_convert (&result, mode, &value);
+ /* Don't constant fold this floating point operation if
+ the result has overflowed and flag_trapping_math. */
+
+ if (flag_trapping_math
+ && MODE_HAS_INFINITIES (mode)
+ && REAL_VALUE_ISINF (result)
+ && !REAL_VALUE_ISINF (f0)
+ && !REAL_VALUE_ISINF (f1))
+ /* Overflow plus exception. */
+ return 0;
+
/* Don't constant fold this floating point operation if the
result may dependent upon the run-time rounding mode and
flag_rounding_math is set, or if GCC's software emulation