This is an archive of the discontinued LLVM Phabricator instance.

AArch64 SVE: add sve patterns to make use of predicated smin, umin, smax, and umax instructions, add ll test file for the new patterns
ClosedPublic

Authored by hassnaa-arm on Aug 18 2022, 2:53 AM.

Diff Detail

Event Timeline

hassnaa-arm created this revision.Aug 18 2022, 2:53 AM
hassnaa-arm requested review of this revision.Aug 18 2022, 2:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 2:53 AM
hassnaa-arm edited reviewers, added: sdesmalen; removed: kmclaughlin.Aug 18 2022, 5:30 AM
david-arm edited reviewers, added: kmclaughlin; removed: sdesmalen.Aug 18 2022, 6:03 AM

Thanks for this @hassnaa-arm, it looks like a useful addition to the patterns! I just spotted an issue with the test output for elements other than i32.

llvm/test/CodeGen/AArch64/sve-min-max-pred.ll
14

I don't quite understand what's going on here, but this doesn't look right I'm afraid! The vector elements are 8-bits so I was expecting to see this instead:

; CHECK: smax z0.b, p0/m, z0.b, z1.b

It's the same problem for all the smax/smin/umax/umin examples here where the element type != i32.

32

This looks right!

Could you also add a brief description

llvm/test/CodeGen/AArch64/sve-min-max-pred.ll
3

I think you only need one RUN line here and it should specify the SVE attribute, i.e. something like this:

; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -o - | FileCheck %s

Add sve patterns to make use of predicated smin, umin, smax, umax, and its test file.

Matt added a subscriber: Matt.Aug 18 2022, 9:34 AM
david-arm added a subscriber: sdesmalen.

Sorry @hassnaa-arm, I accidentally removed @sdesmalen as a reviewer from your patch yesterday!

sdesmalen added inline comments.Aug 22 2022, 2:26 AM
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
379

Can these defs use EitherVSelectOrPassthruPatFrags instead?

AArch64 SVE: add sve patterns to make use of predicated smin, umin, smax, and umax instructions, add ll test file for the new patterns

sdesmalen accepted this revision.Aug 22 2022, 7:04 AM

LGTM with nit addressed, thanks @hassnaa-arm!

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

nit: can you remove the newlines and move these definitions to line 247? (after previous uses of EitherVSelectOrPassthruPatFrags)

This revision is now accepted and ready to land.Aug 22 2022, 7:04 AM

AArch64 SVE: add sve patterns to make use of predicated smin, umin, smax, and umax instructions, add sve-min-max.ll test file for the new patterns

This revision was automatically updated to reflect the committed changes.