summaryrefslogtreecommitdiff
path: root/utests/compiler_function_argument3.cpp
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@intel.com>2013-11-05 13:55:27 +0800
committerZhigang Gong <zhigang.gong@intel.com>2013-11-06 11:06:06 +0800
commit270bd283c26fa79d8ea3b714004d7f0bbe863465 (patch)
treef71ec7938b852f720ef156d469cda427822cfa08 /utests/compiler_function_argument3.cpp
parent7dcf5a6c052e2a5402e92809661a52dc30a9e8fa (diff)
downloadbeignet-270bd283c26fa79d8ea3b714004d7f0bbe863465.tar.gz
utests: add test case for structure argument
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'utests/compiler_function_argument3.cpp')
-rw-r--r--utests/compiler_function_argument3.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/utests/compiler_function_argument3.cpp b/utests/compiler_function_argument3.cpp
new file mode 100644
index 00000000..e9f5e809
--- /dev/null
+++ b/utests/compiler_function_argument3.cpp
@@ -0,0 +1,45 @@
+#include "utest_helper.hpp"
+
+struct sfloat8 {
+ float a;
+ float b;
+ float c;
+ float d;
+ float e;
+ float f;
+ float g;
+ float h;
+};
+
+void compiler_function_argument3(void)
+{
+ sfloat8 arg6;
+
+ arg6.a = 3.0f;
+ arg6.h = 4.0f;
+
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("compiler_function_argument3");
+ OCL_CREATE_BUFFER(buf[0], 0, sizeof(struct sfloat8) * 8, NULL);
+
+ OCL_SET_ARG(0, sizeof(arg6), &arg6);
+ OCL_SET_ARG(1, sizeof(cl_mem), &buf[0]);
+
+ // Run the kernel
+ globals[0] = 1;
+ locals[0] = 1;
+ OCL_NDRANGE(1);
+
+ OCL_MAP_BUFFER(0);
+
+ /* Check results */
+ sfloat8 *dst = (sfloat8*)buf_data[0];
+
+ OCL_ASSERT(dst[0].a == 3.0f);
+ OCL_ASSERT(dst[0].b == 12.0f);
+ OCL_ASSERT(dst[0].h == 7.0f);
+
+ OCL_UNMAP_BUFFER(0);
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_function_argument3);