Add corresponding clc functions, which are implemented with clang __scoped_atomic builtins. OpenCL functions are implemented as a wrapper over clc functions. Also change legacy atomic_inc and atomic_dec to re-use the newly added clc_atomic_inc/dec implementations. llvm-diff only no change to atomic_inc and atomic_dec in bitcode. Notes: * Generic OpenCL built-ins functions uses __ATOMIC_SEQ_CST and __MEMORY_SCOPE_DEVICE for memory order and memory scope parameters. * OpenCL atomic_*_explicit, atomic_flag* built-ins are not implemented yet. * OpenCL built-ins of atomic_intptr_t, atomic_uintptr_t, atomic_size_t and atomic_ptrdiff_t types are not implemented yet. * llvm-diff shows no change to nvptx64--nvidiacl.bc and amdgcn--amdhsa.bc since __opencl_c_atomic_order_seq_cst and __opencl_c_atomic_scope_device are not defined in these two targets.
26 lines
917 B
Common Lisp
26 lines
917 B
Common Lisp
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#if defined(__opencl_c_atomic_order_seq_cst) && \
|
|
defined(__opencl_c_atomic_scope_device)
|
|
|
|
#include <clc/atomic/clc_atomic_fetch_max.h>
|
|
#include <clc/opencl/atomic/atomic_fetch_max.h>
|
|
|
|
#define FUNCTION atomic_fetch_max
|
|
#define __IMPL_FUNCTION __clc_atomic_fetch_max
|
|
|
|
#define __CLC_BODY <atomic_def.inc>
|
|
#include <clc/integer/gentype.inc>
|
|
|
|
#define __CLC_BODY <atomic_def.inc>
|
|
#include <clc/math/gentype.inc>
|
|
|
|
#endif // defined(__opencl_c_atomic_order_seq_cst) &&
|
|
// defined(__opencl_c_atomic_scope_device)
|