test case for OpenCL 1.1 conversion & type casting
authorHomer Hsing <homer.xing@intel.com>
Thu, 22 Nov 2012 00:50:28 +0000 (08:50 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Fri, 29 Mar 2013 10:41:33 +0000 (18:41 +0800)
kernels/compiler_type_casting.cl [new file with mode: 0644]
utests/compiler_type_casting.cpp [new file with mode: 0644]

diff --git a/kernels/compiler_type_casting.cl b/kernels/compiler_type_casting.cl
new file mode 100644 (file)
index 0000000..3cdb925
--- /dev/null
@@ -0,0 +1,19 @@
+/* test OpenCL 1.1 Conversions & Type Casting Examples (section 6.2) */
+__kernel void compiler_type_casting() {
+  float f = 1.23456789f;
+  float g;
+
+  g = (float)f;
+  g = convert_float(f);
+  g = as_float(f);
+  
+  g = convert_float_rte(f);
+  g = convert_float_rtz(f);
+  g = convert_float_rtp(f);
+  g = convert_float_rtn(f);
+
+  g = convert_float_sat_rte(f);
+  g = convert_float_sat_rtz(f);
+  g = convert_float_sat_rtp(f);
+  g = convert_float_sat_rtn(f);
+}
diff --git a/utests/compiler_type_casting.cpp b/utests/compiler_type_casting.cpp
new file mode 100644 (file)
index 0000000..392acf4
--- /dev/null
@@ -0,0 +1,10 @@
+#include "utest_helper.hpp"
+
+void compiler_type_casting(void)
+{
+  OCL_CREATE_KERNEL("compiler_type_casting");
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_type_casting);
+
+