forked from OSchip/llvm-project
atomic: define extension functions for existing atomic implementations
We were missing the local versions of the atom_* before Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 217911
This commit is contained in:
parent
5c553e3785
commit
c9b88d32be
|
@ -0,0 +1,2 @@
|
|||
_CLC_OVERLOAD _CLC_DECL int atom_add(local int *p, int val);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(local unsigned int *p, unsigned int val);
|
|
@ -0,0 +1,2 @@
|
|||
_CLC_OVERLOAD _CLC_DECL int atom_dec(local int *p);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(local unsigned int *p);
|
|
@ -0,0 +1,2 @@
|
|||
_CLC_OVERLOAD _CLC_DECL int atom_inc(local int *p);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(local unsigned int *p);
|
|
@ -0,0 +1,2 @@
|
|||
_CLC_OVERLOAD _CLC_DECL int atom_sub(local int *p, int val);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(local unsigned int *p, unsigned int val);
|
|
@ -151,6 +151,12 @@
|
|||
#include <clc/cl_khr_global_int32_base_atomics/atom_inc.h>
|
||||
#include <clc/cl_khr_global_int32_base_atomics/atom_sub.h>
|
||||
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_add.h>
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_dec.h>
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_inc.h>
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_sub.h>
|
||||
|
||||
|
||||
/* libclc internal defintions */
|
||||
#ifdef __CLC_INTERNAL
|
||||
#include <math/clc_nextafter.h>
|
||||
|
|
|
@ -4,6 +4,10 @@ cl_khr_global_int32_base_atomics/atom_add.cl
|
|||
cl_khr_global_int32_base_atomics/atom_dec.cl
|
||||
cl_khr_global_int32_base_atomics/atom_inc.cl
|
||||
cl_khr_global_int32_base_atomics/atom_sub.cl
|
||||
cl_khr_local_int32_base_atomics/atom_add.cl
|
||||
cl_khr_local_int32_base_atomics/atom_dec.cl
|
||||
cl_khr_local_int32_base_atomics/atom_inc.cl
|
||||
cl_khr_local_int32_base_atomics/atom_sub.cl
|
||||
convert.cl
|
||||
common/sign.cl
|
||||
geometric/cross.cl
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include <clc/clc.h>
|
||||
|
||||
#define IMPL(TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(local TYPE *p, TYPE val) { \
|
||||
return atomic_add(p, val); \
|
||||
}
|
||||
|
||||
IMPL(int)
|
||||
IMPL(unsigned int)
|
|
@ -0,0 +1,9 @@
|
|||
#include <clc/clc.h>
|
||||
|
||||
#define IMPL(TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(local TYPE *p) { \
|
||||
return atom_sub(p, 1); \
|
||||
}
|
||||
|
||||
IMPL(int)
|
||||
IMPL(unsigned int)
|
|
@ -0,0 +1,9 @@
|
|||
#include <clc/clc.h>
|
||||
|
||||
#define IMPL(TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(local TYPE *p) { \
|
||||
return atom_add(p, 1); \
|
||||
}
|
||||
|
||||
IMPL(int)
|
||||
IMPL(unsigned int)
|
|
@ -0,0 +1,9 @@
|
|||
#include <clc/clc.h>
|
||||
|
||||
#define IMPL(TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(local TYPE *p, TYPE val) { \
|
||||
return atomic_sub(p, val); \
|
||||
}
|
||||
|
||||
IMPL(int)
|
||||
IMPL(unsigned int)
|
Loading…
Reference in New Issue