This is an archive of the discontinued LLVM Phabricator instance.

[SVE][Codegen] Lower legal min & max operations
ClosedPublic

Authored by kmclaughlin on Apr 29 2020, 6:51 AM.

Details

Summary

This patch adds AArch64ISD nodes for [S|U]MIN_PRED
and [S|U]MAX_PRED, and lowers both SVE intrinsics and
IR operations for min and max to these nodes.

There are two forms of these instructions for SVE: a predicated
form and an immediate (unpredicated) form. The patterns
which existed for the latter have been updated to match a
predicated node with an immediate and map this
to the immediate instruction.

Diff Detail

Event Timeline

kmclaughlin created this revision.Apr 29 2020, 6:51 AM
Herald added a project: Restricted Project. · View Herald Transcript
efriedma added inline comments.
llvm/lib/Target/AArch64/SVEInstrFormats.td
3851

I don't see any test for this part of the patch?

kmclaughlin marked an inline comment as done.Apr 30 2020, 6:05 AM
kmclaughlin added inline comments.
llvm/lib/Target/AArch64/SVEInstrFormats.td
3851

The tests for these patterns are in sve-int-arith-imm.ll, which was added as part of D71779

kmclaughlin marked an inline comment as not done.Apr 30 2020, 6:05 AM
efriedma added inline comments.Apr 30 2020, 6:57 AM
llvm/lib/Target/AArch64/SVEInstrFormats.td
3851

I'd also like to see tests for the intrinsic where the second operand is an immediate, since we can pattern-match that to the immdiate smax now.

  • Added tests for the intrinsics where the second operand is an immediate
  • Changed the range SelectSVESignedArithImm checks for, as the range for the immediates of smin & smax is -128 to +127 (inclusive)
kmclaughlin marked an inline comment as done.May 1 2020, 8:54 AM
kmclaughlin added inline comments.
llvm/lib/Target/AArch64/SVEInstrFormats.td
3851

I see what you mean now, I've added the intrinsic tests to sve-intrinsics-int-arith-imm.ll

efriedma accepted this revision.May 1 2020, 6:26 PM

LGTM

This revision is now accepted and ready to land.May 1 2020, 6:26 PM
This revision was automatically updated to reflect the committed changes.