summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-06 10:56:56 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-06 10:56:56 +0000
commit125b9253d075db53bb8365068c882452d9e948ce (patch)
treedb6ecb99832a88e5633e916992cbab50ca441beb /gcc/simplify-rtx.c
parent2ffc1517702eabe581ff1074ca4b7715fbe9e8ee (diff)
downloadgcc-125b9253d075db53bb8365068c882452d9e948ce.tar.gz
* simplify-rtx.c (simplify_relational_operation): Canonicalize
constant to op1 for testing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31825 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 12d1d8c91b8..c02248e7930 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1591,6 +1591,14 @@ simplify_relational_operation (code, mode, op0, op1)
)
return 0;
+ /* Make sure the constant is second. */
+ if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
+ || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
+ {
+ tem = op0, op0 = op1, op1 = tem;
+ code = swap_condition (code);
+ }
+
/* For integer comparisons of A and B maybe we can simplify A - B and can
then simplify a comparison of that with zero. If A and B are both either
a register or a CONST_INT, this can't help; testing for these cases will