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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 09:46:46 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);
----------------
topperc wrote:

Should this be `NoSubRegister` not `NoRegister?

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


More information about the llvm-commits mailing list