[llvm] [RISCV] Reduce LMUL when index is known when lowering insert_vector_elt (PR #66087)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 10:40:08 PDT 2023
================
@@ -7424,6 +7424,19 @@ SDValue RISCVTargetLowering::lowerINSERT_VECTOR_ELT(SDValue Op,
Vec = convertToScalableVector(ContainerVT, Vec, DAG, Subtarget);
}
+ MVT OrigContainerVT = ContainerVT;
+ SDValue OrigVec = Vec;
+ // If we know the index we're going to insert at, we can shrink Vec so that
+ // we're performing the scalar inserts and slideup on a smaller LMUL.
+ if (auto *CIdx = dyn_cast<ConstantSDNode>(Idx)) {
+ if (auto ShrunkVT = getSmallestVTForIndex(ContainerVT, CIdx->getZExtValue(),
+ DL, DAG, Subtarget)) {
+ ContainerVT = *ShrunkVT;
+ Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Vec,
----------------
lukel97 wrote:
I think there's a gap in my understanding, the AVL here is only used for the `vmv.s.x`, which only cares if it's zero or greater than zero. And at VLEN=128, choosing AVL=8 at LMUL=1 SEW=64 will set VL to something > 0?
https://github.com/llvm/llvm-project/pull/66087
More information about the llvm-commits
mailing list