Page MenuHomePhabricator

[X86] fold select to mask instructions.
ClosedPublic

Authored by LuoYuanke on Thu, May 25, 10:35 PM.

Details

Summary

When avx512 is available the lhs operand of select instruction can be
folded with mask instruction, while the rhs operand can't. This patch is
to commute the lhs and rhs of the select instruction to create the
opportunity of folding.

Diff Detail

Event Timeline

LuoYuanke created this revision.Thu, May 25, 10:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptThu, May 25, 10:35 PM
LuoYuanke requested review of this revision.Thu, May 25, 10:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptThu, May 25, 10:35 PM
RKSimon added inline comments.Fri, May 26, 2:09 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
20028

Do we actually need canCombineAsMaskOperation to take 2 input operands? Its other use in lowerVECTOR_SHUFFLE looks like it could be split to call it twice.

LuoYuanke added inline comments.Fri, May 26, 4:43 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
20028

Taking 1 input operand looks better.

LuoYuanke updated this revision to Diff 526028.Fri, May 26, 4:44 AM

NFC. Address Simon's comments.

RKSimon accepted this revision.Fri, May 26, 5:13 AM

LGTM - please commit the canCombineAsMaskOperation/lowerVECTOR_SHUFFLE refactor first as a pre-commit and then the commuteSelect patch afterward.

This revision is now accepted and ready to land.Fri, May 26, 5:13 AM
LuoYuanke updated this revision to Diff 526046.Fri, May 26, 6:26 AM

Rebase and add code comments.

This revision was landed with ongoing or failed builds.Fri, May 26, 6:53 AM
This revision was automatically updated to reflect the committed changes.