summaryrefslogtreecommitdiffstats
path: root/libclc/generic
diff options
context:
space:
mode:
authorJan Vesely <jan.vesely@rutgers.edu>2018-01-18 21:11:58 +0000
committerJan Vesely <jan.vesely@rutgers.edu>2018-01-18 21:11:58 +0000
commit398108b91e0a7fa01d8216406bc6a0c6f1e2ff43 (patch)
tree1e816cc715b4e7aa1e7cfe461c850d8ddc0633d4 /libclc/generic
parenta1aba44ffa742e02b0b0cc555d8359d456402fc2 (diff)
downloadbcm5719-llvm-398108b91e0a7fa01d8216406bc6a0c6f1e2ff43.tar.gz
bcm5719-llvm-398108b91e0a7fa01d8216406bc6a0c6f1e2ff43.zip
half_recip: Implement using 1/x
Passes CTS on carrizo v2: Use full precision implementation Reviewer: Jeroen Ketema <j.ketema@xs4all.nl> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 322896
Diffstat (limited to 'libclc/generic')
-rw-r--r--libclc/generic/include/clc/clc.h1
-rw-r--r--libclc/generic/include/clc/math/half_recip.h9
-rw-r--r--libclc/generic/lib/SOURCES1
-rw-r--r--libclc/generic/lib/math/half_recip.cl10
4 files changed, 21 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h
index a52ed5d3d2b..8be8b38d471 100644
--- a/libclc/generic/include/clc/clc.h
+++ b/libclc/generic/include/clc/clc.h
@@ -77,6 +77,7 @@
#include <clc/math/half_log.h>
#include <clc/math/half_log10.h>
#include <clc/math/half_log2.h>
+#include <clc/math/half_recip.h>
#include <clc/math/half_rsqrt.h>
#include <clc/math/half_sqrt.h>
#include <clc/math/hypot.h>
diff --git a/libclc/generic/include/clc/math/half_recip.h b/libclc/generic/include/clc/math/half_recip.h
new file mode 100644
index 00000000000..17f4ba81c93
--- /dev/null
+++ b/libclc/generic/include/clc/math/half_recip.h
@@ -0,0 +1,9 @@
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION half_recip
+#define __FLOAT_ONLY
+
+#include <clc/math/gentype.inc>
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES
index 11a4ca8e3d7..ee28690a257 100644
--- a/libclc/generic/lib/SOURCES
+++ b/libclc/generic/lib/SOURCES
@@ -111,6 +111,7 @@ math/half_exp2.cl
math/half_log.cl
math/half_log10.cl
math/half_log2.cl
+math/half_recip.cl
math/half_rsqrt.cl
math/half_sqrt.cl
math/hypot.cl
diff --git a/libclc/generic/lib/math/half_recip.cl b/libclc/generic/lib/math/half_recip.cl
new file mode 100644
index 00000000000..c0b5c00c5e3
--- /dev/null
+++ b/libclc/generic/lib/math/half_recip.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+#define recip(x) (1.0f/x)
+
+#define __CLC_FUNC recip
+#define __CLC_BODY <half_unary.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
+
+#undef recip
OpenPOWER on IntegriCloud