Fix PR77309, combine eliminates sign bit comparison

Segher Boessenkool
Fri Oct 28 13:43:00 GMT 2016

Hi Bernd,

On Fri, Oct 28, 2016 at 01:18:19PM +0200, Bernd Schmidt wrote:
> In this PR, we manage to simplify the code down to
> (lt (and (reg) (signbit)) (const 0))
> simplify_comparison then calls make_compound_operation on the AND 
> expression, and that turns it into a ZERO_EXTRACT of a single bit, 
> changing the meaning of the comparison.
> The problem is a special case we have for comparisons in 
> make_compound_operation, it thinks it should convert single-bit ANDs 
> into such extractions. But this is only valid if the bit isn't the sign 
> bit, or if we're testing for equality with zero.
> The following patch was bootstrapped and tested on x86_64-linux. Ok?

Okay, thanks!


More information about the Gcc-patches mailing list