[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 22:55:25 PST 2023


================
@@ -798,6 +798,13 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
   Builder.defineMacro("__ATOMIC_ACQ_REL", "4");
   Builder.defineMacro("__ATOMIC_SEQ_CST", "5");
 
+  // Define macros for the clang atomic scopes.
+  Builder.defineMacro("__MEMORY_SCOPE_SYSTEM", "0");
+  Builder.defineMacro("__MEMORY_SCOPE_DEVICE", "1");
+  Builder.defineMacro("__MEMORY_SCOPE_WRKGRP", "2");
+  Builder.defineMacro("__MEMORY_SCOPE_WVFRNT", "3");
+  Builder.defineMacro("__MEMORY_SCOPE_SINGLE", "4");
+
----------------
arsenm wrote:

Should the HIP flavors be defined in terms of these?

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


More information about the cfe-commits mailing list