This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Add patterns to select masked add/sub instructions
ClosedPublic

Authored by c-rhodes on Jul 14 2022, 4:14 AM.

Details

Summary

Currently, we generate "select" operation with one operand of zeros based the mask of active elements we have and then we issue addition or subtraction we the result of "select". But instead we could issue just masked based addition or subtraction with the mask of active elements.

Diff Detail

Event Timeline

dtemirbulatov created this revision.Jul 14 2022, 4:14 AM
dtemirbulatov requested review of this revision.Jul 14 2022, 4:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2022, 4:14 AM
Matt added a subscriber: Matt.Jul 14 2022, 10:47 AM
c-rhodes commandeered this revision.Jul 21 2022, 8:47 AM
c-rhodes edited reviewers, added: dtemirbulatov; removed: c-rhodes.

Commandeering this patch whilst Dinar is on vacation to ensure it lands before LLVM 15 branches.

c-rhodes updated this revision to Diff 446527.Jul 21 2022, 8:48 AM

Replace multiclass with PatFrag(s)

Perhaps worth having a less descriptive name for the test (e.g. sve-masked-int-arith.ll or even less descriptive) given we're likely to add many more cases.

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
341–342

Is this strictly required? There's only a single pattern and no operand shuffling going on so I think not.

343–348

We have a naming scheme documented above which says these should be called AArch64add_m1 and AArch64sub_m1 which means you don't need to rename the original AArch64subr def.

c-rhodes updated this revision to Diff 446742.Jul 22 2022, 1:42 AM
  • Rename test to be less specific.
  • Remove unnecessary PatFrag for subr.
  • Append _m1 to PatFrags op names.
c-rhodes marked 2 inline comments as done.Jul 22 2022, 1:46 AM
c-rhodes added inline comments.
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
341–342

Is this strictly required? There's only a single pattern and no operand shuffling going on so I think not.

Nope, not sure was I was thinking there, removed

paulwalker-arm accepted this revision.Jul 22 2022, 6:55 AM
This revision is now accepted and ready to land.Jul 22 2022, 6:55 AM
This revision was landed with ongoing or failed builds.Jul 25 2022, 12:22 AM
This revision was automatically updated to reflect the committed changes.
c-rhodes marked an inline comment as done.