Commit 70186b34 by Bernd Schmidt Committed by Jeff Law

combine.c (num_sign_bit_copies): In NEG...

        * combine.c (num_sign_bit_copies): In NEG, MULT, DIV and MOD cases,
        when a test can't be performed due to limited width of
        HOST_BITS_PER_WIDE_INT, use the more conservative approximation.
        Fix UDIV case for cases where the first operand has the highest bit
        set.

From-SVN: r24547
parent 548e44b3
Thu Jan 7 00:29:25 199 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* combine.c (num_sign_bit_copies): In NEG, MULT, DIV and MOD cases,
when a test can't be performed due to limited width of
HOST_BITS_PER_WIDE_INT, use the more conservative approximation.
Fix UDIV case for cases where the first operand has the highest bit
set.
Thu Jan 7 00:01:38 1999 Lutz Vieweg <lkv@mania.robin.de> Thu Jan 7 00:01:38 1999 Lutz Vieweg <lkv@mania.robin.de>
* pa.h (reg_class): Add FPUPPER_REGS. * pa.h (reg_class): Add FPUPPER_REGS.
......
...@@ -8020,13 +8020,15 @@ num_sign_bit_copies (x, mode) ...@@ -8020,13 +8020,15 @@ num_sign_bit_copies (x, mode)
is known to be positive, the number of sign bit copies is the is known to be positive, the number of sign bit copies is the
same as that of the input. Finally, if the input has just one bit same as that of the input. Finally, if the input has just one bit
that might be nonzero, all the bits are copies of the sign bit. */ that might be nonzero, all the bits are copies of the sign bit. */
num0 = num_sign_bit_copies (XEXP (x, 0), mode);
if (bitwidth > HOST_BITS_PER_WIDE_INT)
return num0 > 1 ? num0 - 1 : 1;
nonzero = nonzero_bits (XEXP (x, 0), mode); nonzero = nonzero_bits (XEXP (x, 0), mode);
if (nonzero == 1) if (nonzero == 1)
return bitwidth; return bitwidth;
num0 = num_sign_bit_copies (XEXP (x, 0), mode);
if (num0 > 1 if (num0 > 1
&& bitwidth <= HOST_BITS_PER_WIDE_INT
&& (((HOST_WIDE_INT) 1 << (bitwidth - 1)) & nonzero)) && (((HOST_WIDE_INT) 1 << (bitwidth - 1)) & nonzero))
num0--; num0--;
...@@ -8070,19 +8072,27 @@ num_sign_bit_copies (x, mode) ...@@ -8070,19 +8072,27 @@ num_sign_bit_copies (x, mode)
result = bitwidth - (bitwidth - num0) - (bitwidth - num1); result = bitwidth - (bitwidth - num0) - (bitwidth - num1);
if (result > 0 if (result > 0
&& bitwidth <= HOST_BITS_PER_WIDE_INT && (bitwidth > HOST_BITS_PER_WIDE_INT
&& ((nonzero_bits (XEXP (x, 0), mode) || (((nonzero_bits (XEXP (x, 0), mode)
& ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0) & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)
&& ((nonzero_bits (XEXP (x, 1), mode) && ((nonzero_bits (XEXP (x, 1), mode)
& ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)) & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0))))
result--; result--;
return MAX (1, result); return MAX (1, result);
case UDIV: case UDIV:
/* The result must be <= the first operand. */ /* The result must be <= the first operand. If the first operand
return num_sign_bit_copies (XEXP (x, 0), mode); has the high bit set, we know nothing about the number of sign
bit copies. */
if (bitwidth > HOST_BITS_PER_WIDE_INT)
return 1;
else if ((nonzero_bits (XEXP (x, 0), mode)
& ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)
return 1;
else
return num_sign_bit_copies (XEXP (x, 0), mode);
case UMOD: case UMOD:
/* The result must be <= the scond operand. */ /* The result must be <= the scond operand. */
return num_sign_bit_copies (XEXP (x, 1), mode); return num_sign_bit_copies (XEXP (x, 1), mode);
...@@ -8093,20 +8103,20 @@ num_sign_bit_copies (x, mode) ...@@ -8093,20 +8103,20 @@ num_sign_bit_copies (x, mode)
to add 1. */ to add 1. */
result = num_sign_bit_copies (XEXP (x, 0), mode); result = num_sign_bit_copies (XEXP (x, 0), mode);
if (result > 1 if (result > 1
&& bitwidth <= HOST_BITS_PER_WIDE_INT && (bitwidth > HOST_BITS_PER_WIDE_INT
&& (nonzero_bits (XEXP (x, 1), mode) || (nonzero_bits (XEXP (x, 1), mode)
& ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0) & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0))
result --; result--;
return result; return result;
case MOD: case MOD:
result = num_sign_bit_copies (XEXP (x, 1), mode); result = num_sign_bit_copies (XEXP (x, 1), mode);
if (result > 1 if (result > 1
&& bitwidth <= HOST_BITS_PER_WIDE_INT && (bitwidth > HOST_BITS_PER_WIDE_INT
&& (nonzero_bits (XEXP (x, 1), mode) || (nonzero_bits (XEXP (x, 1), mode)
& ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0) & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0))
result --; result--;
return result; return result;
......
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