Fix PR77309, combine eliminates sign bit comparison

Bernd Schmidt bschmidt@redhat.com
Fri Oct 28 11:18:00 GMT 2016


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?


Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr77309.diff
Type: text/x-patch
Size: 3369 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161028/3ce59ab4/attachment.bin>


More information about the Gcc-patches mailing list