Fix PR77309, combine eliminates sign bit comparison

Bernd Schmidt bschmidt@redhat.com
Wed Dec 7 13:02:00 GMT 2016


On 10/28/2016 03:43 PM, Segher Boessenkool wrote:
> 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!

Branches too?


Bernd



More information about the Gcc-patches mailing list