diff options
14 files changed, 136 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h new file mode 100644 index 00000000000..5addc13bd50 --- /dev/null +++ b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h @@ -0,0 +1,4 @@ +_CLC_OVERLOAD _CLC_DECL long atom_add(volatile global long *p, long val); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_add(volatile global unsigned long *p, unsigned long val); +_CLC_OVERLOAD _CLC_DECL long atom_add(volatile local long *p, long val); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_add(volatile local unsigned long *p, unsigned long val); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h new file mode 100644 index 00000000000..ce3f9f91c67 --- /dev/null +++ b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h @@ -0,0 +1,4 @@ +_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); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h new file mode 100644 index 00000000000..e2e37568f58 --- /dev/null +++ b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h @@ -0,0 +1,4 @@ +_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); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h new file mode 100644 index 00000000000..1bb91e2f2c8 --- /dev/null +++ b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h @@ -0,0 +1,4 @@ +_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); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h new file mode 100644 index 00000000000..2186ec9e43d --- /dev/null +++ b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h @@ -0,0 +1,4 @@ +_CLC_OVERLOAD _CLC_DECL long atom_sub(volatile global long *p, long val); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_sub(volatile global unsigned long *p, unsigned long val); +_CLC_OVERLOAD _CLC_DECL long atom_sub(volatile local long *p, long val); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_sub(volatile local unsigned long *p, unsigned long val); diff --git a/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h new file mode 100644 index 00000000000..3627af13e96 --- /dev/null +++ b/libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h @@ -0,0 +1,4 @@ +_CLC_OVERLOAD _CLC_DECL long atom_xchg(volatile global long *p, long val); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_xchg(volatile global unsigned long *p, unsigned long val); +_CLC_OVERLOAD _CLC_DECL long atom_xchg(volatile local long *p, long val); +_CLC_OVERLOAD _CLC_DECL unsigned long atom_xchg(volatile local unsigned long *p, unsigned long val); diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 9c0e00c4215..863a73dfa4b 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -237,6 +237,16 @@ #include <clc/cl_khr_local_int32_extended_atomics/atom_or.h> #include <clc/cl_khr_local_int32_extended_atomics/atom_xor.h> +/* cl_khr_int64_base_atomics Extension Functions */ +#ifdef cl_khr_int64_base_atomics +#include <clc/cl_khr_int64_base_atomics/atom_add.h> +#include <clc/cl_khr_int64_base_atomics/atom_cmpxchg.h> +#include <clc/cl_khr_int64_base_atomics/atom_dec.h> +#include <clc/cl_khr_int64_base_atomics/atom_inc.h> +#include <clc/cl_khr_int64_base_atomics/atom_sub.h> +#include <clc/cl_khr_int64_base_atomics/atom_xchg.h> +#endif + /* 6.12.12 Miscellaneous Vector Functions */ #include <clc/misc/shuffle.h> #include <clc/misc/shuffle2.h> diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index f665ce222dc..7df86834648 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -28,6 +28,12 @@ cl_khr_local_int32_extended_atomics/atom_max.cl cl_khr_local_int32_extended_atomics/atom_min.cl cl_khr_local_int32_extended_atomics/atom_or.cl cl_khr_local_int32_extended_atomics/atom_xor.cl +cl_khr_int64_base_atomics/atom_add.cl +cl_khr_int64_base_atomics/atom_cmpxchg.cl +cl_khr_int64_base_atomics/atom_dec.cl +cl_khr_int64_base_atomics/atom_inc.cl +cl_khr_int64_base_atomics/atom_sub.cl +cl_khr_int64_base_atomics/atom_xchg.cl convert.cl common/degrees.cl common/mix.cl diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl new file mode 100644 index 00000000000..9ef8a1bcdf1 --- /dev/null +++ b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_add.cl @@ -0,0 +1,16 @@ +#include <clc/clc.h> + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_add_8(p, val); \ +} + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl new file mode 100644 index 00000000000..74e3e310d4d --- /dev/null +++ b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl @@ -0,0 +1,16 @@ +#include <clc/clc.h> + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, TYPE val) { \ + return __sync_val_compare_and_swap_8(p, cmp, val); \ +} + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl new file mode 100644 index 00000000000..cc2d8e3b353 --- /dev/null +++ b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl @@ -0,0 +1,16 @@ +#include <clc/clc.h> + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \ + return atom_sub(p, (TYPE)1); \ +} + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl new file mode 100644 index 00000000000..5541e272a98 --- /dev/null +++ b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl @@ -0,0 +1,16 @@ +#include <clc/clc.h> + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \ + return atom_add(p, (TYPE)1); \ +} + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl new file mode 100644 index 00000000000..c1b9272a3ca --- /dev/null +++ b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl @@ -0,0 +1,16 @@ +#include <clc/clc.h> + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(volatile AS TYPE *p, TYPE val) { \ + return __sync_fetch_and_sub_8(p, val); \ +} + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif diff --git a/libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl new file mode 100644 index 00000000000..f6560db5084 --- /dev/null +++ b/libclc/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl @@ -0,0 +1,16 @@ +#include <clc/clc.h> + +#ifdef cl_khr_int64_base_atomics + +#define IMPL(AS, TYPE) \ +_CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(volatile AS TYPE *p, TYPE val) { \ + return __sync_swap_8(p, val); \ +} + +IMPL(global, long) +IMPL(global, unsigned long) +IMPL(local, long) +IMPL(local, unsigned long) +#undef IMPL + +#endif |

