25 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/atomic_xchg.h>11 12#define __CLC_IMPL(TYPE, AS) \13 _CLC_OVERLOAD _CLC_DEF TYPE atomic_xchg(volatile AS TYPE *p, TYPE val) { \14 return __clc_atomic_exchange(p, val, __ATOMIC_RELAXED, \15 __MEMORY_SCOPE_DEVICE); \16 }17 18__CLC_IMPL(int, global)19__CLC_IMPL(unsigned int, global)20__CLC_IMPL(float, global)21__CLC_IMPL(int, local)22__CLC_IMPL(unsigned int, local)23__CLC_IMPL(float, local)24#undef __CLC_IMPL25