Skip to content

Commit b5303f6

Browse files
committed
[RISCV] Add OperandType for sew and vecpolicy operands.
1 parent d926828 commit b5303f6

File tree

5 files changed

+96
-78
lines changed

5 files changed

+96
-78
lines changed

llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,11 @@ enum OperandType : unsigned {
335335
OPERAND_FRMARG,
336336
// Operand is a 3-bit rounding mode where only RTZ is valid.
337337
OPERAND_RTZARG,
338-
OPERAND_LAST_RISCV_IMM = OPERAND_RTZARG,
338+
// Vector policy operand.
339+
OPERAND_VECPOLICY,
340+
// Vector SEW operand.
341+
OPERAND_SEW,
342+
OPERAND_LAST_RISCV_IMM = OPERAND_SEW,
339343
// Operand is either a register or uimm5, this is used by V extension pseudo
340344
// instructions to represent a value that be passed as AVL to either vsetvli
341345
// or vsetivli.

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,6 +2542,12 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
25422542
case RISCVOp::OPERAND_RTZARG:
25432543
Ok = Imm == RISCVFPRndMode::RTZ;
25442544
break;
2545+
case RISCVOp::OPERAND_VECPOLICY:
2546+
Ok = (Imm & (RISCVII::TAIL_AGNOSTIC | RISCVII::MASK_AGNOSTIC)) == Imm;
2547+
break;
2548+
case RISCVOp::OPERAND_SEW:
2549+
Ok = Imm == 0 || (Imm >= 3 && Imm <= 6);
2550+
break;
25452551
}
25462552
if (!Ok) {
25472553
ErrInfo = "Invalid immediate";

0 commit comments

Comments
 (0)