This is an archive of the discontinued LLVM Phabricator instance.

[x86] use BMI 'andn' for logic + compare ops
ClosedPublic

Authored by spatel on Apr 8 2016, 3:00 PM.

Details

Summary

With BMI, we can use 'andn' to save an instruction when the result is only used in a compare.
This is related to one of the potential sequences to check 'isfinite' in:
https://llvm.org/bugs/show_bug.cgi?id=27164

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 53094.Apr 8 2016, 3:00 PM
spatel retitled this revision from to [x86] use BMI 'andn' for logic + compare ops .
spatel updated this object.
spatel added reviewers: ab, RKSimon, kbsmith1.
spatel added a subscriber: llvm-commits.
kbsmith1 accepted this revision.Apr 8 2016, 3:09 PM
kbsmith1 edited edge metadata.

LGTM. One nit, fix or not at your discretion.

lib/Target/X86/X86ISelLowering.cpp
14778 ↗(On Diff #53094)

For me this would read better as
if (!Subtarget.hasBMI() || !isAndn || !isLegalAndnType)

break;
This revision is now accepted and ready to land.Apr 8 2016, 3:09 PM
spatel added inline comments.Apr 8 2016, 3:19 PM
lib/Target/X86/X86ISelLowering.cpp
14778 ↗(On Diff #53094)

Yes, that does read better. Thanks!

This revision was automatically updated to reflect the committed changes.