[libclc] 134/291: Implementations for exp(float) and exp(double) v2
Andreas Beckmann
anbe at moszumanska.debian.org
Tue Sep 8 10:53:42 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 68692023736148c2cca855c21ce37238e81436e7
Author: Jeroen Ketema <j.ketema at imperial.ac.uk>
Date: Fri Jun 13 09:40:09 2014 +0000
Implementations for exp(float) and exp(double) v2
Use separate implementations instead of a macro
to ensure the constant multiplied with is of
higher precision.
v2: Use the correct formula, spotted by Dan Liew <daniel.liew at imperial.ac.uk>
Reviewed-by: Aaron Warty <awatry at gmail.com>
Reviewed-by: Tom Stellard <tom at stellard.net>
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@210891 91177308-0d34-0410-b5e6-96231b3b80d8
---
generic/include/clc/math/exp.h | 9 +++++++--
generic/include/clc/math/gentype.inc | 4 ++++
generic/lib/SOURCES | 1 +
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/generic/include/clc/math/exp.h b/generic/include/clc/math/exp.h
index dbc4b84..9866524 100644
--- a/generic/include/clc/math/exp.h
+++ b/generic/include/clc/math/exp.h
@@ -1,4 +1,9 @@
#undef exp
-// exp(x) = exp2(x * log2(e)
-#define exp(val) (__clc_exp2((val) * 1.44269504f))
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION exp
+
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
diff --git a/generic/include/clc/math/gentype.inc b/generic/include/clc/math/gentype.inc
index bff4f56..9f79f6e 100644
--- a/generic/include/clc/math/gentype.inc
+++ b/generic/include/clc/math/gentype.inc
@@ -1,4 +1,5 @@
#define __CLC_SCALAR_GENTYPE float
+#define __CLC_FPSIZE 32
#define __CLC_GENTYPE float
#define __CLC_SCALAR
@@ -26,10 +27,12 @@
#include __CLC_BODY
#undef __CLC_GENTYPE
+#undef __CLC_FPSIZE
#undef __CLC_SCALAR_GENTYPE
#ifdef cl_khr_fp64
#define __CLC_SCALAR_GENTYPE double
+#define __CLC_FPSIZE 64
#define __CLC_SCALAR
#define __CLC_GENTYPE double
@@ -57,6 +60,7 @@
#include __CLC_BODY
#undef __CLC_GENTYPE
+#undef __CLC_FPSIZE
#undef __CLC_SCALAR_GENTYPE
#endif
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index 6ccdf48..a35542c 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -27,6 +27,7 @@ integer/sub_sat.cl
integer/sub_sat_if.ll
integer/sub_sat_impl.ll
integer/upsample.cl
+math/exp.cl
math/fmax.cl
math/fmin.cl
math/hypot.cl
--
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