This is an archive of the discontinued LLVM Phabricator instance.

X86: Improve BT instruction selection for 64-bit values.
ClosedPublic

Authored by pcc on Oct 20 2016, 7:04 PM.

Details

Summary

If a 64-bit value is tested against a bit which is known to be in the range
[0..32) (modulo 64), we can use the 32-bit BT instruction, which has a slightly
shorter encoding.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 75387.Oct 20 2016, 7:04 PM
pcc retitled this revision from to X86: Improve BT instruction selection for 64-bit values..
pcc updated this object.
pcc added a reviewer: spatel.
pcc added a subscriber: llvm-commits.
RKSimon added inline comments.Oct 21 2016, 8:49 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
15317 ↗(On Diff #75387)

Would this be cleaner with DAG.MaskedValueIsZero()?

pcc updated this revision to Diff 75457.Oct 21 2016, 11:46 AM
pcc marked an inline comment as done.

Use MaskedValueIsZero

llvm/lib/Target/X86/X86ISelLowering.cpp
15317 ↗(On Diff #75387)

Yes, done.

pcc updated this object.Oct 21 2016, 12:33 PM
spatel accepted this revision.Oct 21 2016, 12:54 PM
spatel edited edge metadata.

LGTM.
Although it seems like this could be a universal strength reduction optimization in IR. Ie, we should shrink these ops with the help of the datalayout in InstCombine?

This revision is now accepted and ready to land.Oct 21 2016, 12:54 PM
This revision was automatically updated to reflect the committed changes.