Skip to content
Merged
47 changes: 47 additions & 0 deletions libclc/clc/include/clc/atomic/atomic_decl.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

// MemoryOrder is memory order supported by Clang __scoped_atomic* builtins.
// MemoryScope is memory scope supported by Clang __scoped_atomic* builtins.

#ifdef __CLC_SCALAR
#if defined(__CLC_FPSIZE) || (__CLC_GENSIZE >= 32)

#ifdef __CLC_NO_VALUE_ARG
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, int MemoryOrder, \
int MemoryScope);
#elif defined(__CLC_RETURN_VOID)
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
_CLC_OVERLOAD _CLC_DECL void FUNCTION(volatile ADDRSPACE __CLC_GENTYPE *Ptr, \
__CLC_GENTYPE Value, int MemoryOrder, \
int MemoryScope);
#elif defined(__CLC_COMPARE_EXCHANGE)
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Comparator, \
__CLC_GENTYPE Value, int MemoryOrderEqual, int MemoryOrderUnequal, \
int MemoryScope);
#else
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Value, \
int MemoryOrder, int MemoryScope);
#endif

__CLC_DECLARE_ATOMIC(global)
__CLC_DECLARE_ATOMIC(local)
#if _CLC_GENERIC_AS_SUPPORTED
__CLC_DECLARE_ATOMIC()
#endif

#undef __CLC_DECLARE_ATOMIC

#endif // defined(__CLC_FPSIZE) || (__CLC_GENSIZE >= 32)
#endif // __CLC_SCALAR
26 changes: 26 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_compare_exchange.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_COMPARE_EXCHANGE_H__
#define __CLC_ATOMIC_CLC_ATOMIC_COMPARE_EXCHANGE_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_compare_exchange
#define __CLC_COMPARE_EXCHANGE

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef __CLC_COMPARE_EXCHANGE
#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_COMPARE_EXCHANGE_H__
23 changes: 23 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_dec.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_DEC_H__
#define __CLC_ATOMIC_CLC_ATOMIC_DEC_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_dec
#define __CLC_NO_VALUE_ARG

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#undef __CLC_NO_VALUE_ARG
#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_DEC_H__
24 changes: 24 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_exchange.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_EXCHANGE_H__
#define __CLC_ATOMIC_CLC_ATOMIC_EXCHANGE_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_exchange

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_EXCHANGE_H__
24 changes: 24 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_add.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_ADD_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_ADD_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_add

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_ADD_H__
21 changes: 21 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_and.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_AND_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_AND_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_and

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_AND_H__
24 changes: 24 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_max.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_MAX_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_MAX_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_max

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_MAX_H__
24 changes: 24 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_min.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_MIN_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_MIN_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_min

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_MIN_H__
21 changes: 21 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_or.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_OR_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_OR_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_or

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_OR_H__
24 changes: 24 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_sub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_SUB_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_SUB_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_sub

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_SUB_H__
21 changes: 21 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_fetch_xor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_FETCH_XOR_H__
#define __CLC_ATOMIC_CLC_ATOMIC_FETCH_XOR_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_fetch_xor

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_XOR_H__
23 changes: 23 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_inc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_INC_H__
#define __CLC_ATOMIC_CLC_ATOMIC_INC_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_inc
#define __CLC_NO_VALUE_ARG

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#undef __CLC_NO_VALUE_ARG
#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_INC_H__
26 changes: 26 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_load.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_LOAD_H__
#define __CLC_ATOMIC_CLC_ATOMIC_LOAD_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_load
#define __CLC_NO_VALUE_ARG

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef __CLC_NO_VALUE_ARG
#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_LOAD_H__
26 changes: 26 additions & 0 deletions libclc/clc/include/clc/atomic/clc_atomic_store.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef __CLC_ATOMIC_CLC_ATOMIC_STORE_H__
#define __CLC_ATOMIC_CLC_ATOMIC_STORE_H__

#include <clc/internal/clc.h>

#define FUNCTION __clc_atomic_store
#define __CLC_RETURN_VOID

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>

#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>

#undef __CLC_RETURN_VOID
#undef FUNCTION

#endif // __CLC_ATOMIC_CLC_ATOMIC_STORE_H__
13 changes: 13 additions & 0 deletions libclc/clc/lib/generic/SOURCES
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
async/clc_prefetch.cl
atomic/clc_atomic_compare_exchange.cl
atomic/clc_atomic_dec.cl
atomic/clc_atomic_exchange.cl
atomic/clc_atomic_fetch_add.cl
atomic/clc_atomic_fetch_and.cl
atomic/clc_atomic_fetch_max.cl
atomic/clc_atomic_fetch_min.cl
atomic/clc_atomic_fetch_or.cl
atomic/clc_atomic_fetch_sub.cl
atomic/clc_atomic_fetch_xor.cl
atomic/clc_atomic_inc.cl
atomic/clc_atomic_load.cl
atomic/clc_atomic_store.cl
common/clc_degrees.cl
common/clc_radians.cl
common/clc_sign.cl
Expand Down
Loading
Loading