summaryrefslogtreecommitdiff
path: root/utests
diff options
context:
space:
mode:
Diffstat (limited to 'utests')
-rw-r--r--utests/CMakeLists.txt1
-rw-r--r--utests/compiler_load_bool_imm.cpp28
2 files changed, 29 insertions, 0 deletions
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 4fa315b4..fe1f6fed 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -87,6 +87,7 @@ set (utests_sources
compiler_insn_selection_min.cpp
compiler_insn_selection_max.cpp
compiler_insn_selection_masked_min_max.cpp
+ compiler_load_bool_imm.cpp
compiler_global_memory_barrier.cpp
compiler_local_memory_two_ptr.cpp
compiler_local_memory_barrier.cpp
diff --git a/utests/compiler_load_bool_imm.cpp b/utests/compiler_load_bool_imm.cpp
new file mode 100644
index 00000000..47ae9ade
--- /dev/null
+++ b/utests/compiler_load_bool_imm.cpp
@@ -0,0 +1,28 @@
+#include "utest_helper.hpp"
+
+static void compiler_load_bool_imm(void)
+{
+ const size_t n = 1024;
+ const size_t local_size = 16;
+ const int copiesPerWorkItem = 5;
+
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("compiler_load_bool_imm");
+ OCL_CREATE_BUFFER(buf[0], 0, n * copiesPerWorkItem * sizeof(uint32_t), NULL);
+ OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+ OCL_SET_ARG(1, local_size*copiesPerWorkItem*sizeof(int), NULL); // 16 x int
+ OCL_SET_ARG(2, sizeof(int), &copiesPerWorkItem); // 16 x int
+
+ // Run the kernel
+ globals[0] = n;
+ locals[0] = local_size;
+ OCL_NDRANGE(1);
+ OCL_MAP_BUFFER(0);
+
+ // Check results
+ int *dst = (int*)buf_data[0];
+ for (uint32_t i = 0; i < n * copiesPerWorkItem; i++)
+ OCL_ASSERT(dst[i] == copiesPerWorkItem);
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_load_bool_imm);