Skip to content
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
7 changes: 6 additions & 1 deletion llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ enum OperandType : unsigned {
OPERAND_RVKRNUM_1_10,
OPERAND_RVKRNUM_2_14,
OPERAND_SPIMM,
OPERAND_LAST_RISCV_IMM = OPERAND_SPIMM,
// Operand is a 3-bit rounding mode, '111' indicates FRM register.
// Represents 'frm' argument passing to floating-point operations.
OPERAND_FRMARG,
// Operand is a 3-bit rounding mode where only RTZ is valid.
OPERAND_RTZARG,
OPERAND_LAST_RISCV_IMM = OPERAND_RTZARG,
// Operand is either a register or uimm5, this is used by V extension pseudo
// instructions to represent a value that be passed as AVL to either vsetvli
// or vsetivli.
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2536,6 +2536,12 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
case RISCVOp::OPERAND_SPIMM:
Ok = (Imm & 0xf) == 0;
break;
case RISCVOp::OPERAND_FRMARG:
Ok = RISCVFPRndMode::isValidRoundingMode(Imm);
break;
case RISCVOp::OPERAND_RTZARG:
Ok = Imm == RISCVFPRndMode::RTZ;
break;
}
if (!Ok) {
ErrInfo = "Invalid immediate";
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfoF.td
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def frmarg : Operand<XLenVT> {
let ParserMatchClass = FRMArg;
let PrintMethod = "printFRMArg";
let DecoderMethod = "decodeFRMArg";
let OperandType = "OPERAND_FRMARG";
let OperandNamespace = "RISCVOp";
}

// Variants of the rounding mode operand that default to 'rne'. This is used
Expand All @@ -154,6 +156,8 @@ def frmarglegacy : Operand<XLenVT> {
let ParserMatchClass = FRMArgLegacy;
let PrintMethod = "printFRMArgLegacy";
let DecoderMethod = "decodeFRMArg";
let OperandType = "OPERAND_FRMARG";
let OperandNamespace = "RISCVOp";
}

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def rtzarg : Operand<XLenVT> {
let ParserMatchClass = RTZArg;
let PrintMethod = "printFRMArg";
let DecoderMethod = "decodeRTZArg";
let OperandType = "OPERAND_RTZARG";
let OperandNamespace = "RISCVOp";
}

//===----------------------------------------------------------------------===//
Expand Down
Loading