[llvm] [RISCV] Shrink vslidedown when lowering fixed extract_subvector (PR #65598)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 08:02:12 PDT 2023


================
@@ -8684,6 +8684,39 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
       ContainerVT = getContainerForFixedLengthVector(VecVT);
       Vec = convertToScalableVector(ContainerVT, Vec, DAG, Subtarget);
     }
+
+    // The minimum number of elements for a scalable vector type, e.g. nxv1i32
----------------
preames wrote:

An alternate suggestion here:
Instead of working in bits, work in indices.  The last index touched by the extract is just Index + ElementCount(VecVT) - 1.
Then reuse the logic from the extract_vector_elt bit (pull out a helper function) to find the minimal ContrainerVT which contains that index.  If it's smaller than ContainerVT, use it.

https://github.com/llvm/llvm-project/pull/65598


More information about the llvm-commits mailing list