39 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_dec.h>10#include <clc/opencl/atomic/atom_dec.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_dec(volatile AS TYPE *p) { \16 return __clc_atomic_dec(p, __ATOMIC_RELAXED, __MEMORY_SCOPE_DEVICE); \17 } \18 _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(AS TYPE *p) { \19 return atom_dec((volatile AS TYPE *)p); \20 }21 22#ifdef cl_khr_global_int32_base_atomics23__CLC_IMPL(global, int)24__CLC_IMPL(global, unsigned int)25#endif // cl_khr_global_int32_base_atomics26#ifdef cl_khr_local_int32_base_atomics27__CLC_IMPL(local, int)28__CLC_IMPL(local, unsigned int)29#endif // cl_khr_local_int32_base_atomics30 31#ifdef cl_khr_int64_base_atomics32 33__CLC_IMPL(global, long)34__CLC_IMPL(global, unsigned long)35__CLC_IMPL(local, long)36__CLC_IMPL(local, unsigned long)37 38#endif // cl_khr_int64_base_atomics39