summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-16 08:15:35 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-16 08:15:35 +0000
commitdc44b957fb24d4e3581e40788fec69b5f4f4b9bc (patch)
treebddd4255cea6140e8144f36f712a40029350ef81 /gcc/simplify-rtx.c
parentea13ae4c1c4e5e44dbfc1a38703741dec4b15670 (diff)
downloadgcc-dc44b957fb24d4e3581e40788fec69b5f4f4b9bc.tar.gz
2006-03-16 Andreas Krebbel <krebbel1@de.ibm.com>
* simplify-rtx.c (simplify_plus_minus): Simplify within CONST terms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112131 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 754464d06f1..e00e9ccca10 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3320,8 +3320,21 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
else if (swap_commutative_operands_p (lhs, rhs))
tem = lhs, lhs = rhs, rhs = tem;
- tem = simplify_binary_operation (ncode, mode, lhs, rhs);
+ if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT)
+ && (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT))
+ {
+ rtx tem_lhs, tem_rhs;
+
+ tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs;
+ tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs;
+ tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs);
+ if (tem && !CONSTANT_P (tem))
+ tem = gen_rtx_CONST (GET_MODE (tem), tem);
+ }
+ else
+ tem = simplify_binary_operation (ncode, mode, lhs, rhs);
+
/* Reject "simplifications" that just wrap the two
arguments in a CONST. Failure to do so can result
in infinite recursion with simplify_binary_operation