This is an archive of the discontinued LLVM Phabricator instance.

[X86] Improve detection of unneeded shift amount masking to also handle the case that the LHS has known zeroes in it
ClosedPublic

Authored by craig.topper on Feb 20 2019, 1:40 PM.

Details

Summary

If the LHS has known zeros, the RHS immediate will have had bits removed. So call computeKnownBits to get the known zeroes so we can handle this case.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 20 2019, 1:40 PM
This revision is now accepted and ready to land.Feb 25 2019, 10:50 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2019, 11:42 AM
RKSimon added inline comments.Mar 6 2020, 3:56 AM
llvm/trunk/lib/Target/X86/X86InstrCompiler.td
1803 ↗(On Diff #188230)

@craig.topper This looks like a typo - shouldn't it be ShiftMask64 for the GR64 case?

craig.topper marked an inline comment as done.Mar 6 2020, 9:11 AM
craig.topper added inline comments.
llvm/trunk/lib/Target/X86/X86InstrCompiler.td
1803 ↗(On Diff #188230)

Yeah that does look like a typo. Must have copy/pasted too much.

RKSimon added inline comments.Mar 6 2020, 9:42 AM
llvm/trunk/lib/Target/X86/X86InstrCompiler.td
1803 ↗(On Diff #188230)

Cheers, D75748 replaces all this code but I just wanted to make sure I hadn't made a dumb assumption about SHLD/SHRD.