41 lines · plain
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include <clc/atomic/clc_atomic_fetch_and.h>10#include <clc/opencl/atomic/atom_and.h>11 12// Non-volatile overloads are for backward compatibility with OpenCL 1.0.13 14#define __CLC_IMPL(AS, TYPE) \15 _CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \16 return __clc_atomic_fetch_and(p, val, __ATOMIC_RELAXED, \17 __MEMORY_SCOPE_DEVICE); \18 } \19 _CLC_OVERLOAD _CLC_DEF TYPE atom_and(AS TYPE *p, TYPE val) { \20 return atom_and((volatile AS TYPE *)p, val); \21 }22 23#ifdef cl_khr_global_int32_extended_atomics24__CLC_IMPL(global, int)25__CLC_IMPL(global, unsigned int)26#endif // cl_khr_global_int32_extended_atomics27 28#ifdef cl_khr_local_int32_extended_atomics29__CLC_IMPL(local, int)30__CLC_IMPL(local, unsigned int)31#endif // cl_khr_local_int32_extended_atomics32 33#ifdef cl_khr_int64_extended_atomics34 35__CLC_IMPL(global, long)36__CLC_IMPL(global, unsigned long)37__CLC_IMPL(local, long)38__CLC_IMPL(local, unsigned long)39 40#endif // cl_khr_int64_extended_atomics41