This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Enable use of 32bit gather/scatter indices for fixed length vectors
ClosedPublic

Authored by paulwalker-arm on May 8 2022, 1:49 PM.

Diff Detail

Event Timeline

paulwalker-arm created this revision.May 8 2022, 1:49 PM
Herald added a project: Restricted Project. · View Herald Transcript
paulwalker-arm requested review of this revision.May 8 2022, 1:50 PM
david-arm added inline comments.May 9 2022, 8:41 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
4530

It feels like we may have been missing a SVE test before for the case when IndexVT=<vscale x 4 x i32> and DataVT=<vscale x 4 x i64>. This is a hole that you've fixed, but no tests broke. :)

4535

Given we can have types such as <vscale x 3 x > is it worth changing this to

DataVT.getVectorMinNumElements() >= 4

I guess such types will be widened to the next power of 2, but it looks like we might call this before legalisation?

paulwalker-arm added inline comments.May 9 2022, 8:52 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
4530

vscale x 4 x i64 isn't a legal type so this line doesn't have much of a visible effect for scalable vectors. It's just going to stop us from removing an extend that we'll later re-add during type legalisation. After which DataVT will be vscale x 2 x i64 and so the original >=4 clause would have kicked in.

4535

The <vscale x 3 x ...> case is why I changed from the original >=4 to >2 because as you say, it'll be widened to the next power of 2 (i.e. 4) and thus can benefit from the 32bit addressing modes.

david-arm accepted this revision.May 10 2022, 3:50 AM

LGTM! Some nice codegen improvements. :)

This revision is now accepted and ready to land.May 10 2022, 3:50 AM
This revision was landed with ongoing or failed builds.May 22 2022, 5:09 AM
This revision was automatically updated to reflect the committed changes.