summaryrefslogtreecommitdiff
path: root/kernels/compiler_sqrt_div.cl
diff options
context:
space:
mode:
authorrander <rander.wang@intel.com>2017-05-19 16:14:40 +0800
committerYang Rong <rong.r.yang@intel.com>2017-06-09 19:45:55 +0800
commit8ed276000efe129481ba0f83643bf5a8a2389309 (patch)
treee5842940f1923da76127619609b517ce871ded80 /kernels/compiler_sqrt_div.cl
parent0fd1ef5a1643973c1369b203ce596729e00da8ec (diff)
utests: add utest for sqrt-div optimization
Signed-off-by: rander.wang <rander.wang@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'kernels/compiler_sqrt_div.cl')
-rw-r--r--kernels/compiler_sqrt_div.cl8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernels/compiler_sqrt_div.cl b/kernels/compiler_sqrt_div.cl
new file mode 100644
index 00000000..7d5a2f08
--- /dev/null
+++ b/kernels/compiler_sqrt_div.cl
@@ -0,0 +1,8 @@
+kernel void compiler_sqrt_div(global float *src, global float *dst) {
+ int i = get_global_id(0);
+ float tmp = sqrt(src[i]);
+ dst[i*4] = 1.0f/tmp;
+ dst[i*4+1] = (float)i/tmp;
+ dst[i*4+2] = 2.0f/tmp;
+ dst[i*4+3] = 1.0f/tmp + tmp;
+};