[libclc] 57/92: math: Implement native_log10
Andreas Boll
aboll-guest at moszumanska.debian.org
Mon Nov 6 15:12:01 UTC 2017
This is an automated email from the git hooks/post-receive script.
aboll-guest pushed a commit to branch master
in repository libclc.
commit 2930d003faad29d8e8903c80e272fef98b060edb
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date: Wed Oct 25 16:49:22 2017 +0000
math: Implement native_log10
Use llvm instrinsic by default
Provide amdgpu workaround
v2: drop old amd copyrights
Reviewer: Aaron Watry
Reviewed-by: Vedran Miletić <vedran at miletic.net>
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@316588 91177308-0d34-0410-b5e6-96231b3b80d8
---
amdgpu/lib/SOURCES | 1 +
amdgpu/lib/math/native_log10.cl | 5 +++++
amdgpu/lib/math/native_log10.inc | 3 +++
generic/include/clc/clc.h | 1 +
generic/include/clc/math/native_log10.h | 5 +++++
generic/include/clc/math/native_log10.inc | 1 +
generic/lib/SOURCES | 1 +
generic/lib/math/native_log10.cl | 10 ++++++++++
generic/lib/math/native_log10.inc | 3 +++
9 files changed, 30 insertions(+)
diff --git a/amdgpu/lib/SOURCES b/amdgpu/lib/SOURCES
index 8cbe1d4..59d8b22 100644
--- a/amdgpu/lib/SOURCES
+++ b/amdgpu/lib/SOURCES
@@ -1,3 +1,4 @@
math/native_log.cl
+math/native_log10.cl
math/nextafter.cl
math/sqrt.cl
diff --git a/amdgpu/lib/math/native_log10.cl b/amdgpu/lib/math/native_log10.cl
new file mode 100644
index 0000000..2e7c11e
--- /dev/null
+++ b/amdgpu/lib/math/native_log10.cl
@@ -0,0 +1,5 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <native_log10.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
diff --git a/amdgpu/lib/math/native_log10.inc b/amdgpu/lib/math/native_log10.inc
new file mode 100644
index 0000000..96b1a0a
--- /dev/null
+++ b/amdgpu/lib/math/native_log10.inc
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log10(__CLC_GENTYPE val) {
+ return native_log2(val) * (M_LN2_F / M_LN10_F);
+}
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 3701336..5d64751 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -104,6 +104,7 @@
#include <clc/math/native_exp10.h>
#include <clc/math/native_exp2.h>
#include <clc/math/native_log.h>
+#include <clc/math/native_log10.h>
#include <clc/math/native_log2.h>
#include <clc/math/native_powr.h>
#include <clc/math/native_recip.h>
diff --git a/generic/include/clc/math/native_log10.h b/generic/include/clc/math/native_log10.h
new file mode 100644
index 0000000..b877efd
--- /dev/null
+++ b/generic/include/clc/math/native_log10.h
@@ -0,0 +1,5 @@
+#define __CLC_BODY <clc/math/native_log10.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
+#undef __CLC_BODY
+#undef __FLOAT_ONLY
diff --git a/generic/include/clc/math/native_log10.inc b/generic/include/clc/math/native_log10.inc
new file mode 100644
index 0000000..ce5a994
--- /dev/null
+++ b/generic/include/clc/math/native_log10.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE native_log10(__CLC_GENTYPE a);
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index ededcdb..7f09f9a 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -120,6 +120,7 @@ math/logb.cl
math/mad.cl
math/modf.cl
math/native_log.cl
+math/native_log10.cl
math/native_log2.cl
math/tables.cl
math/clc_nextafter.cl
diff --git a/generic/lib/math/native_log10.cl b/generic/lib/math/native_log10.cl
new file mode 100644
index 0000000..9741daa
--- /dev/null
+++ b/generic/lib/math/native_log10.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+#define __CLC_FUNCTION __clc_native_log10
+#define __CLC_INTRINSIC "llvm.log10"
+#undef cl_khr_fp64
+#include <clc/math/unary_intrin.inc>
+
+#define __CLC_BODY <native_log10.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
diff --git a/generic/lib/math/native_log10.inc b/generic/lib/math/native_log10.inc
new file mode 100644
index 0000000..a2f3d1a
--- /dev/null
+++ b/generic/lib/math/native_log10.inc
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log10(__CLC_GENTYPE val) {
+ return __clc_native_log10(val);
+}
--
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