[PATCH] D157117: [RISCV] Use vmerge for INSERT_VECTOR_ELT w/small constant indices

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 07:46:20 PDT 2023


reames added inline comments.
Herald added a subscriber: sunshaoce.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:6939
+    if (isa<ConstantSDNode>(Idx) && cast<ConstantSDNode>(Idx)->getZExtValue() <= 4 &&
+        VecVT.isFixedLengthVector()) {
+      SmallVector<SDValue> Ops;
----------------
luke wrote:
> Could we still use vmv.v.i on scalable vectors in theory? Since Idx isn't scaled by vscale for insert_vector_elt.
Not without having a bound on the size of the scalable vector, we need all the other lanes to be zero.  (Hm, maybe we could use a zero splat followed by an insert if the lane was less than XLEN even for a scalable vector.)

However, we can use a  vmseq(vid, index) sequence for the scalable case.  This is probably better.  


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157117/new/

https://reviews.llvm.org/D157117



More information about the llvm-commits mailing list