aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-06-27 19:42:23 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-06-27 19:42:23 -0400
commit3aceff0d36536f9136f1b3a957e6f7da1d19b41a (patch)
tree05f8a6a5a24b13b1080f27746c351a0a34e8fc4e
parentf8fe20b224e983e7cb930a04ed6b574cf0f01d60 (diff)
downloadgcc-3aceff0d36536f9136f1b3a957e6f7da1d19b41a.zip
gcc-3aceff0d36536f9136f1b3a957e6f7da1d19b41a.tar.gz
gcc-3aceff0d36536f9136f1b3a957e6f7da1d19b41a.tar.bz2
(force_to_mode, case NE): Fix typo and logical error.
(simplify_comparison): Don't swap args if op1 is CONST_INT. From-SVN: r12339
-rw-r--r--gcc/combine.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 25e8729..e3c8a17 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6231,9 +6231,10 @@ force_to_mode (x, mode, mask, reg, just_select)
case NE:
/* (and (ne FOO 0) CONST) can be (and FOO CONST) if CONST is included
- in STORE_FLAG_VALUE and FOO has no bits that might be nonzero not
- in CONST. */
- if ((mask & ~ STORE_FLAG_VALUE) == 0 && XEXP (x, 0) == const0_rtx
+ in STORE_FLAG_VALUE and FOO has a single bit that might be nonzero,
+ which is in CONST. */
+ if ((mask & ~ STORE_FLAG_VALUE) == 0 && XEXP (x, 1) == const0_rtx
+ && exact_log2 (nonzero_bits (XEXP (x, 0), mode)) >= 0
&& (nonzero_bits (XEXP (x, 0), mode) & ~ mask) == 0)
return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select);
@@ -8992,8 +8993,9 @@ simplify_comparison (code, pop0, pop1)
}
/* If the first operand is a constant, swap the operands and adjust the
- comparison code appropriately. */
- if (CONSTANT_P (op0))
+ comparison code appropriately, but don't do this if the second operand
+ is already a constant integer. */
+ if (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
{
tem = op0, op0 = op1, op1 = tem;
code = swap_condition (code);