https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123883
Dusan Stojkovic <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #64155|0 |1 is obsolete| | --- Comment #4 from Dusan Stojkovic <[email protected]> --- Created attachment 64215 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64215&action=edit Proposed Patch v2 Thanks for your comments. Regarding comment2 > (simplify > (bit_and > (convert? (lshift integer_onep@1 @0) > (convert? (lshift integer_onep@2 @0)) > (convert:type (lshift:largertype { largertypeone; } @0)) I updated the match.pd pattern to reflect this. Since bit_and is commutative I check if both @1 and @2 are of a larger type and choose the larger one of the two for the new type of left shift. I wasn't able to devise a testcase for the new match.pd pattern, though. Regarding comment3 > (sign_extend:DI (ashift:SI (const_int 1) (shift count))) > > When the shift count is 31, that must generate 0xffffffff80000000. Thus all > those bits must be on in the final result, irrespective of the other operand > of the IOR. > If we look at the output you generate > > (ior:DI (ashift:DI (const_int 1) (match_dup 1)) > (match_dup 2)) > If our count is 31, that will flip on 0x80000000, but the upper 32 bits will > come exclusively from (match_dup 2) when they should all be on according to > the input RTL. Yes, the RTL the previous patch generated doesn't preserve the semantics of the input pattern. Somehow that slipped. It should be fixed now.
