aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-04-11 11:13:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-04-11 11:13:54 +0000
commit4bf371ea7e02b09ea657e8e6340b1b55ea210c6c (patch)
treee7ddfba612149002d6ac430dad00a6d93b024c88 /gcc/simplify-rtx.c
parent266d11d862b0cba843cf3cfcac6dfeab46728bfc (diff)
downloadgcc-4bf371ea7e02b09ea657e8e6340b1b55ea210c6c.zip
gcc-4bf371ea7e02b09ea657e8e6340b1b55ea210c6c.tar.gz
gcc-4bf371ea7e02b09ea657e8e6340b1b55ea210c6c.tar.bz2
re PR middle-end/31530 (Incorrect folding of multiplication and sign change when followed by an addition)
2007-04-11 Richard Guenther <rguenther@suse.de> PR middle-end/31530 * simplify-rtx.c (simplify_binary_operation_1): Do not simplify a * -b + c as c - a * b if we honor sign dependent rounding. From-SVN: r123715
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index e4af34d..cb79aa9 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1688,7 +1688,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
XEXP (op0, 1)));
/* Canonicalize (plus (mult (neg B) C) A) to (minus A (mult B C)). */
- if (GET_CODE (op0) == MULT
+ if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
+ && GET_CODE (op0) == MULT
&& GET_CODE (XEXP (op0, 0)) == NEG)
{
rtx in1, in2;
@@ -1916,7 +1917,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
return reversed;
/* Canonicalize (minus A (mult (neg B) C)) to (plus (mult B C) A). */
- if (GET_CODE (op1) == MULT
+ if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
+ && GET_CODE (op1) == MULT
&& GET_CODE (XEXP (op1, 0)) == NEG)
{
rtx in1, in2;
@@ -1931,7 +1933,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
/* Canonicalize (minus (neg A) (mult B C)) to
(minus (mult (neg B) C) A). */
- if (GET_CODE (op1) == MULT
+ if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
+ && GET_CODE (op1) == MULT
&& GET_CODE (op0) == NEG)
{
rtx in1, in2;