[Piglit] [PATCH v2 1/1] cl: Add tests for 64 bit integer atomics
Jan Vesely
jan.vesely at rutgers.edu
Wed Sep 20 04:47:18 UTC 2017
v2: Fix xor local test
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
All test pass on clover carrizo/iceland (need libclc and mesa patches).
I haven't found any other implementation exposing int64 atomics
.../atomic/atomic_int64_add-global-return.cl | 63 +++++++++++++++++
.../builtin/atomic/atomic_int64_add-global.cl | 60 ++++++++++++++++
.../builtin/atomic/atomic_int64_add-local.cl | 71 +++++++++++++++++++
.../atomic/atomic_int64_and-global-return.cl | 65 +++++++++++++++++
.../builtin/atomic/atomic_int64_and-global.cl | 62 ++++++++++++++++
.../builtin/atomic/atomic_int64_and-local.cl | 71 +++++++++++++++++++
.../atomic/atomic_int64_cmpxchg-global-return.cl | 74 +++++++++++++++++++
.../builtin/atomic/atomic_int64_cmpxchg-global.cl | 70 ++++++++++++++++++
.../builtin/atomic/atomic_int64_cmpxchg-local.cl | 82 ++++++++++++++++++++++
.../atomic/atomic_int64_dec-global-return.cl | 63 +++++++++++++++++
.../builtin/atomic/atomic_int64_dec-global.cl | 59 ++++++++++++++++
.../builtin/atomic/atomic_int64_dec-local.cl | 68 ++++++++++++++++++
.../atomic/atomic_int64_inc-global-return.cl | 63 +++++++++++++++++
.../builtin/atomic/atomic_int64_inc-global.cl | 59 ++++++++++++++++
.../builtin/atomic/atomic_int64_inc-local.cl | 68 ++++++++++++++++++
.../atomic/atomic_int64_max-global-return.cl | 63 +++++++++++++++++
.../builtin/atomic/atomic_int64_max-global.cl | 60 ++++++++++++++++
.../builtin/atomic/atomic_int64_max-local.cl | 82 ++++++++++++++++++++++
.../atomic/atomic_int64_min-global-return.cl | 63 +++++++++++++++++
.../builtin/atomic/atomic_int64_min-global.cl | 60 ++++++++++++++++
.../builtin/atomic/atomic_int64_min-local.cl | 82 ++++++++++++++++++++++
.../atomic/atomic_int64_or-global-return.cl | 65 +++++++++++++++++
.../builtin/atomic/atomic_int64_or-global.cl | 62 ++++++++++++++++
.../builtin/atomic/atomic_int64_or-local.cl | 71 +++++++++++++++++++
.../atomic/atomic_int64_sub-global-return.cl | 63 +++++++++++++++++
.../builtin/atomic/atomic_int64_sub-global.cl | 60 ++++++++++++++++
.../builtin/atomic/atomic_int64_sub-local.cl | 71 +++++++++++++++++++
.../atomic/atomic_int64_xchg-global-return.cl | 69 ++++++++++++++++++
.../builtin/atomic/atomic_int64_xchg-global.cl | 67 ++++++++++++++++++
.../builtin/atomic/atomic_int64_xchg-local.cl | 76 ++++++++++++++++++++
.../atomic/atomic_int64_xor-global-return.cl | 65 +++++++++++++++++
.../builtin/atomic/atomic_int64_xor-global.cl | 62 ++++++++++++++++
.../builtin/atomic/atomic_int64_xor-local.cl | 72 +++++++++++++++++++
33 files changed, 2211 insertions(+)
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_add-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_add-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_add-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_and-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_and-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_and-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_dec-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_inc-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_max-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_max-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_max-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_min-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_min-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_min-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_or-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_or-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_or-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_sub-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-local.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global-return.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global.cl
create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int64_xor-local.cl
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_add-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_add-global-return.cl
new file mode 100644
index 000000000..5b5d82de2
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_add-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int64_add global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 -5
+arg_in: 0 buffer long[2] -5 0
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 1 0
+arg_in: 0 buffer ulong[2] 0 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in: 0 buffer long[18] 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in: 0 buffer ulong[18] 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ mem[1] = atom_add(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_add(mem, id); \
+ TYPE ret2 = atom_add(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_add-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_add-global.cl
new file mode 100644
index 000000000..9bbbbf393
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_add-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int64_add global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -4
+arg_in: 0 buffer long[1] -5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 28
+arg_in: 0 buffer long[1] 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 28
+arg_in: 0 buffer ulong[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ atom_add(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_add(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_add-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_add-local.cl
new file mode 100644
index 000000000..da9908a7d
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_add-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int64_add local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 1
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -4
+arg_in: 3 long 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 4 9
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 4
+arg_in: 3 ulong 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 28
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 28
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atom_add(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ atom_add(mem, id); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_and-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_and-global-return.cl
new file mode 100644
index 000000000..e5f36e3fd
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_and-global-return.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: atom_int64_and global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] 4 5
+arg_in: 0 buffer long[2] 5 0
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 2 6
+arg_in: 0 buffer ulong[2] 6 0
+arg_in: 1 ulong 10
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in: 0 buffer long[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in: 0 buffer ulong[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+ mem[1] = atom_and(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_and(mem, id); \
+ TYPE ret2 = atom_and(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_and-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_and-global.cl
new file mode 100644
index 000000000..91e8d8762
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_and-global.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atom_int64_and global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] 4
+arg_in: 0 buffer long[1] 5
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 2
+arg_in: 0 buffer ulong[1] 6
+arg_in: 1 ulong 10
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 0 buffer long[1] -7
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 0
+arg_in: 0 buffer ulong[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+ atom_and(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_and(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_and-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_and-local.cl
new file mode 100644
index 000000000..302ae4bff
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_and-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int64_and local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 4
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -4
+arg_in: 3 long 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 4 4
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 4
+arg_in: 3 ulong 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 0
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atom_and(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 7; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ atom_and(mem, id); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global-return.cl
new file mode 100644
index 000000000..8075e5d90
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global-return.cl
@@ -0,0 +1,74 @@
+/*!
+[config]
+name: atom_int64_cmpxchg global return
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer long[2] 5 -4
+arg_in: 0 buffer long[2] -4 -4
+arg_in: 1 buffer long[2] -4 3
+arg_in: 2 buffer long[2] 5 5
+arg_out: 3 buffer long[2] -4 -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer ulong[2] 5 4
+arg_in: 0 buffer ulong[2] 4 4
+arg_in: 1 buffer ulong[2] 4 3
+arg_in: 2 buffer ulong[2] 5 5
+arg_out: 3 buffer ulong[2] 4 4
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 8
+arg_in: 0 buffer long[1] 0
+arg_out: 1 buffer long[8] 0 1 2 3 4 5 6 7
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 8
+arg_in: 0 buffer ulong[1] 0
+arg_out: 1 buffer ulong[8] 0 1 2 3 4 5 6 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *initial, global TYPE *compare, global TYPE *value, global TYPE *old) { \
+ old[0] = atom_cmpxchg(initial, compare[0], value[0]); \
+ old[1] = atom_cmpxchg(initial+1, compare[1], value[1]); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, global TYPE *old) { \
+ long i; \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ TYPE id = get_global_id(0); \
+ for(i = 0; i < get_global_size(0); i++){ \
+ TYPE old_val = atom_cmpxchg(out, id, id+1); \
+ if (old_val == id) /* success */ \
+ old[id] = old_val; \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ } \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global.cl
new file mode 100644
index 000000000..7b59ab197
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global.cl
@@ -0,0 +1,70 @@
+/*!
+[config]
+name: atom_int64_cmpxchg global
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer long[2] 5 -4
+arg_in: 0 buffer long[2] -4 -4
+arg_in: 1 buffer long[2] -4 3
+arg_in: 2 buffer long[2] 5 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer ulong[2] 5 4
+arg_in: 0 buffer ulong[2] 4 4
+arg_in: 1 buffer ulong[2] 4 3
+arg_in: 2 buffer ulong[2] 5 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 8
+arg_in: 0 buffer long[1] 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 8
+arg_in: 0 buffer ulong[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *initial, global TYPE *compare, global TYPE *value) { \
+ atom_cmpxchg(initial, compare[0], value[0]); \
+ atom_cmpxchg(initial+1, compare[1], value[1]); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out) { \
+ long i; \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ TYPE id = get_global_id(0); \
+ for(i = 0; i < get_global_size(0); i++){ \
+ if (i == id){ \
+ atom_cmpxchg(out, id, id+1); \
+ } \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ } \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-local.cl
new file mode 100644
index 000000000..4f93c15e0
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-local.cl
@@ -0,0 +1,82 @@
+/*!
+[config]
+name: atom_int64_cmpxchg local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[4] -4 5 -4 -4
+arg_in: 1 buffer long[2] NULL
+arg_in: 2 buffer long[2] -4 -4
+arg_in: 3 buffer long[2] -4 3
+arg_in: 4 buffer long[2] 5 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[4] 4 5 4 4
+arg_in: 1 buffer ulong[2] NULL
+arg_in: 2 buffer ulong[2] 4 4
+arg_in: 3 buffer ulong[2] 4 3
+arg_in: 4 buffer ulong[2] 5 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 8
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 8
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, global TYPE *initial, global TYPE *compare, global TYPE *value) { \
+ mem[0] = initial[0]; \
+ mem[1] = initial[1]; \
+ TYPE a = atom_cmpxchg(mem, compare[0], value[0]); \
+ out[0] = a; \
+ out[1] = *mem; \
+ a = atom_cmpxchg(mem+1, compare[1], value[1]); \
+ out[2] = a; \
+ out[3] = mem[1]; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ long i; \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ for(i = 0; i < get_local_size(0); i++){ \
+ if (i == id){ \
+ atom_cmpxchg(mem, id, id+1); \
+ } \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ } \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global-return.cl
new file mode 100644
index 000000000..f5462a922
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int64_dec global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -5 -4
+arg_in: 0 buffer long[2] -4 0
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 1 2
+arg_in: 0 buffer ulong[2] 2 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] -9 0 -1 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in: 0 buffer long[18] -1 0 0 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in: 0 buffer ulong[18] 8 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ mem[1] = atom_dec(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_dec(mem); \
+ TYPE ret2 = atom_dec(&mem[(id+1)*2]); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global.cl
new file mode 100644
index 000000000..426eeb8b3
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atom_int64_dec global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -5
+arg_in: 0 buffer long[1] -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 2
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] -8
+arg_in: 0 buffer long[1] 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 9
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ atom_dec(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ atom_dec(mem); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-local.cl
new file mode 100644
index 000000000..60896ea8b
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_dec-local.cl
@@ -0,0 +1,68 @@
+/*!
+[config]
+name: atom_int64_dec local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -2 -3
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -2
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 2 1
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 2
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 8
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 8
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial) { \
+ *mem = initial; \
+ TYPE a = atom_dec(mem); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 16; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ atom_dec(mem); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global-return.cl
new file mode 100644
index 000000000..3a9913faf
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int64_inc global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 -5
+arg_in: 0 buffer long[2] -5 0
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 1 0
+arg_in: 0 buffer ulong[2] 0 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] -1 0 0 -1 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in: 0 buffer long[18] -9 0 -1 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 8 0 1 0 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in: 0 buffer ulong[18] 0 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ mem[1] = atom_inc(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_inc(mem); \
+ TYPE ret2 = atom_inc(&mem[(id+1)*2]); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global.cl
new file mode 100644
index 000000000..06c896815
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atom_int64_inc global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -4
+arg_in: 0 buffer long[1] -5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 0 buffer long[1] -8
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 8
+arg_in: 0 buffer ulong[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ atom_inc(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ atom_inc(mem); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-local.cl
new file mode 100644
index 000000000..f5acb9da5
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_inc-local.cl
@@ -0,0 +1,68 @@
+/*!
+[config]
+name: atom_int64_inc local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -2 -1
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -2
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 2 3
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 2
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 8
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 8
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial) { \
+ *mem = initial; \
+ TYPE a = atom_inc(mem); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ atom_inc(mem); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_max-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_max-global-return.cl
new file mode 100644
index 000000000..359eeba50
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_max-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int64_max global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] 1 -5
+arg_in: 0 buffer long[2] -5 0
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 1 0
+arg_in: 0 buffer ulong[2] 0 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in: 0 buffer long[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in: 0 buffer ulong[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ mem[1] = atom_max(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_max(mem, id); \
+ TYPE ret2 = atom_max(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_max-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_max-global.cl
new file mode 100644
index 000000000..ad83cbc35
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_max-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int64_max global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] 1
+arg_in: 0 buffer long[1] -5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 0 buffer long[1] 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 0 buffer ulong[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ atom_max(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_max(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_max-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_max-local.cl
new file mode 100644
index 000000000..442d1fbb0
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_max-local.cl
@@ -0,0 +1,82 @@
+/*!
+[config]
+name: atom_int64_max local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -1 2
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -1
+arg_in: 3 long 2
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 2 3
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 2
+arg_in: 3 ulong 3
+
+[test]
+name: simple ulong 2
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 3 4294967295
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 3
+arg_in: 3 ulong 0xffffffff
+
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE other) { \
+ *mem = initial; \
+ TYPE a = atom_max(mem, other); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ atom_max(mem, get_global_id(0)); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_min-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_min-global-return.cl
new file mode 100644
index 000000000..52eefd796
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_min-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int64_min global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] 1 5
+arg_in: 0 buffer long[2] 5 0
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 1 2
+arg_in: 0 buffer ulong[2] 2 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 0 0 -1 -1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in: 0 buffer long[18] 7 0 -1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in: 0 buffer ulong[18] 7 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ mem[1] = atom_min(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_min(mem, id); \
+ TYPE ret2 = atom_min(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_min-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_min-global.cl
new file mode 100644
index 000000000..13bf2da3d
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_min-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int64_min global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -5
+arg_in: 0 buffer long[1] -5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 2
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 0 buffer long[1] 7
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 0
+arg_in: 0 buffer ulong[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ atom_min(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_min(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_min-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_min-local.cl
new file mode 100644
index 000000000..f51334f12
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_min-local.cl
@@ -0,0 +1,82 @@
+/*!
+[config]
+name: atom_int64_min local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] 1 -2
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long 1
+arg_in: 3 long -2
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 3 2
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 3
+arg_in: 3 ulong 2
+
+[test]
+name: simple ulong 2
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 4294967295 3
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 4294967295
+arg_in: 3 ulong 3
+
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 0
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE other) { \
+ *mem = initial; \
+ TYPE a = atom_min(mem, other); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 8; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ atom_min(mem, get_global_id(0)); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_or-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_or-global-return.cl
new file mode 100644
index 000000000..63e37b3af
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_or-global-return.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: atom_int64_or global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -3 5
+arg_in: 0 buffer long[2] 5 0
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 14 6
+arg_in: 0 buffer ulong[2] 6 0
+arg_in: 1 ulong 10
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in: 0 buffer long[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0 8 0 8 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in: 0 buffer long[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0 8 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+ mem[1] = atom_or(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_or(mem, id); \
+ TYPE ret2 = atom_or(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_or-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_or-global.cl
new file mode 100644
index 000000000..1c70d6c70
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_or-global.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atom_int64_or global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -3
+arg_in: 0 buffer long[1] 5
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 14
+arg_in: 0 buffer ulong[1] 6
+arg_in: 1 ulong 10
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 0 buffer long[1] 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 0 buffer ulong[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+ atom_or(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_or(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_or-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_or-local.cl
new file mode 100644
index 000000000..af23d2d18
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_or-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int64_or local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 -3
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -4
+arg_in: 3 long 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 4 5
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 4
+arg_in: 3 ulong 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atom_or(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ atom_or(mem, id); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global-return.cl
new file mode 100644
index 000000000..0790efd64
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int64_sub global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -6 -4
+arg_in: 0 buffer long[2] -4 0
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 1 3
+arg_in: 0 buffer ulong[2] 3 0
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 0 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in: 0 buffer long[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[18] 0 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in: 0 buffer ulong[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ mem[1] = atom_sub(mem, 2); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_sub(mem, id); \
+ TYPE ret2 = atom_sub(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global.cl
new file mode 100644
index 000000000..8abb3878b
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int64_sub global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -6
+arg_in: 0 buffer long[1] -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 1
+arg_in: 0 buffer ulong[1] 3
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 0 buffer long[1] 28
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 0
+arg_in: 0 buffer ulong[1] 28
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+ atom_sub(mem, 2); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_sub(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-local.cl
new file mode 100644
index 000000000..68af98ef9
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_sub-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int64_sub local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 -9
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -4
+arg_in: 3 long 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 5 1
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 5
+arg_in: 3 ulong 4
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 28
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 28
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atom_sub(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 56; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ atom_sub(mem, id); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global-return.cl
new file mode 100644
index 000000000..92e4f3301
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global-return.cl
@@ -0,0 +1,69 @@
+/*!
+[config]
+name: atom_int64_xchg global
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer long[2] -4 1
+arg_in: 0 buffer long[2] 1 0
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer long[2] 4 2
+arg_in: 0 buffer long[2] 2 0
+arg_in: 1 long 4
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 0 buffer long[1] -1
+arg_out: 1 buffer long[8] -1 0 1 2 3 4 5 6
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 0 buffer ulong[1] 9
+arg_out: 1 buffer long[8] 9 0 1 2 3 4 5 6
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, TYPE value) { \
+ out[1] = atom_xchg(out, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, global TYPE *old) { \
+ long i; \
+ TYPE id = get_global_id(0); \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ for(i = 0; i < get_global_size(0); i++){ \
+ if (i == id){ \
+ old[i] = atom_xchg(out, (TYPE)id); \
+ } \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ } \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global.cl
new file mode 100644
index 000000000..8c7e4b1d6
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-global.cl
@@ -0,0 +1,67 @@
+/*!
+[config]
+name: atom_int64_xchg global
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer long[1] -4
+arg_in: 0 buffer long[1] 1
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer long[1] 4
+arg_in: 0 buffer long[1] 2
+arg_in: 1 long 4
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 0 buffer long[1] 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 0 buffer ulong[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, TYPE value) { \
+ atom_xchg(out, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out) { \
+ long i; \
+ TYPE id = get_global_id(0); \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ for(i = 0; i < get_global_size(0); i++){ \
+ if (i == id){ \
+ atom_xchg(out, (TYPE)id); \
+ } \
+ barrier(CLK_GLOBAL_MEM_FENCE); \
+ } \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-local.cl
new file mode 100644
index 000000000..8dcd0504c
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_xchg-local.cl
@@ -0,0 +1,76 @@
+/*!
+[config]
+name: atom_int64_xchg local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_base_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -4 5
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -4
+arg_in: 3 long 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 4 5
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 4
+arg_in: 3 ulong 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 7
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atom_xchg(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ long i; \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ for(i = 0; i < get_local_size(0); i++){ \
+ if (i == id){ \
+ atom_xchg(mem, (TYPE)id); \
+ } \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ } \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global-return.cl
new file mode 100644
index 000000000..a77b1e404
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global-return.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: atom_int64_xor global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[2] -7 5
+arg_in: 0 buffer long[2] 5 0
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 12 6
+arg_in: 0 buffer ulong[2] 6 0
+arg_in: 1 ulong 10
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in: 0 buffer long[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in: 0 buffer long[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+ mem[1] = atom_xor(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE mul = mem[1]; \
+ TYPE id = get_global_id(0); \
+ TYPE ret = atom_xor(mem, id); \
+ TYPE ret2 = atom_xor(&mem[(id+1)*2], id+ret*mul); \
+ mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global.cl
new file mode 100644
index 000000000..47ad1b9cc
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-global.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atom_int64_xor global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer long[1] -7
+arg_in: 0 buffer long[1] 5
+arg_in: 1 long -4
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[1] 12
+arg_in: 0 buffer ulong[1] 6
+arg_in: 1 ulong 10
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] -7
+arg_in: 0 buffer long[1] -7
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 7
+arg_in: 0 buffer ulong[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+ atom_xor(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+ TYPE id = get_global_id(0); \
+ atom_xor(mem, id); \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-local.cl
new file mode 100644
index 000000000..fda2b8064
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int64_xor-local.cl
@@ -0,0 +1,72 @@
+/*!
+[config]
+name: atom_int64_xor local
+clc_version_min: 10
+require_device_extensions: cl_khr_int64_extended_atomics
+
+[test]
+name: simple long
+kernel_name: simple_long
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+#-4 = 1...11111100, 5 = 0...00000101, -4^5 = 11111001
+arg_out: 0 buffer long[2] -4 0xfffffffffffffff9
+arg_in: 1 buffer long[1] NULL
+arg_in: 2 long -4
+arg_in: 3 long 5
+
+[test]
+name: simple ulong
+kernel_name: simple_ulong
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer ulong[2] 4 1
+arg_in: 1 buffer ulong[1] NULL
+arg_in: 2 ulong 4
+arg_in: 3 ulong 5
+
+[test]
+name: threads long
+kernel_name: threads_long
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer long[1] 0
+arg_in: 1 buffer long[1] NULL
+
+[test]
+name: threads ulong
+kernel_name: threads_ulong
+dimensions: 1
+global_size: 8 0 0
+local_size: 8 0 0
+arg_out: 0 buffer ulong[1] 0
+arg_in: 1 buffer ulong[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, TYPE value) { \
+ *mem = initial; \
+ TYPE a = atom_xor(mem, value); \
+ out[0] = a; \
+ out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+ *mem = 0; \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ TYPE id = get_local_id(0); \
+ atom_xor(mem, id); \
+ barrier(CLK_LOCAL_MEM_FENCE); \
+ *out = *mem; \
+}
+
+SIMPLE_TEST(long)
+SIMPLE_TEST(ulong)
+
+THREADS_TEST(long)
+THREADS_TEST(ulong)
--
2.13.5
More information about the Piglit
mailing list