brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 5b75873 Raw
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_exchange.h>10#include <clc/opencl/atomic/atom_xchg.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_xchg(volatile AS TYPE *p, TYPE val) {       \16    return __clc_atomic_exchange(p, val, __ATOMIC_RELAXED,                     \17                                 __MEMORY_SCOPE_DEVICE);                       \18  }                                                                            \19  _CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(AS TYPE *p, TYPE val) {                \20    return atom_xchg((volatile AS TYPE *)p, val);                              \21  }22 23#ifdef cl_khr_global_int32_base_atomics24__CLC_IMPL(global, int)25__CLC_IMPL(global, unsigned int)26#endif // cl_khr_global_int32_base_atomics27 28#ifdef cl_khr_local_int32_base_atomics29__CLC_IMPL(local, int)30__CLC_IMPL(local, unsigned int)31#endif // cl_khr_local_int32_base_atomics32 33#ifdef cl_khr_int64_base_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_base_atomics41