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