[PATCH] D133869: [RISCV] Verify SEW/VecPolicy immediate values
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 14:02:59 PDT 2022
reames updated this revision to Diff 460217.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133869/new/
https://reviews.llvm.org/D133869
Files:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1220,6 +1220,29 @@
}
}
+ const uint64_t TSFlags = Desc.TSFlags;
+ if (RISCVII::hasSEWOp(TSFlags)) {
+ unsigned OpIdx = RISCVII::getSEWOpNum(Desc);
+ uint64_t Log2SEW = MI.getOperand(OpIdx).getImm();
+ if (Log2SEW > 31) {
+ ErrInfo = "Unexpected SEW value";
+ return false;
+ }
+ unsigned SEW = Log2SEW ? 1 << Log2SEW : 8;
+ if (!RISCVVType::isValidSEW(SEW)) {
+ ErrInfo = "Unexpected SEW value";
+ return false;
+ }
+ }
+ if (RISCVII::hasVecPolicyOp(TSFlags)) {
+ unsigned OpIdx = RISCVII::getVecPolicyOpNum(Desc);
+ uint64_t Policy = MI.getOperand(OpIdx).getImm();
+ if (Policy > (RISCVII::TAIL_AGNOSTIC | RISCVII::MASK_AGNOSTIC)) {
+ ErrInfo = "Invalid Policy Value";
+ return false;
+ }
+ }
+
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133869.460217.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220914/3c5e6b2e/attachment.bin>
More information about the llvm-commits
mailing list