summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-19 12:32:23 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-19 12:32:23 +0000
commit3f43639e96ff5442575f15e9f21239649efafee7 (patch)
tree12bfadc14e1e9523af41c36f9907180bc2985ab0 /gcc/combine.c
parent1c9af531f1af2a9b999f17f42f30b1b4f3ee8536 (diff)
downloadgcc-3f43639e96ff5442575f15e9f21239649efafee7.tar.gz
* combine.c (make_compound_operation): Swap operands of
commutative operation if necessary before returning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107219 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 9f910a7b336..b43b9b621c6 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6914,6 +6914,16 @@ make_compound_operation (rtx x, enum rtx_code in_code)
SUBST (XEXP (x, i), new);
}
+ /* If this is a commutative operation, the changes to the operands
+ may have made it noncanonical. */
+ if (COMMUTATIVE_ARITH_P (x)
+ && swap_commutative_operands_p (XEXP (x, 0), XEXP (x, 1)))
+ {
+ tem = XEXP (x, 0);
+ SUBST (XEXP (x, 0), XEXP (x, 1));
+ SUBST (XEXP (x, 1), tem);
+ }
+
return x;
}