combine.c (simplify_and_const_int): Don't trunc_int_for_mode "nonzero" as that might add "1" bits.

* combine.c (simplify_and_const_int): Don't trunc_int_for_mode
	"nonzero" as that might add "1" bits.  Ensure "constop" is
	properly sign extened.
	(force_to_mode): Tweak for sign extended constop.

From-SVN: r49112
This commit is contained in:
Alan Modra 2002-01-22 23:42:07 +00:00 committed by Alan Modra
parent 1e7e480e5c
commit d0c9db3079
2 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2002-01-23 Alan Modra <amodra@bigpond.net.au>
* combine.c (simplify_and_const_int): Don't trunc_int_for_mode
"nonzero" as that might add "1" bits. Ensure "constop" is
properly sign extened.
(force_to_mode): Tweak for sign extended constop.
2002-01-22 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.c (some_small_symbolic_mem_operand) Use

View File

@ -6701,7 +6701,8 @@ force_to_mode (x, mode, mask, reg, just_select)
need it. */
if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT
&& (unsigned HOST_WIDE_INT) INTVAL (XEXP (x, 1)) == mask)
&& ((INTVAL (XEXP (x, 1)) & GET_MODE_MASK (GET_MODE (x)))
== (HOST_WIDE_INT) mask))
x = XEXP (x, 0);
/* If it remains an AND, try making another AND with the bits
@ -7755,7 +7756,6 @@ simplify_and_const_int (x, mode, varop, constop)
MODE. */
nonzero = nonzero_bits (varop, mode) & GET_MODE_MASK (mode);
nonzero = trunc_int_for_mode (nonzero, mode);
/* Turn off all bits in the constant that are known to already be zero.
Thus, if the AND isn't needed at all, we will have CONSTOP == NONZERO_BITS
@ -7823,19 +7823,22 @@ simplify_and_const_int (x, mode, varop, constop)
/* If we are only masking insignificant bits, return VAROP. */
if (constop == nonzero)
x = varop;
/* Otherwise, return an AND. See how much, if any, of X we can use. */
else if (x == 0 || GET_CODE (x) != AND || GET_MODE (x) != mode)
x = gen_binary (AND, mode, varop, GEN_INT (constop));
else
{
/* Otherwise, return an AND. */
constop = trunc_int_for_mode (constop, mode);
if (GET_CODE (XEXP (x, 1)) != CONST_INT
|| (unsigned HOST_WIDE_INT) INTVAL (XEXP (x, 1)) != constop)
SUBST (XEXP (x, 1), GEN_INT (constop));
/* See how much, if any, of X we can use. */
if (x == 0 || GET_CODE (x) != AND || GET_MODE (x) != mode)
x = gen_binary (AND, mode, varop, GEN_INT (constop));
SUBST (XEXP (x, 0), varop);
else
{
if (GET_CODE (XEXP (x, 1)) != CONST_INT
|| (unsigned HOST_WIDE_INT) INTVAL (XEXP (x, 1)) != constop)
SUBST (XEXP (x, 1), GEN_INT (constop));
SUBST (XEXP (x, 0), varop);
}
}
return x;