aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-11-19 12:32:23 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-11-19 12:32:23 +0000
commit756191b7c51263603b91b45f60d5d6acf7250711 (patch)
tree12bfadc14e1e9523af41c36f9907180bc2985ab0 /gcc
parent0ed9a3e3143e00af1ed3f1793dd10cd8d6507de4 (diff)
downloadgcc-756191b7c51263603b91b45f60d5d6acf7250711.zip
gcc-756191b7c51263603b91b45f60d5d6acf7250711.tar.gz
gcc-756191b7c51263603b91b45f60d5d6acf7250711.tar.bz2
combine.c (make_compound_operation): Swap operands of commutative operation if necessary before returning.
* combine.c (make_compound_operation): Swap operands of commutative operation if necessary before returning. From-SVN: r107219
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/combine.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1200433..21b5585 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-19 Joseph S. Myers <joseph@codesourcery.com>
+
+ * combine.c (make_compound_operation): Swap operands of
+ commutative operation if necessary before returning.
+
2005-11-19 Richard Guenther <rguenther@suse.de>
PR middle-end/23294
diff --git a/gcc/combine.c b/gcc/combine.c
index 9f910a7..b43b9b6 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;
}