[llvm] [RISCV][GISel] Add instruction selection for G_SEXT, G_ZEXT, and G_SEXT_INREG (PR #67359)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 12:26:37 PDT 2023
================
@@ -363,6 +366,32 @@ bool RISCVInstructionSelector::selectConstant(MachineInstr &MI,
return true;
}
+bool RISCVInstructionSelector::selectSExtInreg(MachineInstr &MI,
+ MachineIRBuilder &MIB) const {
+ if (!STI.isRV64())
+ return false;
+
+ const MachineOperand &Size = MI.getOperand(2);
+ // Only Size == 32 (i.e. shift by 32 bits) is acceptable at this point.
+ if (!Size.isImm() || Size.getImm() != 32)
+ return false;
+
+ const MachineOperand &Src = MI.getOperand(1);
+ const MachineOperand &Dst = MI.getOperand(0);
+ assert(Src.isReg() && Dst.isReg());
----------------
topperc wrote:
You can drop this assert. getReg() will assert if they aren't registers.
https://github.com/llvm/llvm-project/pull/67359
More information about the llvm-commits
mailing list