This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Add support for non-element-type sized scaling when lowering MGATHER/MSCATTER.
ClosedPublic

Authored by paulwalker-arm on Apr 13 2022, 4:39 AM.

Details

Summary

The lowering code did not use the scale operand of MGATHER/MSCATTER
nodes, but instead assumed scaled indices were always scaled based
on the element type of the memory type. This patch adds the missing
support by rewritting the nodes as unscaled variants.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Apr 13 2022, 4:39 AM
Herald added a project: Restricted Project. · View Herald Transcript
paulwalker-arm requested review of this revision.Apr 13 2022, 4:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 4:39 AM

Rebased so this is now the base of a miniseries and thus contains a little more refactoring than before.

Matt added a subscriber: Matt.Apr 13 2022, 4:54 PM

This looks like a nice couple of fixes @paulwalker-arm, thanks! I had a couple of minor comments ...

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
4675

Hi @paulwalker-arm, you're introducing an implicit TypeSize->uint64_t cast here. Could you either:

  1. Change this to MemVT.getScalarType().getStoreSize().getFixedSize(), or alternatively ...
  2. Add a new function EVT called getScalarStoreSize(), similar to getScalarSizeInBits(), if you think that's useful?
4791

This code looks almost identical to the code in LowerMGATHER, except one creates a masked gather at the end and the other creates a masked scatter. Is it worth commonising at least part of this code?

Add and make use of getScalarStoreSize helper function.

paulwalker-arm marked an inline comment as done.Apr 14 2022, 2:48 AM
paulwalker-arm added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
4675

I've gone with option 2 as we will want this when removing other instances where we're relying on the implicit cast.

4791

I guess it depends on how strongly you feel about this. It's the "almost" part that made me think commonising the code would make it less readable. The code itself is likely to shrink as well because I've got other patches in the works that will remove the need to modify IndexType so we're only talking about the couple of lines to create the shift and constant 1.

david-arm accepted this revision.Apr 14 2022, 2:51 AM

LGTM! Thanks for the changes Paul. :)

This revision is now accepted and ready to land.Apr 14 2022, 2:51 AM
This revision was landed with ongoing or failed builds.Apr 14 2022, 4:05 AM
This revision was automatically updated to reflect the committed changes.
paulwalker-arm marked an inline comment as done.
skan added a subscriber: skan.Apr 26 2022, 5:19 AM