[libclc] [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (PR #134489)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 04:51:04 PDT 2025


================
@@ -6,7 +6,28 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <clc/clc.h>
+#include <clc/atomic/atom_cmpxchg.h>
+#include <clc/atomic/atomic_cmpxchg.h>
+
+// cl_khr_global_int32_base_atomics
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile global TYPE *p, TYPE cmp, TYPE val) { \
----------------
frasercrmck wrote:

Could we maybe hide `global` and `local` behind `IMPL(TYPE, ADDRSPACE)` and then have `IMPL(int, global)`, etc.?

Then we wouldn't need to `#undef` and re-`#def` `IMPL`.

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


More information about the cfe-commits mailing list