[PATCH] D139648: [RISCV] Use vmv.v.i for insertion into lane 0 of undef vector when profitable

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 10:00:07 PST 2022


reames created this revision.
reames added reviewers: craig.topper, pcwang-thead, kito-cheng, asb.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, 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, bollu, simoncook, johnrusso, rbar, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: eopXD, MaskRay.
Herald added a project: LLVM.

If we're initializing lane 0 of an undef vector, we can optionally write to other lanes of the vector.  Doing so may require additional work, so we don't want to e.g. always use a splat.  However, since we don't have an immediate form of vmv.s.x it's useful to use a vmv.v.i if the work required is expected to be equal in practice.

At the moment, the new utility is only used by one case in INSERT_VECTOR_ELT lowering.  My expectation is that we will reuse this in a couple other places, but each of those deserve individual review.

This change is inspired by D137530 <https://reviews.llvm.org/D137530>, but is not directly related to it.  I vaguely remember we discussed the tradeoffs of using vmv.v.i in another recent review, but couldn't find it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139648

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-stepvector.ll
  llvm/test/CodeGen/RISCV/rvv/insertelt-int-rv32.ll
  llvm/test/CodeGen/RISCV/srem-seteq-illegal-types.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139648.481341.patch
Type: text/x-patch
Size: 21596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221208/106760b6/attachment.bin>


More information about the llvm-commits mailing list