[libclc] 24/291: Add rsqrt builtin. Based on patch by Cassie Epps!

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit a9652818973fd27ac904b60dabe12d75ab192ff9
Author: Peter Collingbourne <peter at pcc.me.uk>
Date:   Tue Aug 21 10:48:35 2012 +0000

    Add rsqrt builtin.  Based on patch by Cassie Epps!
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@162274 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/clc.h        | 1 +
 generic/include/clc/math/rsqrt.h | 1 +
 test/rsqrt.cl                    | 6 ++++++
 3 files changed, 8 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 4f49760..565b505 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -53,6 +53,7 @@
 #include <clc/math/native_log2.h>
 #include <clc/math/native_sin.h>
 #include <clc/math/native_sqrt.h>
+#include <clc/math/rsqrt.h>
 
 /* 6.11.3 Integer Functions */
 #include <clc/integer/abs.h>
diff --git a/generic/include/clc/math/rsqrt.h b/generic/include/clc/math/rsqrt.h
new file mode 100644
index 0000000..8fd2cbf
--- /dev/null
+++ b/generic/include/clc/math/rsqrt.h
@@ -0,0 +1 @@
+#define rsqrt(x) (1.f/sqrt(x))
diff --git a/test/rsqrt.cl b/test/rsqrt.cl
new file mode 100644
index 0000000..13ad216
--- /dev/null
+++ b/test/rsqrt.cl
@@ -0,0 +1,6 @@
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+__kernel void foo(float4 *x, double4 *y) {
+  x[1] = rsqrt(x[0]);
+  y[1] = rsqrt(y[0]);
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list