[llvm] [NVPTX] Teach NVPTX about predicates (PR #67468)

Fraser Cormack via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 03:03:07 PDT 2024


================
@@ -10,24 +10,42 @@
 //  Describe NVPTX instructions format
 //
 //===----------------------------------------------------------------------===//
-
 // Vector instruction type enum
 class VecInstTypeEnum<bits<4> val> {
   bits<4> Value=val;
 }
+
 def VecNOP : VecInstTypeEnum<0>;
 
-// Generic NVPTX Format
+def pred : PredicateOperand<
+    /*ValueType*/i1,
+    /*OpTypes*/(ops Int1Regs),
+    (ops (i32 /*AlwaysVal*/zero_reg))> {
+  let PrintMethod = "printPredicateOperand";
+  let ParserMatchClass = ?;
+  let DecoderMethod = ?;
+}
+
+def switch : OperandWithDefaultOps</*ValueType*/i1, /*defaultops*/(ops (i1 0))>;
 
-class NVPTXInst<dag outs, dag ins, string asmstr, list<dag> pattern>
-  : Instruction {
+// Generic NVPTX Format
+class NVPTXInstBase <dag outs, dag Ins, string asmstr, list<dag>
+pattern, int defaultPreds = 1> : Instruction {
----------------
frasercrmck wrote:

Would `defaultPreds` ever be anything but 0 or 1?

https://github.com/llvm/llvm-project/pull/67468


More information about the llvm-commits mailing list