[PATCH] D133810: [RISCV\ Verify consistency of a couple TSFlags related to vector operands

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 14:57:43 PDT 2022


reames created this revision.
reames added reviewers: craig.topper, kito-cheng, frasercrmck.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Mostly a starting point for discussion.  I think it makes sense to have verification rules for these flags; mostly to make it easier to figure out their function.  Do others agree?

If so, any other proposed rules we'd like to enforce?  I picked these two somewhat arbitrarily based on code I was looking at today.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133810

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,15 @@
     }
   }
 
+  uint64_t TSFlags = MI.getDesc().TSFlags;
+  if (RISCVII::hasVLOp(TSFlags) && !RISCVII::hasSEWOp(TSFlags)) {
+    ErrInfo = "VL operand w/o SEW operand?";
+    return false;
+  }
+  if (RISCVII::hasVecPolicyOp(TSFlags) && !RISCVII::hasVLOp(TSFlags)) {
+    ErrInfo = "policy operand w/o SEW operand?";
+    return false;
+  }
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133810.459885.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220913/22bf3873/attachment.bin>


More information about the llvm-commits mailing list