summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/include/clc/clc.h1
-rw-r--r--generic/include/clc/math/rsqrt.h1
-rw-r--r--test/rsqrt.cl6
3 files changed, 8 insertions, 0 deletions
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]);
+}