aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-05-08 16:40:17 +0000
committerDavid Edelsohn <edelsohn@gnu.org>2008-05-08 16:40:17 +0000
commit7526ac6789c95bf38e805a352bb955d0f7c0e349 (patch)
treece808c504c7340f00f1cbfe2f28b5c1a47409f25
parent3843245dd193e909ecd2edc71a19b02577251a41 (diff)
2008-05-08 Paolo Bonzini <bonzini@gnu.org>
PR target/36090 * simplify-rtx.c (simplify_plus_minus): Create CONST of similar RTX_CONST_OBJ before CONST_INT. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_3-branch@135087 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c21
2 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8f04550a5bb..d747e8b4c58 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-08 Paolo Bonzini <bonzini@gnu.org>
+
+ PR target/36090
+ * simplify-rtx.c (simplify_plus_minus): Create CONST of
+ similar RTX_CONST_OBJ before CONST_INT.
+
2008-05-08 Richard Guenther <rguenther@suse.de>
PR middle-end/36154
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index f8756040ce0..7b5f2d05285 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3659,7 +3659,26 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
combination loop to avoid recursion. Create one manually now.
The combination loop should have ensured that there is exactly
one CONST_INT, and the sort will have ensured that it is last
- in the array and that any other constant will be next-to-last. */
+ in the array and that any other constant will be next-to-last.
+ Group similar RTX_CONST_OBJ first, then CONST_INT. */
+
+ if (GET_CODE (ops[n_ops - 1].op) == CONST_INT)
+ i = n_ops - 2;
+ else
+ i = n_ops - 1;
+
+ if (i >= 1
+ && ops[i].neg
+ && !ops[i - 1].neg
+ && CONSTANT_P (ops[i].op)
+ && GET_CODE (ops[i].op) == GET_CODE (ops[i - 1].op))
+ {
+ ops[i - 1].op = gen_rtx_MINUS (mode, ops[i - 1].op, ops[i].op);
+ ops[i - 1].op = gen_rtx_CONST (mode, ops[i - 1].op);
+ if (i < n_ops - 1)
+ ops[i] = ops[i + 1];
+ n_ops--;
+ }
if (n_ops > 1
&& GET_CODE (ops[n_ops - 1].op) == CONST_INT