SimplifyDemandedUseBits vs (and (xor %V, -1), 4096)

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

SimplifyDemandedUseBits vs (and (xor %V, -1), 4096)

David Majnemer
SimplifyDemandedUseBits in part because of the following comment:

// FIXME: for XOR, we prefer to force bits to 1 if they will make a -1.

will transform

%neg = xor i32 %V, -1
%and = and i32 %not, 4096


%and = and i32 %V, 4096
%xor = xor i32 %and, 4096

which would generate worse code for platforms that have a negate instruction vs. encoding the immediate in the xor.

What should happen to the code to address the FIXME?

David Majnemer

LLVM Developers mailing list
[hidden email]