Skip to content

[NFC][libclc] Merge atomic extension built-ins with identical name into a single file #134489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics
#define __CLC_FUNCTION atom_add
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_and.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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_and
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
39 changes: 39 additions & 0 deletions libclc/generic/include/clc/atomic/atom_cmpxchg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#ifdef cl_khr_global_int32_base_atomics
_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile global int *p, int cmp,
int val);
_CLC_OVERLOAD _CLC_DECL unsigned int
atom_cmpxchg(volatile global unsigned int *p, unsigned int cmp,
unsigned int val);
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile local int *p, int cmp,
int val);
_CLC_OVERLOAD _CLC_DECL unsigned int
atom_cmpxchg(volatile local unsigned int *p, unsigned int cmp,
unsigned int val);
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics
_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile global long *p, long cmp,
long val);
_CLC_OVERLOAD _CLC_DECL unsigned long
atom_cmpxchg(volatile global unsigned long *p, unsigned long cmp,
unsigned long val);
_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile local long *p, long cmp,
long val);
_CLC_OVERLOAD _CLC_DECL unsigned long
atom_cmpxchg(volatile local unsigned long *p, unsigned long cmp,
unsigned long val);
#endif // cl_khr_int64_base_atomics
28 changes: 28 additions & 0 deletions libclc/generic/include/clc/atomic/atom_dec.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#ifdef cl_khr_global_int32_base_atomics
_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile global int *p);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile global unsigned int *p);
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile local int *p);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile local unsigned int *p);
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics
_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile global long *p);
_CLC_OVERLOAD _CLC_DECL unsigned long
atom_dec(volatile global unsigned long *p);
_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile local long *p);
_CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile local unsigned long *p);
#endif // cl_khr_int64_base_atomics
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//
//===----------------------------------------------------------------------===//

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);

__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, int)
__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, uint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//
//===----------------------------------------------------------------------===//

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);

__CLC_DECLARE_ATOM(local, long)
__CLC_DECLARE_ATOM(local, ulong)
Expand Down
28 changes: 28 additions & 0 deletions libclc/generic/include/clc/atomic/atom_inc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#ifdef cl_khr_global_int32_base_atomics
_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile global int *p);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile global unsigned int *p);
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile local int *p);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile local unsigned int *p);
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics
_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile global long *p);
_CLC_OVERLOAD _CLC_DECL unsigned long
atom_inc(volatile global unsigned long *p);
_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile local long *p);
_CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile local unsigned long *p);
#endif // cl_khr_int64_base_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_max
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_min
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_or.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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_or
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics
#define __CLC_FUNCTION atom_sub
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_xchg.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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics
#define __CLC_FUNCTION atom_xchg
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics
24 changes: 24 additions & 0 deletions libclc/generic/include/clc/atomic/atom_xor.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
//
//===----------------------------------------------------------------------===//

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_xor
#include <clc/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading