[Piglit] [PATCH 1/1] cl: Add tests for clc-1.0 integer atomics

Jan Vesely jan.vesely at rutgers.edu
Wed Sep 27 21:22:17 UTC 2017


Passes on intel beignet, intel CPU, CUDA OpenCL, clover(carrizo)

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 .../atomic/atomic_int32_add-global-return.cl       | 63 +++++++++++++++++
 .../builtin/atomic/atomic_int32_add-global.cl      | 60 ++++++++++++++++
 .../builtin/atomic/atomic_int32_add-local.cl       | 71 +++++++++++++++++++
 .../atomic/atomic_int32_and-global-return.cl       | 65 +++++++++++++++++
 .../builtin/atomic/atomic_int32_and-global.cl      | 62 ++++++++++++++++
 .../builtin/atomic/atomic_int32_and-local.cl       | 71 +++++++++++++++++++
 .../atomic/atomic_int32_cmpxchg-global-return.cl   | 74 +++++++++++++++++++
 .../builtin/atomic/atomic_int32_cmpxchg-global.cl  | 70 ++++++++++++++++++
 .../builtin/atomic/atomic_int32_cmpxchg-local.cl   | 82 ++++++++++++++++++++++
 .../atomic/atomic_int32_dec-global-return.cl       | 63 +++++++++++++++++
 .../builtin/atomic/atomic_int32_dec-global.cl      | 59 ++++++++++++++++
 .../builtin/atomic/atomic_int32_dec-local.cl       | 68 ++++++++++++++++++
 .../atomic/atomic_int32_inc-global-return.cl       | 63 +++++++++++++++++
 .../builtin/atomic/atomic_int32_inc-global.cl      | 59 ++++++++++++++++
 .../builtin/atomic/atomic_int32_inc-local.cl       | 68 ++++++++++++++++++
 .../atomic/atomic_int32_max-global-return.cl       | 63 +++++++++++++++++
 .../builtin/atomic/atomic_int32_max-global.cl      | 60 ++++++++++++++++
 .../builtin/atomic/atomic_int32_max-local.cl       | 82 ++++++++++++++++++++++
 .../atomic/atomic_int32_min-global-return.cl       | 63 +++++++++++++++++
 .../builtin/atomic/atomic_int32_min-global.cl      | 60 ++++++++++++++++
 .../builtin/atomic/atomic_int32_min-local.cl       | 82 ++++++++++++++++++++++
 .../atomic/atomic_int32_or-global-return.cl        | 65 +++++++++++++++++
 .../builtin/atomic/atomic_int32_or-global.cl       | 62 ++++++++++++++++
 .../builtin/atomic/atomic_int32_or-local.cl        | 71 +++++++++++++++++++
 .../atomic/atomic_int32_sub-global-return.cl       | 63 +++++++++++++++++
 .../builtin/atomic/atomic_int32_sub-global.cl      | 60 ++++++++++++++++
 .../builtin/atomic/atomic_int32_sub-local.cl       | 71 +++++++++++++++++++
 .../atomic/atomic_int32_xchg-global-return.cl      | 69 ++++++++++++++++++
 .../builtin/atomic/atomic_int32_xchg-global.cl     | 67 ++++++++++++++++++
 .../builtin/atomic/atomic_int32_xchg-local.cl      | 76 ++++++++++++++++++++
 .../atomic/atomic_int32_xor-global-return.cl       | 65 +++++++++++++++++
 .../builtin/atomic/atomic_int32_xor-global.cl      | 62 ++++++++++++++++
 .../builtin/atomic/atomic_int32_xor-local.cl       | 72 +++++++++++++++++++
 33 files changed, 2211 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_add-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_add-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_add-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_and-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_and-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_and-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_dec-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_inc-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_max-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_max-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_max-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_min-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_min-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_min-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_or-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_or-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_or-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_sub-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_int32_xor-local.cl

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_add-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_add-global-return.cl
new file mode 100644
index 000000000..09b51c7e9
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_add-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int32_add global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -5
+arg_in:  0 buffer int[2] -5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in:  0 buffer int[18] 0  0 1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_add-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_add-global.cl
new file mode 100644
index 000000000..ae776d933
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_add-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int32_add global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_add-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_add-local.cl
new file mode 100644
index 000000000..1800a0fe2
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_add-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int32_add local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 1
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -4
+arg_in:  3 int           5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 9
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           4
+arg_in:  3 uint           5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_and-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_and-global-return.cl
new file mode 100644
index 000000000..12aa2b01d
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_and-global-return.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: atom_int32_and global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2]  4 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1        int    -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2]  2 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1        uint    10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_and-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_and-global.cl
new file mode 100644
index 000000000..cf1b88ec7
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_and-global.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atom_int32_and global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1]  4
+arg_in:  0 buffer int[1]  5
+arg_in:  1        int    -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1]  2
+arg_in:  0 buffer uint[1]  6
+arg_in:  1        uint    10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1]  0
+arg_in:  0 buffer int[1] -7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_and-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_and-local.cl
new file mode 100644
index 000000000..6cf7d7912
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_and-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int32_and local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 4
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -4
+arg_in:  3 int           5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 4
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           4
+arg_in:  3 uint           5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global-return.cl
new file mode 100644
index 000000000..8a9998eaf
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global-return.cl
@@ -0,0 +1,74 @@
+/*!
+[config]
+name: atom_int32_cmpxchg global return
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer int[2]  5 -4
+arg_in:  0 buffer int[2] -4 -4
+arg_in:  1 buffer int[2] -4  3
+arg_in:  2 buffer int[2]  5  5
+arg_out: 3 buffer int[2] -4 -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer uint[2] 5 4
+arg_in:  0 buffer uint[2] 4 4
+arg_in:  1 buffer uint[2] 4 3
+arg_in:  2 buffer uint[2] 5 5
+arg_out: 3 buffer uint[2] 4 4
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 8
+arg_in:  0 buffer int[1] 0
+arg_out: 1 buffer int[8] 0 1 2 3 4 5 6 7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  0 buffer uint[1] 0
+arg_out: 1 buffer uint[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) { \
+	int 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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global.cl
new file mode 100644
index 000000000..2492cae99
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global.cl
@@ -0,0 +1,70 @@
+/*!
+[config]
+name: atom_int32_cmpxchg global
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer int[2]  5 -4
+arg_in:  0 buffer int[2] -4 -4
+arg_in:  1 buffer int[2] -4  3
+arg_in:  2 buffer int[2]  5  5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer uint[2] 5 4
+arg_in:  0 buffer uint[2] 4 4
+arg_in:  1 buffer uint[2] 4 3
+arg_in:  2 buffer uint[2] 5 5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 8
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  0 buffer uint[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) { \
+	int 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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-local.cl
new file mode 100644
index 000000000..f1f16f708
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-local.cl
@@ -0,0 +1,82 @@
+/*!
+[config]
+name: atom_int32_cmpxchg local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[4] -4 5 -4 -4
+arg_in:  1 buffer int[2] NULL
+arg_in:  2 buffer int[2] -4 -4
+arg_in:  3 buffer int[2] -4 3
+arg_in:  4 buffer int[2]  5 5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[4] 4 5 4 4
+arg_in:  1 buffer uint[2] NULL
+arg_in:  2 buffer uint[2] 4 4
+arg_in:  3 buffer uint[2] 4 3
+arg_in:  4 buffer uint[2] 5 5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 8
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  1 buffer uint[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) { \
+	int 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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global-return.cl
new file mode 100644
index 000000000..850b4e55c
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int32_dec global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -5 -4
+arg_in:  0 buffer int[2] -4 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 2
+arg_in:  0 buffer uint[2] 2 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] -9 0 -1 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer int[18] -1 0  0 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global.cl
new file mode 100644
index 000000000..ea5f7caf8
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atom_int32_dec global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -5
+arg_in:  0 buffer int[1] -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] -8
+arg_in:  0 buffer int[1]  0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-local.cl
new file mode 100644
index 000000000..c85f5f4c8
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_dec-local.cl
@@ -0,0 +1,68 @@
+/*!
+[config]
+name: atom_int32_dec local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -2 -3
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -2
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 2 1
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 8
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global-return.cl
new file mode 100644
index 000000000..b65e3d7f3
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int32_inc global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -5
+arg_in:  0 buffer int[2] -5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] -1 0  0 -1 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in:  0 buffer int[18] -9 0 -1  0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 8 0 1 0 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global.cl
new file mode 100644
index 000000000..640d04d9a
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atom_int32_inc global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1]  0
+arg_in:  0 buffer int[1] -8
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-local.cl
new file mode 100644
index 000000000..23750c1cf
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_inc-local.cl
@@ -0,0 +1,68 @@
+/*!
+[config]
+name: atom_int32_inc local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -2 -1
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -2
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 2 3
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 8
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_max-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_max-global-return.cl
new file mode 100644
index 000000000..c606c404e
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_max-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int32_max global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2]  1 -5
+arg_in:  0 buffer int[2] -5  0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in:  0 buffer int[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_max-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_max-global.cl
new file mode 100644
index 000000000..54db3c76e
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_max-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int32_max global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1]  1
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_max-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_max-local.cl
new file mode 100644
index 000000000..b6c6aaee8
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_max-local.cl
@@ -0,0 +1,82 @@
+/*!
+[config]
+name: atom_int32_max local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -1 2
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -1
+arg_in:  3 int            2
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 2 3
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           2
+arg_in:  3 uint           3
+
+[test]
+name: simple uint 2
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 3 4294967295
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           3
+arg_in:  3 uint           0xffffffff
+
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_min-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_min-global-return.cl
new file mode 100644
index 000000000..88c7eef64
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_min-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int32_min global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] 1 5
+arg_in:  0 buffer int[2] 5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 2
+arg_in:  0 buffer uint[2] 2 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0 0 -1 -1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer int[18] 7 0 -1  0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_min-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_min-global.cl
new file mode 100644
index 000000000..94c5854b8
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_min-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int32_min global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -5
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  0 buffer int[1] 7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_min-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_min-local.cl
new file mode 100644
index 000000000..e5f75c866
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_min-local.cl
@@ -0,0 +1,82 @@
+/*!
+[config]
+name: atom_int32_min local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] 1 -2
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           1
+arg_in:  3 int           -2
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 3 2
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           3
+arg_in:  3 uint           2
+
+[test]
+name: simple uint 2
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4294967295 3
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           4294967295
+arg_in:  3 uint           3
+
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_or-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_or-global-return.cl
new file mode 100644
index 000000000..bfc19babd
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_or-global-return.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: atom_int32_or global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -3 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1        int    -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 14 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1        uint    10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in:  0 buffer int[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0  8 0  8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in:  0 buffer int[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_or-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_or-global.cl
new file mode 100644
index 000000000..8b625d121
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_or-global.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atom_int32_or global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -3
+arg_in:  0 buffer int[1]  5
+arg_in:  1        int    -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 14
+arg_in:  0 buffer uint[1]  6
+arg_in:  1        uint    10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_or-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_or-local.cl
new file mode 100644
index 000000000..f27b7124d
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_or-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int32_or local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -3
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -4
+arg_in:  3 int           5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 5
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           4
+arg_in:  3 uint           5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global-return.cl
new file mode 100644
index 000000000..d77484cb3
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global-return.cl
@@ -0,0 +1,63 @@
+/*!
+[config]
+name: atom_int32_sub global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -6 -4
+arg_in:  0 buffer int[2] -4 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 3
+arg_in:  0 buffer uint[2] 3 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in:  0 buffer int[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global.cl
new file mode 100644
index 000000000..65d491a8f
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global.cl
@@ -0,0 +1,60 @@
+/*!
+[config]
+name: atom_int32_sub global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -6
+arg_in:  0 buffer int[1] -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 3
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  0 buffer int[1] 28
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-local.cl
new file mode 100644
index 000000000..69c54a0fc
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_sub-local.cl
@@ -0,0 +1,71 @@
+/*!
+[config]
+name: atom_int32_sub local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -9
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -4
+arg_in:  3 int           5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 5 1
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           5
+arg_in:  3 uint           4
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global-return.cl
new file mode 100644
index 000000000..caeabcf51
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global-return.cl
@@ -0,0 +1,69 @@
+/*!
+[config]
+name: atom_int32_xchg global
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer int[2] -4 1
+arg_in:  0 buffer int[2]  1 0
+arg_in:  1 int           -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer int[2] 4 2
+arg_in:  0 buffer int[2] 2 0
+arg_in:  1 int           4
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] -1
+arg_out: 1 buffer int[8] -1 0 1 2 3 4 5 6
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 9
+arg_out: 1 buffer int[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) { \
+	int 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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global.cl
new file mode 100644
index 000000000..0117c557b
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-global.cl
@@ -0,0 +1,67 @@
+/*!
+[config]
+name: atom_int32_xchg global
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] 1
+arg_in:  1 int           -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+arg_out: 0 buffer int[1] 4
+arg_in:  0 buffer int[1] 2
+arg_in:  1 int           4
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[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) { \
+	int 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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-local.cl
new file mode 100644
index 000000000..14c9c8b87
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_xchg-local.cl
@@ -0,0 +1,76 @@
+/*!
+[config]
+name: atom_int32_xchg local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_base_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 5
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -4
+arg_in:  3 int           5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 5
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           4
+arg_in:  3 uint           5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  1 buffer uint[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) { \
+	int 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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global-return.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global-return.cl
new file mode 100644
index 000000000..a6b84c6b5
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global-return.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: atom_int32_xor global, with usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -7 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1        int    -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 12 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1        uint    10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in:  0 buffer int[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global.cl
new file mode 100644
index 000000000..d56cbf891
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-global.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atom_int32_xor global, no usage of return variable
+clc_version_min: 10
+require_device_extensions: cl_khr_global_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -7
+arg_in:  0 buffer int[1]  5
+arg_in:  1        int    -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 12
+arg_in:  0 buffer uint[1]  6
+arg_in:  1        uint    10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] -7
+arg_in:  0 buffer int[1] -7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-local.cl b/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-local.cl
new file mode 100644
index 000000000..387e5023b
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_int32_xor-local.cl
@@ -0,0 +1,72 @@
+/*!
+[config]
+name: atom_int32_xor local
+clc_version_min: 10
+require_device_extensions: cl_khr_local_int32_extended_atomics
+
+[test]
+name: simple int
+kernel_name: simple_int
+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 int[2] -4 0xfffffff9
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int           -4
+arg_in:  3 int           5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 1
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint           4
+arg_in:  3 uint           5
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  1 buffer uint[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(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.13.5



More information about the Piglit mailing list