[libclc] 11/291: Implement exp, exp2, log, log2, native_exp, native_exp2, native_log, native_log2. Patch by Joshua Cranmer!

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:27 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 39a6da01aa22695d690177600f41448342345c6a
Author: Peter Collingbourne <peter at pcc.me.uk>
Date:   Tue May 29 00:42:29 2012 +0000

    Implement exp, exp2, log, log2, native_exp, native_exp2, native_log,
    native_log2.  Patch by Joshua Cranmer!
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@157598 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/clc.h              | 8 ++++++++
 generic/include/clc/math/exp.h         | 4 ++++
 generic/include/clc/math/exp2.h        | 6 ++++++
 generic/include/clc/math/log.h         | 4 ++++
 generic/include/clc/math/log2.h        | 6 ++++++
 generic/include/clc/math/native_exp.h  | 1 +
 generic/include/clc/math/native_exp2.h | 1 +
 generic/include/clc/math/native_log.h  | 1 +
 generic/include/clc/math/native_log2.h | 1 +
 9 files changed, 32 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 72e2f23..0e640ba 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -33,11 +33,19 @@
 
 /* 6.11.2 Math Functions */
 #include <clc/math/cos.h>
+#include <clc/math/exp.h>
+#include <clc/math/exp2.h>
 #include <clc/math/fabs.h>
+#include <clc/math/log.h>
+#include <clc/math/log2.h>
 #include <clc/math/sin.h>
 #include <clc/math/sqrt.h>
 #include <clc/math/native_cos.h>
 #include <clc/math/native_divide.h>
+#include <clc/math/native_exp.h>
+#include <clc/math/native_exp2.h>
+#include <clc/math/native_log.h>
+#include <clc/math/native_log2.h>
 #include <clc/math/native_sin.h>
 #include <clc/math/native_sqrt.h>
 
diff --git a/generic/include/clc/math/exp.h b/generic/include/clc/math/exp.h
new file mode 100644
index 0000000..dbc4b84
--- /dev/null
+++ b/generic/include/clc/math/exp.h
@@ -0,0 +1,4 @@
+#undef exp
+
+// exp(x) = exp2(x * log2(e)
+#define exp(val) (__clc_exp2((val) * 1.44269504f))
diff --git a/generic/include/clc/math/exp2.h b/generic/include/clc/math/exp2.h
new file mode 100644
index 0000000..fe91633
--- /dev/null
+++ b/generic/include/clc/math/exp2.h
@@ -0,0 +1,6 @@
+#undef exp2
+#define exp2 __clc_exp2
+
+#define FUNCTION __clc_exp2
+#define INTRINSIC "llvm.exp2"
+#include <clc/math/unary_intrin.inc>
diff --git a/generic/include/clc/math/log.h b/generic/include/clc/math/log.h
new file mode 100644
index 0000000..644f857
--- /dev/null
+++ b/generic/include/clc/math/log.h
@@ -0,0 +1,4 @@
+#undef log
+
+// log(x) = log2(x) * (1/log2(e))
+#define log(val) (__clc_log2(val) * 0.693147181f)
diff --git a/generic/include/clc/math/log2.h b/generic/include/clc/math/log2.h
new file mode 100644
index 0000000..d8a8842
--- /dev/null
+++ b/generic/include/clc/math/log2.h
@@ -0,0 +1,6 @@
+#undef log2
+#define log2 __clc_log2
+
+#define FUNCTION __clc_log2
+#define INTRINSIC "llvm.log2"
+#include <clc/math/unary_intrin.inc>
diff --git a/generic/include/clc/math/native_exp.h b/generic/include/clc/math/native_exp.h
new file mode 100644
index 0000000..e206de6
--- /dev/null
+++ b/generic/include/clc/math/native_exp.h
@@ -0,0 +1 @@
+#define native_exp exp
diff --git a/generic/include/clc/math/native_exp2.h b/generic/include/clc/math/native_exp2.h
new file mode 100644
index 0000000..b675939
--- /dev/null
+++ b/generic/include/clc/math/native_exp2.h
@@ -0,0 +1 @@
+#define native_exp2 exp2
diff --git a/generic/include/clc/math/native_log.h b/generic/include/clc/math/native_log.h
new file mode 100644
index 0000000..7805a39
--- /dev/null
+++ b/generic/include/clc/math/native_log.h
@@ -0,0 +1 @@
+#define native_log log
diff --git a/generic/include/clc/math/native_log2.h b/generic/include/clc/math/native_log2.h
new file mode 100644
index 0000000..0c692ee
--- /dev/null
+++ b/generic/include/clc/math/native_log2.h
@@ -0,0 +1 @@
+#define native_log2 log2

-- 
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