[llvm] [RISCV][GISEL] instruction-select vmclr (PR #110782)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 20:50:05 PDT 2024
================
@@ -379,6 +381,26 @@ RISCVInstructionSelector::selectSHXADD_UWOp(MachineOperand &Root,
return std::nullopt;
}
+InstructionSelector::ComplexRendererFns
+RISCVInstructionSelector::selectVLOp(MachineOperand &Root) const {
+ MachineRegisterInfo &MRI =
+ Root.getParent()->getParent()->getParent()->getRegInfo();
+ assert(Root.isReg() && "Expected operand to be a Register");
+ MachineInstr *RootDef = MRI.getVRegDef(Root.getReg());
+
+ if (RootDef->getOpcode() == TargetOpcode::G_CONSTANT &&
+ RootDef->getOperand(1).getCImm()->getSExtValue() == RISCV::VLMaxSentinel)
+ // If the operand is a G_CONSTANT with value VLMaxSentinel, convert it
+ // to an immediate with value VLMaxSentinel. This is recognized specially by
+ // the vsetvli insertion pass.
+ return {
+ {[=](MachineInstrBuilder &MIB) { MIB.addImm(RISCV::VLMaxSentinel); }}};
+
+ // FIXME: Implement non-VLMAX case. ISEL will fail gracefully by returning
----------------
michaelmaitland wrote:
I added support. I didn't add it because we weren't generating it, but it is good to have support going forward.
https://github.com/llvm/llvm-project/pull/110782
More information about the llvm-commits
mailing list