combine.c (simplify_comparison <ASHIFTRT, LSHIFTRT>): Correct test for overflow of constant.

* combine.c (simplify_comparison <ASHIFTRT, LSHIFTRT>): Correct
	test for overflow of constant.

From-SVN: r51350
This commit is contained in:
Alan Modra 2002-03-25 23:11:30 +00:00 committed by Alan Modra
parent c8d003c104
commit 75c56fe03d
2 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2002-03-26 Alan Modra <amodra@bigpond.net.au>
* combine.c (simplify_comparison <ASHIFTRT, LSHIFTRT>): Correct
test for overflow of constant.
2002-03-25 Richard Earnshaw <rearnsha@arm.com>
PR target/2623

View File

@ -10838,9 +10838,9 @@ simplify_comparison (code, pop0, pop1)
&& XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1)
&& (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
MODE_INT, 1)) != BLKmode
&& ((unsigned HOST_WIDE_INT) const_op <= GET_MODE_MASK (tmode)
|| ((unsigned HOST_WIDE_INT) -const_op
<= GET_MODE_MASK (tmode))))
&& (((unsigned HOST_WIDE_INT) const_op
+ (GET_MODE_MASK (tmode) >> 1) + 1)
<= GET_MODE_MASK (tmode)))
{
op0 = gen_lowpart_for_combine (tmode, XEXP (XEXP (op0, 0), 0));
continue;
@ -10857,9 +10857,9 @@ simplify_comparison (code, pop0, pop1)
&& XEXP (op0, 1) == XEXP (XEXP (XEXP (op0, 0), 0), 1)
&& (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
MODE_INT, 1)) != BLKmode
&& ((unsigned HOST_WIDE_INT) const_op <= GET_MODE_MASK (tmode)
|| ((unsigned HOST_WIDE_INT) -const_op
<= GET_MODE_MASK (tmode))))
&& (((unsigned HOST_WIDE_INT) const_op
+ (GET_MODE_MASK (tmode) >> 1) + 1)
<= GET_MODE_MASK (tmode)))
{
rtx inner = XEXP (XEXP (XEXP (op0, 0), 0), 0);
rtx add_const = XEXP (XEXP (op0, 0), 1);
@ -10884,9 +10884,12 @@ simplify_comparison (code, pop0, pop1)
&& mode_width <= HOST_BITS_PER_WIDE_INT
&& (nonzero_bits (XEXP (op0, 0), mode)
& (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0
&& (const_op == 0
|| (floor_log2 (const_op) + INTVAL (XEXP (op0, 1))
< mode_width)))
&& (((unsigned HOST_WIDE_INT) const_op
+ (GET_CODE (op0) != LSHIFTRT
? ((GET_MODE_MASK (mode) >> INTVAL (XEXP (op0, 1)) >> 1)
+ 1)
: 0))
<= GET_MODE_MASK (mode) >> INTVAL (XEXP (op0, 1))))
{
/* If the shift was logical, then we must make the condition
unsigned. */