[llvm] [RISCV] Add OPERAND_AVL to RISCVInstrInfo::verifyInstruction. (PR #170770)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 15:11:30 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/170770.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVInstrInfo.cpp (+12)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index a5f680c35124b..e878558f73b2c 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -3076,6 +3076,18 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
ErrInfo = "Invalid immediate";
return false;
}
+ } else if (OpType == RISCVOp::OPERAND_AVL) {
+ if (MO.isImm()) {
+ int64_t Imm = MO.getImm();
+ // VLMAX is represented as -1.
+ if (!isUInt<5>(Imm) && Imm != -1) {
+ ErrInfo = "Invalid immediate";
+ return false;
+ }
+ } else if (!MO.isReg()) {
+ ErrInfo = "Expected a register or immediate operand.";
+ return false;
+ }
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/170770
More information about the llvm-commits
mailing list