[libclc] r316588 - math: Implement native_log10

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 09:49:22 PDT 2017


Author: jvesely
Date: Wed Oct 25 09:49:22 2017
New Revision: 316588

URL: http://llvm.org/viewvc/llvm-project?rev=316588&view=rev
Log:
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>

Added:
    libclc/trunk/amdgpu/lib/math/native_log10.cl
    libclc/trunk/amdgpu/lib/math/native_log10.inc
    libclc/trunk/generic/include/clc/math/native_log10.h
    libclc/trunk/generic/include/clc/math/native_log10.inc
    libclc/trunk/generic/lib/math/native_log10.cl
    libclc/trunk/generic/lib/math/native_log10.inc
Modified:
    libclc/trunk/amdgpu/lib/SOURCES
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/amdgpu/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES?rev=316588&r1=316587&r2=316588&view=diff
==============================================================================
--- libclc/trunk/amdgpu/lib/SOURCES (original)
+++ libclc/trunk/amdgpu/lib/SOURCES Wed Oct 25 09:49:22 2017
@@ -1,3 +1,4 @@
 math/native_log.cl
+math/native_log10.cl
 math/nextafter.cl
 math/sqrt.cl

Added: libclc/trunk/amdgpu/lib/math/native_log10.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_log10.cl?rev=316588&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/math/native_log10.cl (added)
+++ libclc/trunk/amdgpu/lib/math/native_log10.cl Wed Oct 25 09:49:22 2017
@@ -0,0 +1,5 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <native_log10.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>

Added: libclc/trunk/amdgpu/lib/math/native_log10.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_log10.inc?rev=316588&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/math/native_log10.inc (added)
+++ libclc/trunk/amdgpu/lib/math/native_log10.inc Wed Oct 25 09:49:22 2017
@@ -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);
+}

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=316588&r1=316587&r2=316588&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Oct 25 09:49:22 2017
@@ -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>

Added: libclc/trunk/generic/include/clc/math/native_log10.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log10.h?rev=316588&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_log10.h (added)
+++ libclc/trunk/generic/include/clc/math/native_log10.h Wed Oct 25 09:49:22 2017
@@ -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

Added: libclc/trunk/generic/include/clc/math/native_log10.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log10.inc?rev=316588&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_log10.inc (added)
+++ libclc/trunk/generic/include/clc/math/native_log10.inc Wed Oct 25 09:49:22 2017
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE native_log10(__CLC_GENTYPE a);

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=316588&r1=316587&r2=316588&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Oct 25 09:49:22 2017
@@ -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

Added: libclc/trunk/generic/lib/math/native_log10.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log10.cl?rev=316588&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/native_log10.cl (added)
+++ libclc/trunk/generic/lib/math/native_log10.cl Wed Oct 25 09:49:22 2017
@@ -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>

Added: libclc/trunk/generic/lib/math/native_log10.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_log10.inc?rev=316588&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/native_log10.inc (added)
+++ libclc/trunk/generic/lib/math/native_log10.inc Wed Oct 25 09:49:22 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log10(__CLC_GENTYPE val) {
+  return __clc_native_log10(val);
+}




More information about the cfe-commits mailing list