[PATCH] D149658: [RISCV] Use vslidedown for undef sub-sequences in generic build_vector

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 08:37:22 PDT 2023


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

This is a follow up to D149263 <https://reviews.llvm.org/D149263> which extends the generic vslide1down handling to use vslidedown (without the one) for undef elements, and in particular for undef sub-sequences.  This both removes the domain crossing, and for undef subsequences results in fewer instructions over all.

A question for reviewers.  This could also be written as a set of DAG combines and achieve the same effect.  I'd actually written it that way originally, but given a) it didn't catch anything beyond the buildvec case and b) preference expressed in previous reviews, I switched over.  Which do we prefer here?

Another question - mostly for a possible follow-on.  The codegen this produces for a build_vector which ends with a undef sub-sequence is a series of vslide1downs + a one vslidedown at the end.  An alternate result would be to change VL, and directly insert into the desired positions.  The tradeoff is between a vsetvli toggle (which would be largely unremovable) and an extra vslidedown.  I'm leaning towards keeping this codegen, does that seem like the right outcome?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149658

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-i2fp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-load.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-store.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect.ll
  llvm/test/CodeGen/RISCV/srem-seteq-illegal-types.ll
  llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149658.518750.patch
Type: text/x-patch
Size: 14368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/1e36f53e/attachment.bin>


More information about the llvm-commits mailing list