From 995ddeba7b8c55aa09424349cbee759bcecf5a5d Mon Sep 17 00:00:00 2001 From: Homer Hsing Date: Thu, 22 Nov 2012 08:50:28 +0800 Subject: [PATCH] test case for OpenCL 1.1 conversion & type casting --- kernels/compiler_type_casting.cl | 19 +++++++++++++++++++ utests/compiler_type_casting.cpp | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 kernels/compiler_type_casting.cl create mode 100644 utests/compiler_type_casting.cpp diff --git a/kernels/compiler_type_casting.cl b/kernels/compiler_type_casting.cl new file mode 100644 index 0000000..3cdb925 --- /dev/null +++ b/kernels/compiler_type_casting.cl @@ -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 index 0000000..392acf4 --- /dev/null +++ b/utests/compiler_type_casting.cpp @@ -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); + + -- 2.7.4