Don't fold equality comparisons with constants if the operand is larger than

the word size.
This commit is contained in:
mycroft 1998-11-10 18:51:45 +00:00
parent eba40aeea0
commit 246ed829a5
1 changed files with 11 additions and 6 deletions

View File

@ -8863,8 +8863,9 @@ simplify_comparison (code, pop0, pop1)
} }
/* If the first operand is a constant, swap the operands and adjust the /* If the first operand is a constant, swap the operands and adjust the
comparison code appropriately. */ comparison code appropriately, but don't do this if the second operand
if (CONSTANT_P (op0)) is already a constant integer. */
if (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
{ {
tem = op0, op0 = op1, op1 = tem; tem = op0, op0 = op1, op1 = tem;
code = swap_condition (code); code = swap_condition (code);
@ -9006,7 +9007,8 @@ simplify_comparison (code, pop0, pop1)
} }
/* (unsigned) < 0x80000000 is equivalent to >= 0. */ /* (unsigned) < 0x80000000 is equivalent to >= 0. */
else if (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)) else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
&& (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)))
{ {
const_op = 0, op1 = const0_rtx; const_op = 0, op1 = const0_rtx;
code = GE; code = GE;
@ -9021,7 +9023,8 @@ simplify_comparison (code, pop0, pop1)
code = EQ; code = EQ;
/* (unsigned) <= 0x7fffffff is equivalent to >= 0. */ /* (unsigned) <= 0x7fffffff is equivalent to >= 0. */
else if (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1) else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
&& (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1))
{ {
const_op = 0, op1 = const0_rtx; const_op = 0, op1 = const0_rtx;
code = GE; code = GE;
@ -9039,7 +9042,8 @@ simplify_comparison (code, pop0, pop1)
} }
/* (unsigned) >= 0x80000000 is equivalent to < 0. */ /* (unsigned) >= 0x80000000 is equivalent to < 0. */
else if (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)) else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
&& (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)))
{ {
const_op = 0, op1 = const0_rtx; const_op = 0, op1 = const0_rtx;
code = LT; code = LT;
@ -9054,7 +9058,8 @@ simplify_comparison (code, pop0, pop1)
code = NE; code = NE;
/* (unsigned) > 0x7fffffff is equivalent to < 0. */ /* (unsigned) > 0x7fffffff is equivalent to < 0. */
else if (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1) else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
&& (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1))
{ {
const_op = 0, op1 = const0_rtx; const_op = 0, op1 = const0_rtx;
code = LT; code = LT;