Skip to content

Commit 973e9db

Browse files
[RISCV][GISEL] Regbank select for scalable G_SELECT
1 parent 8c51ac9 commit 973e9db

File tree

2 files changed

+570
-0
lines changed

2 files changed

+570
-0
lines changed

llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "RISCVRegisterBankInfo.h"
1414
#include "MCTargetDesc/RISCVMCTargetDesc.h"
1515
#include "RISCVSubtarget.h"
16+
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
1617
#include "llvm/CodeGen/MachineRegisterInfo.h"
1718
#include "llvm/CodeGen/RegisterBank.h"
1819
#include "llvm/CodeGen/RegisterBankInfo.h"
@@ -407,6 +408,17 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
407408
case TargetOpcode::G_SELECT: {
408409
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
409410

411+
if (Ty.isVector()) {
412+
auto &Sel = cast<GSelect>(MI);
413+
LLT TestTy = MRI.getType(Sel.getCondReg());
414+
assert(TestTy.isVector() && "Unexpected condition argument type");
415+
OpdsMapping[0] = OpdsMapping[2] = OpdsMapping[3] =
416+
getVRBValueMapping(Ty.getSizeInBits().getKnownMinValue());
417+
OpdsMapping[1] =
418+
getVRBValueMapping(TestTy.getSizeInBits().getKnownMinValue());
419+
break;
420+
}
421+
410422
// Try to minimize the number of copies. If we have more floating point
411423
// constrained values than not, then we'll put everything on FPR. Otherwise,
412424
// everything has to be on GPR.

0 commit comments

Comments
 (0)