This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Add ImmArg property to intrinsics with immediates
ClosedPublic

Authored by kmclaughlin on Jan 13 2020, 5:54 AM.

Details

Summary

Several SVE intrinsics with immediate arguments (including those
added by D70253 & D70437) do not use the ImmArg property.
This patch adds ImmArg<Op> where required and changes
the appropriate patterns which match the immediates.

Diff Detail

Event Timeline

kmclaughlin created this revision.Jan 13 2020, 5:54 AM
Herald added a project: Restricted Project. · View Herald Transcript
sdesmalen added inline comments.Jan 13 2020, 10:23 AM
llvm/lib/Target/AArch64/AArch64InstrFormats.td
1099

@efriedma @rengolin The idea here is to use a ComplexPattern to match either a TargetConstant or a Constant (as at this point in selectiondag, it probably no longer matters what kind of constant it is, as we want to match an instruction). This avoids having to duplicate patternfragments for TImmLeaf and ImmLeaf for all the operands deriving from AsmVectorIndexOpnd.

Any thoughts on this approach?

llvm/lib/Target/AArch64/SVEInstrFormats.td
4386

I think these can just as well use tvecshiftR8, tvecshiftR16, (etc) as those already exist.

efriedma added inline comments.Jan 13 2020, 12:19 PM
llvm/lib/Target/AArch64/AArch64InstrFormats.td
1099

You should never need to duplicate a pattern. If the pattern is matching an ImmArg intrinsic, it has to be a TargetConstant; otherwise, it has to be a Constant. I would rather keep the corresponding pattern fragments strict, to avoid confusion about what we're expecting. Also, looking to the future, ComplexPatterns are more complicated to port to GlobalISel.

If the concern is just that you'll have to define the pattern fragments multiple times, could you use a multiclass?

  • Removed shiftimm patterns and reused tvecshiftR8, etc
  • Removed complex patterns used by AsmVectorIndexOpnd and instead created a multiclass (VectorIndex) to create a PatLeaf with timm if "_timm" is appended
efriedma accepted this revision.Jan 15 2020, 1:40 PM

LGTM with one question

llvm/lib/Target/AArch64/AArch64InstrFormats.td
1106

Using ImmLeaf/TImmLeaf doesn't work here?

This revision is now accepted and ready to land.Jan 15 2020, 1:40 PM
  • Replace PatLeaf with ImmLeaf & TImmLeaf in the VectorIndex multiclass
kmclaughlin marked an inline comment as done.Jan 16 2020, 3:31 AM
kmclaughlin added inline comments.
llvm/lib/Target/AArch64/AArch64InstrFormats.td
1106

Thanks for the suggestion, it looks like I can use ImmLeaf & TImmLeaf here (and use Imm again instead of N->getZExtValue() in VectorIndex1, etc below)

efriedma accepted this revision.Jan 16 2020, 2:37 PM
This revision was automatically updated to reflect the committed changes.
kmclaughlin marked an inline comment as done.