[PATCH] D144092: [RISCV] Lower interleave and deinterleave intrinsics

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 04:06:22 PST 2023


luke created this revision.
luke added reviewers: asb, reames, craig.topper, kito-cheng, CarolineConcatto, paulwalker-arm.
Herald added subscribers: pmatos, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Lower the two intrinsics introduced in D141924 <https://reviews.llvm.org/D141924>.
Unfortunately there are no native interleave + deinterleave instructions
on RISC-V, so we need to use quite a lot of vrgathers here.

For deinterleaving, we can construct two indices of even and odd indices
and then gather the original vectors out of the larger, concatenated
vector.
For interleaving it's a bit trickier. We need to first create two
vector masks of alternating bits (... 0 1 0 1 for the even elements and
... 1 0 1 0) for the odd elements).
Then we "decompress" the source vector with a mask so that we place the
source vector elements in the right lanes.

Although the code generated for these intrinsics is not ideal, these
intrinsics can be combined with loads and stores into the much more
efficient segmented load and store instructions in a following patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144092

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/test/CodeGen/RISCV/rvv/vector-deinterleave-fixed.ll
  llvm/test/CodeGen/RISCV/rvv/vector-deinterleave.ll
  llvm/test/CodeGen/RISCV/rvv/vector-interleave-fixed.ll
  llvm/test/CodeGen/RISCV/rvv/vector-interleave.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144092.497629.patch
Type: text/x-patch
Size: 52269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230215/6e421dcf/attachment.bin>


More information about the llvm-commits mailing list