[Mlir-commits] [mlir] [mlir][SPIRV] update SPIRV Atomic Ops to assemblyFormat (PR #76323)

Jakub Kuderski llvmlistbot at llvm.org
Thu Dec 28 13:05:55 PST 2023


================
@@ -139,29 +153,35 @@ def SPIRV_AtomicCompareExchangeOp : SPIRV_Op<"AtomicCompareExchange", []> {
     #### Example:
 
     ```
-    %0 = spirv.AtomicCompareExchange "Workgroup" "Acquire" "None"
+    %0 = spirv.AtomicCompareExchange <Workgroup> <Acquire> <None>
                                     %pointer, %value, %comparator
                                     : !spirv.ptr<i32, WorkGroup>
     ```
   }];
 
-  let arguments = (ins
-    SPIRV_AnyPtr:$pointer,
-    SPIRV_ScopeAttr:$memory_scope,
-    SPIRV_MemorySemanticsAttr:$equal_semantics,
-    SPIRV_MemorySemanticsAttr:$unequal_semantics,
-    SPIRV_Integer:$value,
-    SPIRV_Integer:$comparator
-  );
+  let arguments = (ins SPIRV_AnyPtr
+                   : $pointer, SPIRV_ScopeAttr
+                   : $memory_scope, SPIRV_MemorySemanticsAttr
+                   : $equal_semantics, SPIRV_MemorySemanticsAttr
+                   : $unequal_semantics, SPIRV_Integer
+                   : $value, SPIRV_Integer
+                   : $comparator);
+
+  let results = (outs SPIRV_Integer : $result);
 
-  let results = (outs
-    SPIRV_Integer:$result
-  );
+  let assemblyFormat = [{
+    $memory_scope $equal_semantics $unequal_semantics operands attr-dict `:`
+    type($pointer)
----------------
kuhar wrote:

nit: missing indentation
```suggestion
      type($pointer)
```

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


More information about the Mlir-commits mailing list