[PATCH] D150717: [RISCV] Use scalar stores for splats of zero to memory upto 2 x XLen

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 13:40:00 PDT 2023


reames created this revision.
reames added reviewers: craig.topper, asb, luke, kito-cheng.
Herald added subscribers: jobnoorman, VincentWu, vkmr, frasercrmck, 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: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

The direct motivation here is to undo an unprofitable vectorization performed by SLP, but the transform seems generally useful as well.  If we are storing a zero to memory, we can use two scalar stores (from X0) for all power of two sizes up to 128 (for 64 bit) or 64 (for 32 bit).

One concern here is that splitting the store into two instructions could introduce a store-to-load forwarding stall.  I think this is worth doing, but what do others think?  Should we restrict this to a maximum of XLEN sized operations which can be done in a single store?

This transform is potentially increasing the number of memory operations (from 1 to 2).  The same restriction mentioned above would resolve this as well.

Note: We can extend this transform in a bunch of ways.  I'm deliberately starting narrow to focus on the two questions highlighted just above.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150717

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-calling-conv.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-splat.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-splat.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-mask-splat.ll
  llvm/test/CodeGen/RISCV/rvv/splats-with-mixed-vl.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150717.522764.patch
Type: text/x-patch
Size: 26041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230516/e0f2b63f/attachment.bin>


More information about the llvm-commits mailing list