summaryrefslogtreecommitdiff
path: root/utests/compiler_insert_to_constant.cpp
diff options
context:
space:
mode:
authorBenjamin Segovia <benjamin.segovia@intel.com>2012-11-02 18:42:03 -0700
committerBenjamin Segovia <benjamin.segovia@intel.com>2012-11-02 18:42:03 -0700
commitacf533c95233de265e127c60e3bbdc0f73d0439d (patch)
tree296ca223b8a549722796f9b6c6d11803e0b1e5df /utests/compiler_insert_to_constant.cpp
parent4c5a0cfb128318adfdbc6d87cf77689584ee5bfb (diff)
downloadbeignet-acf533c95233de265e127c60e3bbdc0f73d0439d.tar.gz
Add support for insertion into vector of constants
Diffstat (limited to 'utests/compiler_insert_to_constant.cpp')
-rw-r--r--utests/compiler_insert_to_constant.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/utests/compiler_insert_to_constant.cpp b/utests/compiler_insert_to_constant.cpp
new file mode 100644
index 00000000..c4f737fa
--- /dev/null
+++ b/utests/compiler_insert_to_constant.cpp
@@ -0,0 +1,30 @@
+#include "utest_helper.hpp"
+
+void compiler_insert_to_constant(void)
+{
+ const size_t n = 32;
+
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("compiler_insert_to_constant");
+ OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(uint32_t[4]), NULL);
+ OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+
+ // Run the kernel
+ globals[0] = n;
+ locals[0] = 16;
+ OCL_NDRANGE(1);
+ OCL_MAP_BUFFER(0);
+
+ // Check results
+ uint32_t *data = (uint32_t*) buf_data[0];
+ for (uint32_t i = 0; i < n; ++i) {
+ OCL_ASSERT(data[4*i+0] == 0);
+ OCL_ASSERT(data[4*i+1] == 1);
+ OCL_ASSERT(data[4*i+2] == i);
+ OCL_ASSERT(data[4*i+3] == 3);
+ }
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_insert_to_constant);
+
+