[Libclc-dev] [PATCH 1/1] math: Don't use llvm instrinsic for native_log

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Wed Sep 27 11:54:53 PDT 2017


AMDGPU targets don't have instruction for it so needs to be expanded to C * log2 anyway.

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
Even when https://reviews.llvm.org/D29942 it will fix the problem only
for latest llvm. We might as well do it in libclc.

 generic/lib/math/native_log.cl  | 5 -----
 generic/lib/math/native_log.inc | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/generic/lib/math/native_log.cl b/generic/lib/math/native_log.cl
index f64f012..f8ba08f 100644
--- a/generic/lib/math/native_log.cl
+++ b/generic/lib/math/native_log.cl
@@ -22,11 +22,6 @@
 
 #include <clc/clc.h>
 
-#define __CLC_FUNCTION __clc_native_log
-#define __CLC_INTRINSIC "llvm.log"
-#undef cl_khr_fp64
-#include <clc/math/unary_intrin.inc>
-
 #define __CLC_BODY <native_log.inc>
 #define __FLOAT_ONLY
 #include <clc/math/gentype.inc>
diff --git a/generic/lib/math/native_log.inc b/generic/lib/math/native_log.inc
index cb4db3f..738f6e0 100644
--- a/generic/lib/math/native_log.inc
+++ b/generic/lib/math/native_log.inc
@@ -21,5 +21,5 @@
  */
 
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log(__CLC_GENTYPE val) {
-  return __clc_native_log(val);
+  return log(val);
 }
-- 
2.13.5



More information about the Libclc-dev mailing list