This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Add patterns to select mla/mls
ClosedPublic

Authored by c-rhodes on Jul 25 2022, 8:31 AM.

Details

Summary

Adds patterns for:

add(a, select(mask, mul(b, c), splat(0))) -> mla(a, mask, b, c)
sub(a, select(mask, mul(b, c), splat(0))) -> mls(a, mask, b, c)

Diff Detail

Event Timeline

c-rhodes created this revision.Jul 25 2022, 8:31 AM
c-rhodes requested review of this revision.Jul 25 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2022, 8:31 AM
paulwalker-arm added inline comments.Jul 25 2022, 8:48 AM
llvm/lib/Target/AArch64/SVEInstrFormats.td
2972

What's the connection to b*b? What breaks if you allow b*c?

c-rhodes updated this revision to Diff 447385.Jul 25 2022, 9:54 AM
c-rhodes edited the summary of this revision. (Show Details)

Re-write patterns to match more generic ‘b * c’. Also moves patterns to PatFrag.

c-rhodes marked an inline comment as done.Jul 25 2022, 9:56 AM
c-rhodes added inline comments.
llvm/lib/Target/AArch64/SVEInstrFormats.td
2972

What's the connection to b*b? What breaks if you allow b*c?

Nothing, I'm just a donut. Updated patch to match b*c.

Matt added a subscriber: Matt.Jul 25 2022, 10:07 AM
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
348

AArch64mla_p -> AArch64mla_m1
AArch64mls_p -> AArch64mls_m1

350

FYI: This is consistent with how the code works today but I suspect we'll eventually pull this pattern out because it should really map to the FMLA_ZPZZZ_UNDEF pseudo instructions.

352

Can this be SVEAllActive?

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
350

s/FMLA_ZPZZZ_UNDEF/MLA_ZPZZZ_UNDEF

NOTE: These don't exist today.
c-rhodes updated this revision to Diff 447403.EditedJul 25 2022, 10:40 AM
c-rhodes marked an inline comment as done.

AArch64ml[as]_p -> AArch64ml[as]_m1
(AArch64ptrue 31) -> (SVEAllActive)

c-rhodes marked 2 inline comments as done.Jul 25 2022, 10:41 AM
paulwalker-arm accepted this revision.Jul 25 2022, 4:02 PM
This revision is now accepted and ready to land.Jul 25 2022, 4:02 PM
This revision was landed with ongoing or failed builds.Jul 26 2022, 1:15 AM
This revision was automatically updated to reflect the committed changes.