[PATCH] D158306: [RISCV] Lower generalized vid sequences up to fixed cost

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 12:24:45 PDT 2023


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

This is another approach to the same problem as D158271 <https://reviews.llvm.org/D158271> and D157976 <https://reviews.llvm.org/D157976>.   The basic enhancement being done is to allow constant materialization for cases we previously restricted to .vi forms.  To keep that from going crazy, I added a cap on the total expansion cost.  This can later be merged into a more general scheme like D157976 <https://reviews.llvm.org/D157976>.

The cap value chosen here (4) is fairly insensitive.  I saw some slight regressions - cases where an alternate non-constant pool load lowering is better - going to 5, but after that, any value up to 10 (the highest I tested), doesn't seem to impact practical codegen much.

The overall structural difference from D157976 <https://reviews.llvm.org/D157976> is using built up sequences (analogous to how we handle integer constant materializations) for both costing and expansion.  I think we can generalize the same basic idea to avoid the need for lambdas in D157976 <https://reviews.llvm.org/D157976>.

Not set on this approach.  Wrote this to see if it worked out, and to trigger more discussion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158306

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/active_lane_mask.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-interleave.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-interleave.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-int-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shuffle-reverse.ll
  llvm/test/CodeGen/RISCV/rvv/shuffle-reverse.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158306.551601.patch
Type: text/x-patch
Size: 43452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230818/4375dcea/attachment.bin>


More information about the llvm-commits mailing list