This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Code generation for fixed length vector loads & stores.
ClosedPublic

Authored by paulwalker-arm on May 21 2020, 9:29 AM.

Details

Summary

This patch adds base support for code generating fixed length
vector operations targeting a known SVE vector length. To achieve
this we lower fixed length vector operations to equivalent scalable
vector operations, whereby SVE predication is used to limit the
elements processed to those present within the fixed length vector.

Specifically this patch implements load and store operations, which
get lowered to their masked counterparts thusly:

V = load(Addr) =>
  V = extract_fixed_vector(masked_load(make_pred(V.NumElts), Addr))

store(V, (Addr)) =>
  masked_store(insert_fixed_vector(V), make_pred(V.NumElts), Addr))

Diff Detail

Event Timeline

paulwalker-arm created this revision.May 21 2020, 9:29 AM
Herald added a reviewer: efriedma. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

Rebased and simplified to remove changes not needed at this time.
I believe this patch is now ready for review.

efriedma added inline comments.Jun 22 2020, 12:08 PM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
967

This shouldn't be reachable; the type of src is the same as the type of the result.

2450

Also shouldn't be reachable.

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

Could we use the unpredicated variants even if they work on "extra" bits? It doesn't really matter if an add runs on unused elements. Many of the unpredicated instructions work like this. Maybe this doesn't work for certain instructions.

paulwalker-arm marked 6 inline comments as done.Jun 22 2020, 1:13 PM
paulwalker-arm added inline comments.
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
967

Yep, looks like I don't need this after the rebase. Thanks, I'll remove it.

2450

Also removed.

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

Yes, like you said, it comes down to the instruction. For example, we'll have to be careful with floating point. This just gives us a route to be explicit when we know unpredicted instructions are a safe possibility.

It also helps for cases like mul where SVE only has a predicated form but SVE2 adds an unpredicated variant.

paulwalker-arm marked 3 inline comments as done.

Removed redundant demanded elements changes relating to INSERT_SUBVECTOR.

This revision is now accepted and ready to land.Jun 22 2020, 1:48 PM
This revision was automatically updated to reflect the committed changes.