[llvm] [RISCV][GISel] Make register bank selection for unary and binary arithmetic ops more generic. (PR #87593)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 15:53:11 PDT 2024
================
@@ -334,10 +321,34 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
case TargetOpcode::G_FMAXNUM:
case TargetOpcode::G_FMINNUM: {
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
- return getInstructionMapping(DefaultMappingID, /*Cost=*/1,
- getFPValueMapping(Ty.getSizeInBits()),
- NumOperands);
+ TypeSize Size = Ty.getSizeInBits();
+
+ const ValueMapping *Mapping;
+ if (Ty.isVector())
+ Mapping = getVRBValueMapping(Size.getKnownMinValue());
+ else if (isPreISelGenericFloatingPointOpcode(Opc))
+ Mapping = getFPValueMapping(Size.getFixedValue());
+ else
+ Mapping = GPRValueMapping;
+
+#ifndef NDEBUG
----------------
topperc wrote:
As we discussed offline, the loop only exists because of the assert in it. If those asserts will be compiled to nothing, there is no need for the loop or any variables in int. AArch64 does something similar.
https://github.com/llvm/llvm-project/pull/87593
More information about the llvm-commits
mailing list