Author: Wenju He Date: 2025-04-14T10:27:48+01:00 New Revision: cbda72a5474112e6bc62d5c5978ada7581e80dad
URL: https://github.com/llvm/llvm-project/commit/cbda72a5474112e6bc62d5c5978ada7581e80dad DIFF: https://github.com/llvm/llvm-project/commit/cbda72a5474112e6bc62d5c5978ada7581e80dad.diff LOG: [NFC][libclc] Merge atomic extension built-ins with identical name into a single file (#134489) llvm-diff shows there is no change to amdgcn--amdhsa.bc. Similar to how cl_khr_fp64 and cl_khr_fp16 implementations are put in a same file for math built-ins, this PR do the same to atom_* built-ins. The main motivation is to prevent that two files with same base name implementats different built-ins. In a follow-up PR, I'd like to relax libclc_configure_lib_source to only compare filename instead of path for overriding, since in our downstream the same category of built-ins, e.g. math, are organized in several different folders. Added: libclc/generic/include/clc/atomic/atom_add.h libclc/generic/include/clc/atomic/atom_and.h libclc/generic/include/clc/atomic/atom_cmpxchg.h libclc/generic/include/clc/atomic/atom_dec.h libclc/generic/include/clc/atomic/atom_decl_int32.inc libclc/generic/include/clc/atomic/atom_decl_int64.inc libclc/generic/include/clc/atomic/atom_inc.h libclc/generic/include/clc/atomic/atom_max.h libclc/generic/include/clc/atomic/atom_min.h libclc/generic/include/clc/atomic/atom_or.h libclc/generic/include/clc/atomic/atom_sub.h libclc/generic/include/clc/atomic/atom_xchg.h libclc/generic/include/clc/atomic/atom_xor.h libclc/generic/lib/atomic/atom_add.cl libclc/generic/lib/atomic/atom_and.cl libclc/generic/lib/atomic/atom_cmpxchg.cl libclc/generic/lib/atomic/atom_dec.cl libclc/generic/lib/atomic/atom_inc.cl libclc/generic/lib/atomic/atom_int32_binary.inc libclc/generic/lib/atomic/atom_max.cl libclc/generic/lib/atomic/atom_min.cl libclc/generic/lib/atomic/atom_or.cl libclc/generic/lib/atomic/atom_sub.cl libclc/generic/lib/atomic/atom_xchg.cl libclc/generic/lib/atomic/atom_xor.cl Modified: libclc/generic/include/clc/clc.h libclc/generic/lib/SOURCES Removed: libclc/generic/include/clc/atom_decl_int32.inc libclc/generic/include/clc/atom_decl_int64.inc libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h libclc/generic/lib/atom_int32_binary.inc libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_add.cl libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_sub.cl libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_xchg.cl libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_max.cl libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_min.cl libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl libclc/generic/lib/cl_khr_int64_extended_atomics/atom_and.cl libclc/generic/lib/cl_khr_int64_extended_atomics/atom_max.cl libclc/generic/lib/cl_khr_int64_extended_atomics/atom_min.cl libclc/generic/lib/cl_khr_int64_extended_atomics/atom_or.cl libclc/generic/lib/cl_khr_int64_extended_atomics/atom_xor.cl libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_xchg.cl libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_max.cl libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_min.cl libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl ################################################################################ diff --git a/libclc/generic/include/clc/atomic/atom_add.h b/libclc/generic/include/clc/atomic/atom_add.h new file mode 100644 index 0000000000000..b6eff1dea241a --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_add.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_base_atomics +#define __CLC_FUNCTION atom_add +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +#define __CLC_FUNCTION atom_add +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics +#define __CLC_FUNCTION atom_add +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/include/clc/atomic/atom_and.h b/libclc/generic/include/clc/atomic/atom_and.h new file mode 100644 index 0000000000000..96c4ebb126daa --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_and.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_FUNCTION atom_and +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_FUNCTION atom_and +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics +#define __CLC_FUNCTION atom_and +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/include/clc/atomic/atom_cmpxchg.h b/libclc/generic/include/clc/atomic/atom_cmpxchg.h new file mode 100644 index 0000000000000..92d922b0d2766 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_cmpxchg.h @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +#ifdef 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); +#endif // cl_khr_global_int32_base_atomics + +#ifdef 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); +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics +_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile global long *p, long cmp, + long val); +_CLC_OVERLOAD _CLC_DECL unsigned long +atom_cmpxchg(volatile global unsigned long *p, unsigned long cmp, + unsigned long val); +_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile local long *p, long cmp, + long val); +_CLC_OVERLOAD _CLC_DECL unsigned long +atom_cmpxchg(volatile local unsigned long *p, unsigned long cmp, + unsigned long val); +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/include/clc/atomic/atom_dec.h b/libclc/generic/include/clc/atomic/atom_dec.h new file mode 100644 index 0000000000000..afb829bb83159 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_dec.h @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +#ifdef cl_khr_global_int32_base_atomics +_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile global int *p); +_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile global unsigned int *p); +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile local int *p); +_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile local unsigned int *p); +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics +_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile global long *p); +_CLC_OVERLOAD _CLC_DECL unsigned long +atom_dec(volatile global unsigned long *p); +_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile local long *p); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile local unsigned long *p); +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/include/clc/atom_decl_int32.inc b/libclc/generic/include/clc/atomic/atom_decl_int32.inc similarity index 73% rename from libclc/generic/include/clc/atom_decl_int32.inc rename to libclc/generic/include/clc/atomic/atom_decl_int32.inc index 6b666c58e99be..866d8903db816 100644 --- a/libclc/generic/include/clc/atom_decl_int32.inc +++ b/libclc/generic/include/clc/atomic/atom_decl_int32.inc @@ -6,8 +6,11 @@ // //===----------------------------------------------------------------------===// -#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \ - _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE); +#include <clc/clcfunc.h> +#include <clc/clctypes.h> + +#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \ + _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE); __CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, int) __CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, uint) diff --git a/libclc/generic/include/clc/atom_decl_int64.inc b/libclc/generic/include/clc/atomic/atom_decl_int64.inc similarity index 74% rename from libclc/generic/include/clc/atom_decl_int64.inc rename to libclc/generic/include/clc/atomic/atom_decl_int64.inc index f015cda424970..146de3412fc2e 100644 --- a/libclc/generic/include/clc/atom_decl_int64.inc +++ b/libclc/generic/include/clc/atomic/atom_decl_int64.inc @@ -6,8 +6,11 @@ // //===----------------------------------------------------------------------===// -#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \ - _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE); +#include <clc/clcfunc.h> +#include <clc/clctypes.h> + +#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \ + _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE); __CLC_DECLARE_ATOM(local, long) __CLC_DECLARE_ATOM(local, ulong) diff --git a/libclc/generic/include/clc/atomic/atom_inc.h b/libclc/generic/include/clc/atomic/atom_inc.h new file mode 100644 index 0000000000000..227538b153ab5 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_inc.h @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +#ifdef cl_khr_global_int32_base_atomics +_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile global int *p); +_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile global unsigned int *p); +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile local int *p); +_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile local unsigned int *p); +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics +_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile global long *p); +_CLC_OVERLOAD _CLC_DECL unsigned long +atom_inc(volatile global unsigned long *p); +_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile local long *p); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile local unsigned long *p); +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/include/clc/atomic/atom_max.h b/libclc/generic/include/clc/atomic/atom_max.h new file mode 100644 index 0000000000000..8cb601be5d6ea --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_max.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_FUNCTION atom_max +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_FUNCTION atom_max +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics +#define __CLC_FUNCTION atom_max +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/include/clc/atomic/atom_min.h b/libclc/generic/include/clc/atomic/atom_min.h new file mode 100644 index 0000000000000..67853c999b2e4 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_min.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_FUNCTION atom_min +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_FUNCTION atom_min +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics +#define __CLC_FUNCTION atom_min +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/include/clc/atomic/atom_or.h b/libclc/generic/include/clc/atomic/atom_or.h new file mode 100644 index 0000000000000..7930ab0c5692e --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_or.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_FUNCTION atom_or +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_FUNCTION atom_or +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics +#define __CLC_FUNCTION atom_or +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/include/clc/atomic/atom_sub.h b/libclc/generic/include/clc/atomic/atom_sub.h new file mode 100644 index 0000000000000..11eb25524c211 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_sub.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_base_atomics +#define __CLC_FUNCTION atom_sub +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +#define __CLC_FUNCTION atom_sub +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics +#define __CLC_FUNCTION atom_sub +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/include/clc/atomic/atom_xchg.h b/libclc/generic/include/clc/atomic/atom_xchg.h new file mode 100644 index 0000000000000..4a46536c24512 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_xchg.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_base_atomics +#define __CLC_FUNCTION atom_xchg +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +#define __CLC_FUNCTION atom_xchg +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics +#define __CLC_FUNCTION atom_xchg +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/include/clc/atomic/atom_xor.h b/libclc/generic/include/clc/atomic/atom_xor.h new file mode 100644 index 0000000000000..ad8ae554e15a2 --- /dev/null +++ b/libclc/generic/include/clc/atomic/atom_xor.h @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_FUNCTION atom_xor +#define __CLC_ADDRESS_SPACE global +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_FUNCTION atom_xor +#define __CLC_ADDRESS_SPACE local +#include <clc/atomic/atom_decl_int32.inc> +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics +#define __CLC_FUNCTION atom_xor +#include <clc/atomic/atom_decl_int64.inc> +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h b/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h deleted file mode 100644 index db6c09f563a38..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_add -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h b/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h deleted file mode 100644 index b8b68aff758bb..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_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); diff --git a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h b/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h deleted file mode 100644 index f0576422f1ed6..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile global int *p); -_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile global unsigned int *p); diff --git a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h b/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h deleted file mode 100644 index f68758fa1561d..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile global int *p); -_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile global unsigned int *p); diff --git a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h b/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h deleted file mode 100644 index 81dab4926eaf1..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_sub -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h b/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h deleted file mode 100644 index 8964b9c151513..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_xchg -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h deleted file mode 100644 index 0d8c316d8f7fd..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_and -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h deleted file mode 100644 index f3af2eabd86e3..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_max -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h deleted file mode 100644 index e8418e161abfe..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_min -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h deleted file mode 100644 index 34771728779c8..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_or -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h deleted file mode 100644 index 17ca2e9f37c64..0000000000000 --- a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_xor -#define __CLC_ADDRESS_SPACE global -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h deleted file mode 100644 index 427006d0d57c6..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_add -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h deleted file mode 100644 index 3e5317c22b8a1..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile global long *p, long cmp, long val); -_CLC_OVERLOAD _CLC_DECL unsigned long atom_cmpxchg(volatile global unsigned long *p, unsigned long cmp, unsigned long val); -_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile local long *p, long cmp, long val); -_CLC_OVERLOAD _CLC_DECL unsigned long atom_cmpxchg(volatile local unsigned long *p, unsigned long cmp, unsigned long val); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h deleted file mode 100644 index 4bf4e4eae5866..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile global long *p); -_CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile global unsigned long *p); -_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile local long *p); -_CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile local unsigned long *p); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h deleted file mode 100644 index d7a034640d420..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile global long *p); -_CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile global unsigned long *p); -_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile local long *p); -_CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile local unsigned long *p); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h deleted file mode 100644 index 064801815dc95..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_sub -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h deleted file mode 100644 index 4d4f3e3bcb774..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_xchg -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h b/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h deleted file mode 100644 index 5077e626488b9..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_and -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h b/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h deleted file mode 100644 index 5d338f82f7522..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_max -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h b/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h deleted file mode 100644 index e3baeaf205266..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_min -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h b/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h deleted file mode 100644 index 14d244ea55e3f..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_or -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h b/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h deleted file mode 100644 index 0506fd4527e37..0000000000000 --- a/libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_xor -#include <clc/atom_decl_int64.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h b/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h deleted file mode 100644 index f681615c02ce9..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_add -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h b/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h deleted file mode 100644 index 3b339e4a8d85f..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_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); diff --git a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h b/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h deleted file mode 100644 index 89a6b3528f2b3..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile local int *p); -_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile local unsigned int *p); diff --git a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h b/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h deleted file mode 100644 index 1af31cea1521d..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h +++ /dev/null @@ -1,10 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile local int *p); -_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile local unsigned int *p); diff --git a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h b/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h deleted file mode 100644 index ef74a3def7abd..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_sub -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h b/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h deleted file mode 100644 index 8a7662ffc9dbf..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_xchg -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h deleted file mode 100644 index a6aa525df2bde..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_and -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h deleted file mode 100644 index 6b0570a765b11..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_max -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h deleted file mode 100644 index 4286dfb98ffc4..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_min -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h deleted file mode 100644 index 7352fa9b9ef40..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_or -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h deleted file mode 100644 index 8696e2b3752b6..0000000000000 --- a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_FUNCTION atom_xor -#define __CLC_ADDRESS_SPACE local -#include <clc/atom_decl_int32.inc> diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 51a4f3413e725..8223b529f09f9 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -239,54 +239,22 @@ #include <clc/atomic/atomic_xchg.h> #include <clc/atomic/atomic_xor.h> -/* cl_khr_global_int32_base_atomics Extension Functions */ -#include <clc/cl_khr_global_int32_base_atomics/atom_add.h> -#include <clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h> -#include <clc/cl_khr_global_int32_base_atomics/atom_dec.h> -#include <clc/cl_khr_global_int32_base_atomics/atom_inc.h> -#include <clc/cl_khr_global_int32_base_atomics/atom_sub.h> -#include <clc/cl_khr_global_int32_base_atomics/atom_xchg.h> - -/* cl_khr_global_int32_extended_atomics Extension Functions */ -#include <clc/cl_khr_global_int32_extended_atomics/atom_and.h> -#include <clc/cl_khr_global_int32_extended_atomics/atom_max.h> -#include <clc/cl_khr_global_int32_extended_atomics/atom_min.h> -#include <clc/cl_khr_global_int32_extended_atomics/atom_or.h> -#include <clc/cl_khr_global_int32_extended_atomics/atom_xor.h> - -/* cl_khr_local_int32_base_atomics Extension Functions */ -#include <clc/cl_khr_local_int32_base_atomics/atom_add.h> -#include <clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h> -#include <clc/cl_khr_local_int32_base_atomics/atom_dec.h> -#include <clc/cl_khr_local_int32_base_atomics/atom_inc.h> -#include <clc/cl_khr_local_int32_base_atomics/atom_sub.h> -#include <clc/cl_khr_local_int32_base_atomics/atom_xchg.h> - -/* cl_khr_local_int32_extended_atomics Extension Functions */ -#include <clc/cl_khr_local_int32_extended_atomics/atom_and.h> -#include <clc/cl_khr_local_int32_extended_atomics/atom_max.h> -#include <clc/cl_khr_local_int32_extended_atomics/atom_min.h> -#include <clc/cl_khr_local_int32_extended_atomics/atom_or.h> -#include <clc/cl_khr_local_int32_extended_atomics/atom_xor.h> - -/* cl_khr_int64_base_atomics Extension Functions */ -#ifdef cl_khr_int64_base_atomics -#include <clc/cl_khr_int64_base_atomics/atom_add.h> -#include <clc/cl_khr_int64_base_atomics/atom_cmpxchg.h> -#include <clc/cl_khr_int64_base_atomics/atom_dec.h> -#include <clc/cl_khr_int64_base_atomics/atom_inc.h> -#include <clc/cl_khr_int64_base_atomics/atom_sub.h> -#include <clc/cl_khr_int64_base_atomics/atom_xchg.h> -#endif - -/* cl_khr_int64_extended_atomics Extension Functions */ -#ifdef cl_khr_int64_base_atomics -#include <clc/cl_khr_int64_extended_atomics/atom_and.h> -#include <clc/cl_khr_int64_extended_atomics/atom_max.h> -#include <clc/cl_khr_int64_extended_atomics/atom_min.h> -#include <clc/cl_khr_int64_extended_atomics/atom_or.h> -#include <clc/cl_khr_int64_extended_atomics/atom_xor.h> -#endif +/* cl_khr_global_int32_base_atomics, cl_khr_local_int32_base_atomics and + * cl_khr_int64_base_atomics Extension Functions */ +#include <clc/atomic/atom_add.h> +#include <clc/atomic/atom_cmpxchg.h> +#include <clc/atomic/atom_dec.h> +#include <clc/atomic/atom_inc.h> +#include <clc/atomic/atom_sub.h> +#include <clc/atomic/atom_xchg.h> + +/* cl_khr_global_int32_extended_atomics, cl_khr_local_int32_extended_atomics and + * cl_khr_int64_extended_atomics Extension Functions */ +#include <clc/atomic/atom_and.h> +#include <clc/atomic/atom_max.h> +#include <clc/atomic/atom_min.h> +#include <clc/atomic/atom_or.h> +#include <clc/atomic/atom_xor.h> /* 6.12.12 Miscellaneous Vector Functions */ #include <clc/misc/shuffle.h> diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index 5f473ff8b9424..1340e08453acf 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -4,6 +4,17 @@ async/async_work_group_copy.cl async/async_work_group_strided_copy.cl async/prefetch.cl async/wait_group_events.cl +atomic/atom_add.cl +atomic/atom_and.cl +atomic/atom_cmpxchg.cl +atomic/atom_dec.cl +atomic/atom_inc.cl +atomic/atom_max.cl +atomic/atom_min.cl +atomic/atom_or.cl +atomic/atom_sub.cl +atomic/atom_xchg.cl +atomic/atom_xor.cl atomic/atomic_add.cl atomic/atomic_and.cl atomic/atomic_cmpxchg.cl @@ -13,41 +24,8 @@ atomic/atomic_max.cl atomic/atomic_min.cl atomic/atomic_or.cl atomic/atomic_sub.cl -atomic/atomic_xor.cl atomic/atomic_xchg.cl -cl_khr_global_int32_base_atomics/atom_add.cl -cl_khr_global_int32_base_atomics/atom_cmpxchg.cl -cl_khr_global_int32_base_atomics/atom_dec.cl -cl_khr_global_int32_base_atomics/atom_inc.cl -cl_khr_global_int32_base_atomics/atom_sub.cl -cl_khr_global_int32_base_atomics/atom_xchg.cl -cl_khr_global_int32_extended_atomics/atom_and.cl -cl_khr_global_int32_extended_atomics/atom_max.cl -cl_khr_global_int32_extended_atomics/atom_min.cl -cl_khr_global_int32_extended_atomics/atom_or.cl -cl_khr_global_int32_extended_atomics/atom_xor.cl -cl_khr_local_int32_base_atomics/atom_add.cl -cl_khr_local_int32_base_atomics/atom_cmpxchg.cl -cl_khr_local_int32_base_atomics/atom_dec.cl -cl_khr_local_int32_base_atomics/atom_inc.cl -cl_khr_local_int32_base_atomics/atom_sub.cl -cl_khr_local_int32_base_atomics/atom_xchg.cl -cl_khr_local_int32_extended_atomics/atom_and.cl -cl_khr_local_int32_extended_atomics/atom_max.cl -cl_khr_local_int32_extended_atomics/atom_min.cl -cl_khr_local_int32_extended_atomics/atom_or.cl -cl_khr_local_int32_extended_atomics/atom_xor.cl -cl_khr_int64_base_atomics/atom_add.cl -cl_khr_int64_base_atomics/atom_cmpxchg.cl -cl_khr_int64_base_atomics/atom_dec.cl -cl_khr_int64_base_atomics/atom_inc.cl -cl_khr_int64_base_atomics/atom_sub.cl -cl_khr_int64_base_atomics/atom_xchg.cl -cl_khr_int64_extended_atomics/atom_and.cl -cl_khr_int64_extended_atomics/atom_max.cl -cl_khr_int64_extended_atomics/atom_min.cl -cl_khr_int64_extended_atomics/atom_or.cl -cl_khr_int64_extended_atomics/atom_xor.cl +atomic/atomic_xor.cl common/degrees.cl common/mix.cl common/radians.cl diff --git a/libclc/generic/lib/atomic/atom_add.cl b/libclc/generic/lib/atomic/atom_add.cl new file mode 100644 index 0000000000000..282b24dcbd1c9 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_add.cl @@ -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/atomic/atom_add.h> + +#ifdef cl_khr_global_int32_base_atomics +#define __CLC_ATOMIC_OP add +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +#define __CLC_ATOMIC_OP add +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_add_8(p, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/lib/atomic/atom_and.cl b/libclc/generic/lib/atomic/atom_and.cl new file mode 100644 index 0000000000000..2c95d2a7780c3 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_and.cl @@ -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/atomic/atom_and.h> + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_ATOMIC_OP and +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_ATOMIC_OP and +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_and_8(p, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/lib/atomic/atom_cmpxchg.cl b/libclc/generic/lib/atomic/atom_cmpxchg.cl new file mode 100644 index 0000000000000..e29707af84cb3 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_cmpxchg.cl @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// 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/atomic/atom_cmpxchg.h> +#include <clc/atomic/atomic_cmpxchg.h> + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, \ + TYPE val) { \ + return atomic_cmpxchg(p, cmp, val); \ + } + +#ifdef cl_khr_global_int32_base_atomics +IMPL(global, int) +IMPL(global, unsigned int) +#endif // cl_khr_global_int32_base_atomics +#ifdef cl_khr_local_int32_base_atomics +IMPL(local, int) +IMPL(local, unsigned int) +#endif // cl_khr_local_int32_base_atomics + +#undef IMPL + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, \ + TYPE val) { \ + return __sync_val_compare_and_swap_8(p, cmp, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/lib/atomic/atom_dec.cl b/libclc/generic/lib/atomic/atom_dec.cl new file mode 100644 index 0000000000000..8fb5495397d69 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_dec.cl @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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/atomic/atom_dec.h> +#include <clc/atomic/atom_sub.h> +#include <clc/atomic/atomic_dec.h> + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \ + return atomic_dec(p); \ + } + +#ifdef cl_khr_global_int32_base_atomics +IMPL(global, int) +IMPL(global, unsigned int) +#endif // cl_khr_global_int32_base_atomics +#ifdef cl_khr_local_int32_base_atomics +IMPL(local, int) +IMPL(local, unsigned int) +#endif // cl_khr_local_int32_base_atomics + +#undef IMPL + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \ + return atom_sub(p, (TYPE)1); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/lib/atomic/atom_inc.cl b/libclc/generic/lib/atomic/atom_inc.cl new file mode 100644 index 0000000000000..c74df54eb4893 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_inc.cl @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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/atomic/atom_add.h> +#include <clc/atomic/atom_inc.h> +#include <clc/atomic/atomic_inc.h> + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \ + return atomic_inc(p); \ + } + +#ifdef cl_khr_global_int32_base_atomics +IMPL(global, int) +IMPL(global, unsigned int) +#endif // cl_khr_global_int32_base_atomics +#ifdef cl_khr_local_int32_base_atomics +IMPL(local, int) +IMPL(local, unsigned int) +#endif // cl_khr_local_int32_base_atomics + +#undef IMPL + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \ + return atom_add(p, (TYPE)1); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/lib/atom_int32_binary.inc b/libclc/generic/lib/atomic/atom_int32_binary.inc similarity index 64% rename from libclc/generic/lib/atom_int32_binary.inc rename to libclc/generic/lib/atomic/atom_int32_binary.inc index dac9d19842dcb..81e6a8ebc7c8a 100644 --- a/libclc/generic/lib/atom_int32_binary.inc +++ b/libclc/generic/lib/atomic/atom_int32_binary.inc @@ -9,10 +9,11 @@ #include <clc/clc.h> #include <clc/utils.h> -#define __CLC_ATOM_IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE __CLC_XCONCAT(atom_, __CLC_ATOMIC_OP) (volatile AS TYPE *p, TYPE val) { \ - return __CLC_XCONCAT(atomic_, __CLC_ATOMIC_OP) (p, val); \ -} +#define __CLC_ATOM_IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE __CLC_XCONCAT(atom_, __CLC_ATOMIC_OP)( \ + volatile AS TYPE * p, TYPE val) { \ + return __CLC_XCONCAT(atomic_, __CLC_ATOMIC_OP)(p, val); \ + } __CLC_ATOM_IMPL(__CLC_ATOMIC_ADDRESS_SPACE, int) __CLC_ATOM_IMPL(__CLC_ATOMIC_ADDRESS_SPACE, uint) diff --git a/libclc/generic/lib/atomic/atom_max.cl b/libclc/generic/lib/atomic/atom_max.cl new file mode 100644 index 0000000000000..9427732fe7a4d --- /dev/null +++ b/libclc/generic/lib/atomic/atom_max.cl @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// 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/atomic/atom_max.h> + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_ATOMIC_OP max +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_ATOMIC_OP max +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics + +unsigned long __clc__sync_fetch_and_max_local_8(volatile local long *, long); +unsigned long __clc__sync_fetch_and_max_global_8(volatile global long *, long); +unsigned long __clc__sync_fetch_and_umax_local_8(volatile local unsigned long *, + unsigned long); +unsigned long +__clc__sync_fetch_and_umax_global_8(volatile global unsigned long *, + unsigned long); + +#define IMPL(AS, TYPE, OP) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_max(volatile AS TYPE *p, TYPE val) { \ + return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \ + } + +IMPL(global, long, max) +IMPL(global, unsigned long, umax) +IMPL(local, long, max) +IMPL(local, unsigned long, umax) +#undef IMPL + +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/lib/atomic/atom_min.cl b/libclc/generic/lib/atomic/atom_min.cl new file mode 100644 index 0000000000000..881e832932910 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_min.cl @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// 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/atomic/atom_min.h> + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_ATOMIC_OP min +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_ATOMIC_OP min +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics + +unsigned long __clc__sync_fetch_and_min_local_8(volatile local long *, long); +unsigned long __clc__sync_fetch_and_min_global_8(volatile global long *, long); +unsigned long __clc__sync_fetch_and_umin_local_8(volatile local unsigned long *, + unsigned long); +unsigned long +__clc__sync_fetch_and_umin_global_8(volatile global unsigned long *, + unsigned long); + +#define IMPL(AS, TYPE, OP) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_min(volatile AS TYPE *p, TYPE val) { \ + return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \ + } + +IMPL(global, long, min) +IMPL(global, unsigned long, umin) +IMPL(local, long, min) +IMPL(local, unsigned long, umin) +#undef IMPL + +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/lib/atomic/atom_or.cl b/libclc/generic/lib/atomic/atom_or.cl new file mode 100644 index 0000000000000..a9f9bb782fb2f --- /dev/null +++ b/libclc/generic/lib/atomic/atom_or.cl @@ -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/atomic/atom_or.h> + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_ATOMIC_OP or +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_ATOMIC_OP or +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_or(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_or_8(p, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/lib/atomic/atom_sub.cl b/libclc/generic/lib/atomic/atom_sub.cl new file mode 100644 index 0000000000000..1951f985688b2 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_sub.cl @@ -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/atomic/atom_sub.h> + +#ifdef cl_khr_global_int32_base_atomics +#define __CLC_ATOMIC_OP sub +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +#define __CLC_ATOMIC_OP sub +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_sub(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_sub_8(p, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/lib/atomic/atom_xchg.cl b/libclc/generic/lib/atomic/atom_xchg.cl new file mode 100644 index 0000000000000..6e9ef796d9c0d --- /dev/null +++ b/libclc/generic/lib/atomic/atom_xchg.cl @@ -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/atomic/atom_xchg.h> + +#ifdef cl_khr_global_int32_base_atomics +#define __CLC_ATOMIC_OP xchg +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_base_atomics + +#ifdef cl_khr_local_int32_base_atomics +#define __CLC_ATOMIC_OP xchg +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_base_atomics + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(volatile AS TYPE *p, TYPE val) { \ + return __sync_swap_8(p, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_base_atomics diff --git a/libclc/generic/lib/atomic/atom_xor.cl b/libclc/generic/lib/atomic/atom_xor.cl new file mode 100644 index 0000000000000..bfa978d4b9a12 --- /dev/null +++ b/libclc/generic/lib/atomic/atom_xor.cl @@ -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/atomic/atom_xor.h> + +#ifdef cl_khr_global_int32_extended_atomics +#define __CLC_ATOMIC_OP xor +#define __CLC_ATOMIC_ADDRESS_SPACE global +#include "atom_int32_binary.inc" +#endif // cl_khr_global_int32_extended_atomics + +#ifdef cl_khr_local_int32_extended_atomics +#define __CLC_ATOMIC_OP xor +#define __CLC_ATOMIC_ADDRESS_SPACE local +#include "atom_int32_binary.inc" +#endif // cl_khr_local_int32_extended_atomics + +#ifdef cl_khr_int64_extended_atomics + +#define IMPL(AS, TYPE) \ + _CLC_OVERLOAD _CLC_DEF TYPE atom_xor(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_xor_8(p, val); \ + } + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif // cl_khr_int64_extended_atomics diff --git a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_add.cl b/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_add.cl deleted file mode 100644 index 6c6c919892aa9..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_add.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP add -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl b/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl deleted file mode 100644 index eb78b878109b6..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#define IMPL(TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile global TYPE *p, TYPE cmp, TYPE val) { \ - return atomic_cmpxchg(p, cmp, val); \ -} - -IMPL(int) -IMPL(unsigned int) diff --git a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl b/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl deleted file mode 100644 index 82b77ff31ce87..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#define IMPL(TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile global TYPE *p) { \ - return atomic_dec(p); \ -} - -IMPL(int) -IMPL(unsigned int) diff --git a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl b/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl deleted file mode 100644 index f2147ccaf8d65..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#define IMPL(TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile global TYPE *p) { \ - return atomic_inc(p); \ -} - -IMPL(int) -IMPL(unsigned int) diff --git a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_sub.cl b/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_sub.cl deleted file mode 100644 index 521d3cc633b30..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_sub.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP sub -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_xchg.cl b/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_xchg.cl deleted file mode 100644 index 5e68b489171fe..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_xchg.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP xchg -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl deleted file mode 100644 index fbfba0b1b698f..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP and -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_max.cl b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_max.cl deleted file mode 100644 index 78f98d7c19146..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_max.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP max -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_min.cl b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_min.cl deleted file mode 100644 index f031585cc246a..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_min.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP min -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl deleted file mode 100644 index 95aa2c66a3276..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP or -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl deleted file mode 100644 index 0613f08654940..0000000000000 --- a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP xor -#define __CLC_ATOMIC_ADDRESS_SPACE global -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl deleted file mode 100644 index e06c21d4acb6c..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_base_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \ - return __sync_fetch_and_add_8(p, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl deleted file mode 100644 index 21260103a673b..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_base_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, TYPE val) { \ - return __sync_val_compare_and_swap_8(p, cmp, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl deleted file mode 100644 index a594f570ca851..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_base_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \ - return atom_sub(p, (TYPE)1); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl deleted file mode 100644 index 2aa2f9d790770..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_base_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \ - return atom_add(p, (TYPE)1); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl deleted file mode 100644 index a496c42105065..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_base_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(volatile AS TYPE *p, TYPE val) { \ - return __sync_fetch_and_sub_8(p, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl deleted file mode 100644 index 0bacfc863f5a4..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_base_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(volatile AS TYPE *p, TYPE val) { \ - return __sync_swap_8(p, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_and.cl b/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_and.cl deleted file mode 100644 index 4c5dff5608d2d..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_and.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_extended_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \ - return __sync_fetch_and_and_8(p, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_max.cl b/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_max.cl deleted file mode 100644 index 5440f0d89165d..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_max.cl +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_extended_atomics - -unsigned long __clc__sync_fetch_and_max_local_8(volatile local long *, long); -unsigned long __clc__sync_fetch_and_max_global_8(volatile global long *, long); -unsigned long __clc__sync_fetch_and_umax_local_8(volatile local unsigned long *, unsigned long); -unsigned long __clc__sync_fetch_and_umax_global_8(volatile global unsigned long *, unsigned long); - -#define IMPL(AS, TYPE, OP) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_max(volatile AS TYPE *p, TYPE val) { \ - return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \ -} - -IMPL(global, long, max) -IMPL(global, unsigned long, umax) -IMPL(local, long, max) -IMPL(local, unsigned long, umax) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_min.cl b/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_min.cl deleted file mode 100644 index 27f4112b9d994..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_min.cl +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_extended_atomics - -unsigned long __clc__sync_fetch_and_min_local_8(volatile local long *, long); -unsigned long __clc__sync_fetch_and_min_global_8(volatile global long *, long); -unsigned long __clc__sync_fetch_and_umin_local_8(volatile local unsigned long *, unsigned long); -unsigned long __clc__sync_fetch_and_umin_global_8(volatile global unsigned long *, unsigned long); - -#define IMPL(AS, TYPE, OP) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_min(volatile AS TYPE *p, TYPE val) { \ - return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \ -} - -IMPL(global, long, min) -IMPL(global, unsigned long, umin) -IMPL(local, long, min) -IMPL(local, unsigned long, umin) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_or.cl b/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_or.cl deleted file mode 100644 index b822a77172802..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_or.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_extended_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_or(volatile AS TYPE *p, TYPE val) { \ - return __sync_fetch_and_or_8(p, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_xor.cl b/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_xor.cl deleted file mode 100644 index f1dd28d796d0a..0000000000000 --- a/libclc/generic/lib/cl_khr_int64_extended_atomics/atom_xor.cl +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#ifdef cl_khr_int64_extended_atomics - -#define IMPL(AS, TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_xor(volatile AS TYPE *p, TYPE val) { \ - return __sync_fetch_and_xor_8(p, val); \ -} - -IMPL(global, long) -IMPL(global, unsigned long) -IMPL(local, long) -IMPL(local, unsigned long) -#undef IMPL - -#endif diff --git a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl b/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl deleted file mode 100644 index c561cc3f839d9..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP add -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl b/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl deleted file mode 100644 index efa997e5b7021..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#define IMPL(TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile local TYPE *p, TYPE cmp, TYPE val) { \ - return atomic_cmpxchg(p, cmp, val); \ -} - -IMPL(int) -IMPL(unsigned int) diff --git a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl b/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl deleted file mode 100644 index f3b30554ea9c8..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#define IMPL(TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile local TYPE *p) { \ - return atomic_dec(p); \ -} - -IMPL(int) -IMPL(unsigned int) diff --git a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl b/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl deleted file mode 100644 index 9660f79046b38..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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/clc.h> - -#define IMPL(TYPE) \ -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile local TYPE *p) { \ - return atomic_inc(p); \ -} - -IMPL(int) -IMPL(unsigned int) diff --git a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl b/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl deleted file mode 100644 index 44a8703aaa6cb..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP sub -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_xchg.cl b/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_xchg.cl deleted file mode 100644 index ae6c82036b7a7..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_xchg.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP xchg -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl deleted file mode 100644 index c3cfd460338a8..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP and -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_max.cl b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_max.cl deleted file mode 100644 index 80dabbb239a77..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_max.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP max -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_min.cl b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_min.cl deleted file mode 100644 index 895dc8a256796..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_min.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP min -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl deleted file mode 100644 index ee02b942a3397..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP or -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" diff --git a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl deleted file mode 100644 index d169899aa0784..0000000000000 --- a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#define __CLC_ATOMIC_OP xor -#define __CLC_ATOMIC_ADDRESS_SPACE local -#include "../atom_int32_binary.inc" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits