[PATCH] D102493: [RISCV] Expand unaligned fixed-length vector memory accesses

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 06:27:27 PDT 2021


frasercrmck created this revision.
frasercrmck added reviewers: craig.topper, HsiangKai, khchen, kito-cheng, rogfer01.
Herald added subscribers: vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

RVV vectors must be aligned to their element types, so anything less is
unaligned.

For regular loads and stores, our custom-lowering of fixed-length
vectors meant that we opted out of LegalizeDAG's built-in unaligned
expansion. This patch adds that logic in to our custom lower function.

For masked intrinsics, we declare that anything unaligned is not legal,
leaving the ScalarizeMaskedMemIntrin pass to do the expansion for us.

Note that neither of these methods can handle the expansion of
scalable-vector memory ops, so those cases are left alone by this patch.
Scalable loads and stores already go through expansion by default but
hit an assertion, and scalable masked intrinsics will silently generate
incorrect code. It may be prudent to return an error in both of these
cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102493

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
  llvm/test/Analysis/CostModel/RISCV/fixed-vector-gather.ll
  llvm/test/Analysis/CostModel/RISCV/fixed-vector-scatter.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-unaligned.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102493.345424.patch
Type: text/x-patch
Size: 54170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210514/c6e2b60b/attachment.bin>


More information about the llvm-commits mailing list