aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-05-08 16:35:56 +0000
committerDavid Edelsohn <dje@gcc.gnu.org>2008-05-08 12:35:56 -0400
commit627ab8616cc19a4bed7ca2d4273e3dc85aab39b4 (patch)
treea31c9e164e9c5d56daddb94bd73cc84979190e8a /gcc/simplify-rtx.c
parent41ccb5d1b1c83fabd2d0411d8a2c49168518f4bb (diff)
downloadgcc-627ab8616cc19a4bed7ca2d4273e3dc85aab39b4.zip
gcc-627ab8616cc19a4bed7ca2d4273e3dc85aab39b4.tar.gz
gcc-627ab8616cc19a4bed7ca2d4273e3dc85aab39b4.tar.bz2
re PR target/36090 (ppc64 cacoshl miscompilation)
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. From-SVN: r135086
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 44f3ef5..15e4c2a 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3674,6 +3674,24 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
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. */
+ 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
&& CONSTANT_P (ops[n_ops - 2].op))