mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 23:37:20 +08:00
[RISCV] Use PseudoInstExpansion for PseudoReadVLENB and PseudoReadVL. NFC
This lets tablegen generated the code and avoids a string lookup of the CSR name at runtime.
This commit is contained in:
@@ -5427,12 +5427,14 @@ let Predicates = [HasVInstructions] in {
|
||||
let hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 1 in {
|
||||
def PseudoReadVLENB : Pseudo<(outs GPR:$rd), (ins),
|
||||
[(set GPR:$rd, (riscv_read_vlenb))]>,
|
||||
PseudoInstExpansion<(CSRRS GPR:$rd, SysRegVLENB.Encoding, X0)>,
|
||||
Sched<[WriteRdVLENB]>;
|
||||
}
|
||||
|
||||
let hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 1,
|
||||
Uses = [VL] in
|
||||
def PseudoReadVL : Pseudo<(outs GPR:$rd), (ins), []>;
|
||||
def PseudoReadVL : Pseudo<(outs GPR:$rd), (ins), []>,
|
||||
PseudoInstExpansion<(CSRRS GPR:$rd, SysRegVL.Encoding, X0)>;
|
||||
|
||||
foreach lmul = MxList in {
|
||||
foreach nf = NFSet<lmul>.L in {
|
||||
|
||||
@@ -253,18 +253,6 @@ bool llvm::lowerRISCVMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RISCV::PseudoReadVLENB:
|
||||
OutMI.setOpcode(RISCV::CSRRS);
|
||||
OutMI.addOperand(MCOperand::createImm(
|
||||
RISCVSysReg::lookupSysRegByName("VLENB")->Encoding));
|
||||
OutMI.addOperand(MCOperand::createReg(RISCV::X0));
|
||||
break;
|
||||
case RISCV::PseudoReadVL:
|
||||
OutMI.setOpcode(RISCV::CSRRS);
|
||||
OutMI.addOperand(
|
||||
MCOperand::createImm(RISCVSysReg::lookupSysRegByName("VL")->Encoding));
|
||||
OutMI.addOperand(MCOperand::createReg(RISCV::X0));
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ def : SysReg<"vstart", 0x008>;
|
||||
def : SysReg<"vxsat", 0x009>;
|
||||
def : SysReg<"vxrm", 0x00A>;
|
||||
def : SysReg<"vcsr", 0x00F>;
|
||||
def : SysReg<"vl", 0xC20>;
|
||||
def SysRegVL : SysReg<"vl", 0xC20>;
|
||||
def : SysReg<"vtype", 0xC21>;
|
||||
def SysRegVLENB: SysReg<"vlenb", 0xC22>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user