This is an archive of the discontinued LLVM Phabricator instance.

[X86] Promote i16 CTTZ/CTTZ_ZERO_UNDEF always.
ClosedPublic

Authored by craig.topper on Aug 2 2022, 9:25 AM.

Details

Summary

If we're going to emit a rep prefix before bsf as proposed in
D130956, it makes sense to promote i16 operations to i32 to avoid
the false depedency of tzcntw.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 2 2022, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 9:25 AM
craig.topper requested review of this revision.Aug 2 2022, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 9:25 AM
RKSimon added inline comments.Aug 2 2022, 9:32 AM
llvm/test/CodeGen/X86/clz.ll
570–571

Would it not be better to just perform the OR %EAX, $65536 and avoid the cmp+branch entirely?

craig.topper added inline comments.Aug 2 2022, 9:37 AM
llvm/test/CodeGen/X86/clz.ll
570–571

isCheapToSpeculateCTTZ() doesn't give type based control.

pengfei accepted this revision.Aug 2 2022, 5:47 PM

LGTM. Thanks for the patch!

This revision is now accepted and ready to land.Aug 2 2022, 5:47 PM
skan accepted this revision.Aug 2 2022, 6:36 PM

LGTM

This revision was landed with ongoing or failed builds.Aug 3 2022, 1:12 PM
This revision was automatically updated to reflect the committed changes.