Skip to content

[RISCV] Use TImmLeaf for csr_sysreg #82463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11734,14 +11734,14 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
SDValue LoCounter, HiCounter;
MVT XLenVT = Subtarget.getXLenVT();
if (N->getOpcode() == ISD::READCYCLECOUNTER) {
LoCounter = DAG.getConstant(
LoCounter = DAG.getTargetConstant(
RISCVSysReg::lookupSysRegByName("CYCLE")->Encoding, DL, XLenVT);
HiCounter = DAG.getConstant(
HiCounter = DAG.getTargetConstant(
RISCVSysReg::lookupSysRegByName("CYCLEH")->Encoding, DL, XLenVT);
} else {
LoCounter = DAG.getConstant(
LoCounter = DAG.getTargetConstant(
RISCVSysReg::lookupSysRegByName("TIME")->Encoding, DL, XLenVT);
HiCounter = DAG.getConstant(
HiCounter = DAG.getTargetConstant(
RISCVSysReg::lookupSysRegByName("TIMEH")->Encoding, DL, XLenVT);
}
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::i32, MVT::Other);
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/RISCV/RISCVISelLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ enum NodeType : unsigned {
FMAX, FMIN,

// A read of the 64-bit counter CSR on a 32-bit target (returns (Lo, Hi)).
// It takes a chain operand.
// It takes a chain operand and another two target constant operands (the
// CSR numbers of the low and high parts of the counter).
READ_COUNTER_WIDE,

// brev8, orc.b, zip, and unzip from Zbb and Zbkb. All operands are i32 or
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def CSRSystemRegister : AsmOperandClass {
let DiagnosticType = "InvalidCSRSystemRegister";
}

def csr_sysreg : RISCVOp, ImmLeaf<XLenVT, "return isUInt<12>(Imm);"> {
def csr_sysreg : RISCVOp, TImmLeaf<XLenVT, "return isUInt<12>(Imm);"> {
let ParserMatchClass = CSRSystemRegister;
let PrintMethod = "printCSRSystemRegister";
let DecoderMethod = "decodeUImmOperand<12>";
Expand Down