[llvm] [RISCV][GISel] Support select G_INSERT_SUBVECTOR (PR #171092)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 08:51:38 PST 2026


================
@@ -1102,6 +1102,64 @@ bool RISCVInstructionSelector::selectExtractSubvector(MachineInstr &MI) const {
   return true;
 }
 
+bool RISCVInstructionSelector::selectInsertSubVector(MachineInstr &MI) const {
+  assert(MI.getOpcode() == TargetOpcode::G_INSERT_SUBVECTOR);
+
+  Register DstReg = MI.getOperand(0).getReg();
+  Register VecReg = MI.getOperand(1).getReg();
+  Register SubVecReg = MI.getOperand(2).getReg();
+
+  LLT VecTy = MRI->getType(VecReg);
+  LLT SubVecTy = MRI->getType(SubVecReg);
+
+  MVT VecMVT = getMVTForLLT(VecTy);
+  MVT SubVecMVT = getMVTForLLT(SubVecTy);
+
+  unsigned Idx = static_cast<unsigned>(MI.getOperand(3).getImm());
----------------
topperc wrote:

Are out of bound indices guaranteed to be handled before we get here?

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


More information about the llvm-commits mailing list