[llvm] [NVPTX] Add syncscope support for cmpxchg (PR #140812)
Akshay Deodhar via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 11 13:55:59 PDT 2025
================
@@ -41,6 +41,66 @@ def AS_match {
}];
}
+
+//===----------------------------------------------------------------------===//
+// NVPTX Scope Constants
+// These map to the Scope enum in NVPTX.h
+//===----------------------------------------------------------------------===//
+
+def Scope_thread : PatLeaf<(i32 0)>; // Thread = 0
+def Scope_cta : PatLeaf<(i32 1)>; // Block = 1
+def Scope_cluster : PatLeaf<(i32 2)>; // Cluster = 2
+def Scope_device : PatLeaf<(i32 3)>; // Device = 3
+def Scope_sys : PatLeaf<(i32 4)>; // System = 4
+
+//===----------------------------------------------------------------------===//
+// NVPTX Address Space Constants
+// These map to the AddressSpace enum in NVPTX.h
+//===----------------------------------------------------------------------===//
+
+def AddrSpace_gen : PatLeaf<(i32 0)>; // Generic = 0
+def AddrSpace_global : PatLeaf<(i32 1)>; // Global = 1
+def AddrSpace_shared : PatLeaf<(i32 3)>; // Shared = 3
+def AddrSpace_const : PatLeaf<(i32 4)>; // Const = 4
+def AddrSpace_local : PatLeaf<(i32 5)>; // Local = 5
+def AddrSpace_shared_cluster : PatLeaf<(i32 7)>; // SharedCluster = 7
+def AddrSpace_param : PatLeaf<(i32 101)>; // Param = 101
+
+//===----------------------------------------------------------------------===//
+// NVPTX Ordering Constants
+// These map to the Ordering enum in NVPTX.h
+//===----------------------------------------------------------------------===//
+
+def Ordering_not_atomic : PatLeaf<(i32 0)>; // NotAtomic = 0
+def Ordering_relaxed : PatLeaf<(i32 2)>; // Relaxed = 1
+def Ordering_acquire : PatLeaf<(i32 4)>; // Acquire = 4
+def Ordering_release : PatLeaf<(i32 5)>; // Release = 5
+def Ordering_acquire_release : PatLeaf<(i32 6)>; // AcquireRelease = 6
+def Ordering_sequentially_consistent : PatLeaf<(i32 7)>; // SequentiallyConsistent = 7
+def Ordering_volatile : PatLeaf<(i32 8)>; // Volatile = 8
+def Ordering_relaxed_mmio : PatLeaf<(i32 9)>; // RelaxedMMIO = 9
+
+multiclass nvvm_ternary_atomic_op_scoped<SDPatternOperator frag> {
----------------
akshayrdeodhar wrote:
https://github.com/llvm/llvm-project/pull/140812/commits/e007be20be079f28f2fbc1def59cd91aae0e5661
https://github.com/llvm/llvm-project/pull/140812
More information about the llvm-commits
mailing list