[llvm] [RISCV] Refactor extract_subvector lowering slightly. NFC (PR #65391)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 05:23:50 PDT 2023


================
@@ -8710,17 +8711,18 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
   if (RemIdx == 0)
     return Op;
 
-  // Else we must shift our vector register directly to extract the subvector.
-  // Do this using VSLIDEDOWN.
+  // Else SubVecVT is a fractional LMUL and may need to be slid down.
+  assert(RISCVVType::decodeVLMUL(getLMUL(SubVecVT)).second);
 
   // If the vector type is an LMUL-group type, extract a subvector equal to the
-  // nearest full vector register type. This should resolve to a EXTRACT_SUBREG
-  // instruction.
+  // nearest full vector register type.
   MVT InterSubVT = VecVT;
   if (VecVT.bitsGT(getLMUL1VT(VecVT))) {
+    // If VecVT has an LMUL > 1, then SubVecVT should have a smaller LMUL, and
+    // we should have successfully decomposed the extract into a subregister.
+    assert(SubRegIdx != RISCV::NoRegister);
----------------
lukel97 wrote:

This is the new bit I added in the force push. Note to self, don't force push after rebasing since all the rebased changes end up in the comparison.

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


More information about the llvm-commits mailing list