[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:03 PDT 2025


================
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <clc/clcfunc.h>
+#include <clc/clctypes.h>
+
+// cl_khr_global_int32_base_atomics
+_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile global int *p, int cmp,
+                                         int val);
+_CLC_OVERLOAD _CLC_DECL unsigned int
+atom_cmpxchg(volatile global unsigned int *p, unsigned int cmp,
+             unsigned int val);
+
+// cl_khr_local_int32_base_atomics
+_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile local int *p, int cmp,
+                                         int val);
+_CLC_OVERLOAD _CLC_DECL unsigned int
+atom_cmpxchg(volatile local unsigned int *p, unsigned int cmp,
+             unsigned int val);
+
+// cl_khr_int64_base_atomics
+_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile global long *p, long cmp,
----------------
frasercrmck wrote:

Should this not be guarded by `#if cl_khr_int64_extended_atomics`? I don't think we can have unguarded `long` types.

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


More information about the cfe-commits mailing list