From 3aceff0d36536f9136f1b3a957e6f7da1d19b41a Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 27 Jun 1996 19:42:23 -0400 Subject: (force_to_mode, case NE): Fix typo and logical error. (simplify_comparison): Don't swap args if op1 is CONST_INT. From-SVN: r12339 --- gcc/combine.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gcc') 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); -- cgit v1.1