diff options
author | Jeffrey A Law <law@cygnus.com> | 2001-06-28 00:14:23 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2001-06-27 18:14:23 -0600 |
commit | b42abad88a72de91687aca2d9d360bd4e259b84e (patch) | |
tree | 55584ceccdd01345c451779238b56ecb878546f7 | |
parent | 6dc04dec655a628940545bcceaa656178d1f2040 (diff) | |
download | gcc-b42abad88a72de91687aca2d9d360bd4e259b84e.zip gcc-b42abad88a72de91687aca2d9d360bd4e259b84e.tar.gz gcc-b42abad88a72de91687aca2d9d360bd4e259b84e.tar.bz2 |
simplify-rtx.c (simplify_rtx): Canonicalize commutative expressions by putting complex operands first and...
* simplify-rtx.c (simplify_rtx): Canonicalize commutative expressions
by putting complex operands first and constants second.
From-SVN: r43621
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5a89256..3f37468 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Jun 27 18:01:09 2001 Jeffrey A Law (law@cygnus.com) + + * simplify-rtx.c (simplify_rtx): Canonicalize commutative expressions + by putting complex operands first and constants second. + 2001-06-27 Gabriel Dos Reis <gdr@codesourcery.com> * diagnostic.h: Add documentation. Make macros polymorphic. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index b2123c1..a5ef099 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2520,8 +2520,26 @@ simplify_rtx (x) case '1': return simplify_unary_operation (code, mode, XEXP (x, 0), GET_MODE (XEXP (x, 0))); - case '2': case 'c': + /* Put complex operands first and constants second if commutative. */ + if (GET_RTX_CLASS (code) == 'c' + && ((CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT) + || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'o' + && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o') + || (GET_CODE (XEXP (x, 0)) == SUBREG + && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == 'o' + && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o'))) + { + rtx tem; + + tem = XEXP (x, 0); + XEXP (x, 0) = XEXP (x, 1); + XEXP (x, 1) = tem; + return simplify_binary_operation (code, mode, + XEXP (x, 0), XEXP (x, 1)); + } + + case '2': return simplify_binary_operation (code, mode, XEXP (x, 0), XEXP (x, 1)); case '3': |