[libclc] r316587 - amdgpu/math: Don't use llvm instrinsic for native_log
Jan Vesely via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 25 09:49:17 PDT 2017
Author: jvesely
Date: Wed Oct 25 09:49:17 2017
New Revision: 316587
URL: http://llvm.org/viewvc/llvm-project?rev=316587&view=rev
Log:
amdgpu/math: Don't use llvm instrinsic for native_log
AMDGPU targets don't have insturction for it,
so it'll be expanded to C * log2 anyway.
v2: use native_log2 instead of the more precise sw implementation
v3: move to amdgpu
v4: drop old AMD copyright
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Added:
libclc/trunk/amdgpu/lib/math/native_log.cl
libclc/trunk/amdgpu/lib/math/native_log.inc
Modified:
libclc/trunk/amdgpu/lib/SOURCES
Modified: libclc/trunk/amdgpu/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES?rev=316587&r1=316586&r2=316587&view=diff
==============================================================================
--- libclc/trunk/amdgpu/lib/SOURCES (original)
+++ libclc/trunk/amdgpu/lib/SOURCES Wed Oct 25 09:49:17 2017
@@ -1,2 +1,3 @@
+math/native_log.cl
math/nextafter.cl
math/sqrt.cl
Added: libclc/trunk/amdgpu/lib/math/native_log.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_log.cl?rev=316587&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/math/native_log.cl (added)
+++ libclc/trunk/amdgpu/lib/math/native_log.cl Wed Oct 25 09:49:17 2017
@@ -0,0 +1,5 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <native_log.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
Added: libclc/trunk/amdgpu/lib/math/native_log.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/math/native_log.inc?rev=316587&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/math/native_log.inc (added)
+++ libclc/trunk/amdgpu/lib/math/native_log.inc Wed Oct 25 09:49:17 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log(__CLC_GENTYPE val) {
+ return native_log2(val) * (1.0f / M_LOG2E_F);
+}
More information about the cfe-commits
mailing list