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:
Aaron Watry 2014-09-16 22:34:21 +00:00
parent 5c553e3785
commit c9b88d32be
10 changed files with 54 additions and 0 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -151,6 +151,12 @@
#include <clc/cl_khr_global_int32_base_atomics/atom_inc.h> #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_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 */ /* libclc internal defintions */
#ifdef __CLC_INTERNAL #ifdef __CLC_INTERNAL
#include <math/clc_nextafter.h> #include <math/clc_nextafter.h>

View File

@ -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_dec.cl
cl_khr_global_int32_base_atomics/atom_inc.cl cl_khr_global_int32_base_atomics/atom_inc.cl
cl_khr_global_int32_base_atomics/atom_sub.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 convert.cl
common/sign.cl common/sign.cl
geometric/cross.cl geometric/cross.cl

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)