Skip to content

Commit 8f9ef4b

Browse files
authored
[RISCV] Add OPERAND_AVL to RISCVInstrInfo::verifyInstruction. (llvm#170770)
1 parent 89ae817 commit 8f9ef4b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,6 +3076,18 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
30763076
ErrInfo = "Invalid immediate";
30773077
return false;
30783078
}
3079+
} else if (OpType == RISCVOp::OPERAND_AVL) {
3080+
if (MO.isImm()) {
3081+
int64_t Imm = MO.getImm();
3082+
// VLMAX is represented as -1.
3083+
if (!isUInt<5>(Imm) && Imm != -1) {
3084+
ErrInfo = "Invalid immediate";
3085+
return false;
3086+
}
3087+
} else if (!MO.isReg()) {
3088+
ErrInfo = "Expected a register or immediate operand.";
3089+
return false;
3090+
}
30793091
}
30803092
}
30813093

0 commit comments

Comments
 (0)