Skip to content

Commit e7262c1

Browse files
authored
[RISCV] Add OperandType for sew and vecpolicy operands. (#114168)
1 parent 62ff85f commit e7262c1

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
@@ -337,7 +337,11 @@ enum OperandType : unsigned {
337337
OPERAND_RTZARG,
338338
// Condition code used by select and short forward branch pseudos.
339339
OPERAND_COND_CODE,
340-
OPERAND_LAST_RISCV_IMM = OPERAND_COND_CODE,
340+
// Vector policy operand.
341+
OPERAND_VEC_POLICY,
342+
// Vector SEW operand.
343+
OPERAND_SEW,
344+
OPERAND_LAST_RISCV_IMM = OPERAND_SEW,
341345
// Operand is either a register or uimm5, this is used by V extension pseudo
342346
// instructions to represent a value that be passed as AVL to either vsetvli
343347
// or vsetivli.

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,6 +2545,12 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
25452545
case RISCVOp::OPERAND_COND_CODE:
25462546
Ok = Imm >= 0 && Imm < RISCVCC::COND_INVALID;
25472547
break;
2548+
case RISCVOp::OPERAND_VEC_POLICY:
2549+
Ok = (Imm & (RISCVII::TAIL_AGNOSTIC | RISCVII::MASK_AGNOSTIC)) == Imm;
2550+
break;
2551+
case RISCVOp::OPERAND_SEW:
2552+
Ok = Imm == 0 || (Imm >= 3 && Imm <= 6);
2553+
break;
25482554
}
25492555
if (!Ok) {
25502556
ErrInfo = "Invalid immediate";

0 commit comments

Comments
 (0)