Page MenuHomePhabricator

[AArch64][SVE] Extend svdup->insertelement instcombine pattern to support ...

Authored by joechrisellis on May 4 2021, 1:41 AM.



ptrue patterns other other than VL1.

The current algorithm identifies svdup intrinsic calls where the
predicate is a ptrue with the pattern VL1. It is possible to also
perform this optimisation for ptrue patterns in the range VL1 to VL8

Suppose we have a svdup intrinsic call:

svdup (vec, (ptrue pat), elm)

If pat is VL1, we perform the optimisation as before. Else, if pat is in
the range VL2 to VL8 inclusive, we check that the only uses of this
svdup are other svdups that overwrite every vector element except for
one -- if so, we can replace the svdup call with an insertelement
instruction. In any other case, we bail out.

Diff Detail

Event Timeline

joechrisellis created this revision.May 4 2021, 1:41 AM
joechrisellis requested review of this revision.May 4 2021, 1:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2021, 1:41 AM
joechrisellis planned changes to this revision.May 4 2021, 1:55 AM

Bugfix: check that UserPg's intrinsic ID is a ptrue, otherwise we crash in some circumstances.

efriedma added inline comments.May 4 2021, 11:14 AM

Instead of checking for this specific pattern, can we leverage simplifyDemandedVectorEltsIntrinsic? I guess that doesn't currently work with scalable vectors, though...

joechrisellis marked an inline comment as done.May 5 2021, 2:17 AM
joechrisellis added inline comments.

I'm not sure -- that function doesn't seem to have an override for AArch64 at the moment. Perhaps something for a different patch. 🙂

peterwaller-arm added inline comments.May 6 2021, 3:19 AM

Where are the multiple users?

joechrisellis marked 2 inline comments as done.

Address review comments.

  • @peterwaller-arm:
    • better name for existing test.
    • add a new test to defend against behaviour when there are multiple users of a DUP.
Matt added a subscriber: Matt.May 7 2021, 8:25 AM
peterwaller-arm accepted this revision.May 12 2021, 7:24 AM
This revision is now accepted and ready to land.May 12 2021, 7:24 AM