[clang] [RFC] Add clang atomic control options and pragmas (PR #102569)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 00:29:38 PDT 2024


================
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+// RUN: %clang_cc1 -ast-dump -fcuda-is-device %s | FileCheck %s
+// RUN: %clang_cc1 -ast-dump -fcuda-is-device %s \
+// RUN:   -fatomic=no_fine_grained_memory:off,no_remote_memory:on,ignore_denormal_mode:on \
+// RUN:   | FileCheck %s
+
+#include "Inputs/cuda.h"
+
+// CHECK-LABEL: FunctionDecl {{.*}} test_default
+// CHECK: | |-CompoundStmt
+// CHECK-NOT: AtomicNoRemoteMemory
+// CHECK-NOT: AtomicNoFineGrainedMemory
+// CHECK-NOT: AtomicIgnoreDenormalMode
+__device__ __host__ void test_default(float *a) {
+  __scoped_atomic_fetch_add(a, 1, __ATOMIC_RELAXED, __MEMORY_SCOPE_SYSTEM);
+}
+
+// CHECK-LABEL: FunctionDecl {{.*}} test_one
+// CHECK: | |-CompoundStmt {{.*}} AtomicNoRemoteMemory=1
+// CHECK-NOT: AtomicNoFineGrainedMemory
----------------
arsenm wrote:

can you use positive checks for this 

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


More information about the cfe-commits mailing list