[PATCH] D149667: [RISCV] Use vslide1down lowering for two element non-constant build_vectors

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 10:26:15 PDT 2023


reames created this revision.
reames added reviewers: l.frisken, craig.topper, asb, kito-cheng.
Herald added subscribers: jobnoorman, luke, 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, 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.

When the values are in GPRs, the vslide1down lowering is always better.  We need to greatly improve the splat-and-mask cost model to handle constants in a meaningful way, so for now, limit this to non-constant vectors.

This does send the "partially constant" case down the vslide1down path.  This could cause some regressions, though I don't see any in practice.

The cost modeling for the general case is annoyingly tricky.  We have a great amount of inconsistency around immediate operands, and as a result, the exact constant and exact lowering choice matters a lot.  I'm hoping that we get a "good enough" result without modeling this exactly, but we may need to do something analogous to getIntMatCost (i.e. a search w/costing).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149667

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vector-shuffle-reverse.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i-sat.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-load.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-mask-buildvec.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-scatter.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-store.ll
  llvm/test/CodeGen/RISCV/rvv/fold-vector-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149667.518788.patch
Type: text/x-patch
Size: 11850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/7d3a5870/attachment.bin>


More information about the llvm-commits mailing list