Commit 312def2e by Richard Kenner

(num_sign_bit_copies): Properly handle case when MODE is narrower than that of X.

(num_sign_bit_copies): Properly handle case when MODE is narrower than that
of X.
(simplify_shift_const): Remove change of July 26.

From-SVN: r5110
parent 00aae7b1
...@@ -6687,6 +6687,11 @@ num_sign_bit_copies (x, mode) ...@@ -6687,6 +6687,11 @@ num_sign_bit_copies (x, mode)
bitwidth = GET_MODE_BITSIZE (mode); bitwidth = GET_MODE_BITSIZE (mode);
/* For a smaller object, just ignore the high bits. */
if (bitwidth < GET_MODE_BITSIZE (GET_MODE (x)))
return MAX (1, (num_sign_bit_copies (x, GET_MODE (x))
- (GET_MODE_BITSIZE (GET_MODE (x)) - bitwidth)));
switch (code) switch (code)
{ {
case REG: case REG:
...@@ -7181,11 +7186,6 @@ simplify_shift_const (x, code, result_mode, varop, count) ...@@ -7181,11 +7186,6 @@ simplify_shift_const (x, code, result_mode, varop, count)
else if (count < 0) else if (count < 0)
abort (); abort ();
/* If we have replaced VAROP with something wider
(such as, the SUBREG_REG), then this won't work;
num_sign_bit_copies will give the wrong answer in that case. */
if (shift_mode == GET_MODE (varop))
{
/* An arithmetic right shift of a quantity known to be -1 or 0 /* An arithmetic right shift of a quantity known to be -1 or 0
is a no-op. */ is a no-op. */
if (code == ASHIFTRT if (code == ASHIFTRT
...@@ -7205,7 +7205,6 @@ simplify_shift_const (x, code, result_mode, varop, count) ...@@ -7205,7 +7205,6 @@ simplify_shift_const (x, code, result_mode, varop, count)
&& (count + num_sign_bit_copies (varop, shift_mode) && (count + num_sign_bit_copies (varop, shift_mode)
>= GET_MODE_BITSIZE (shift_mode))) >= GET_MODE_BITSIZE (shift_mode)))
count = GET_MODE_BITSIZE (shift_mode) - 1; count = GET_MODE_BITSIZE (shift_mode) - 1;
}
/* We simplify the tests below and elsewhere by converting /* We simplify the tests below and elsewhere by converting
ASHIFTRT to LSHIFTRT if we know the sign bit is clear. ASHIFTRT to LSHIFTRT if we know the sign bit is clear.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment