native_exp10: Switch implementation to llvm intrinsic
authorJan Vesely <jan.vesely@rutgers.edu>
Fri, 10 Nov 2017 22:16:41 +0000 (22:16 +0000)
committerJan Vesely <jan.vesely@rutgers.edu>
Fri, 10 Nov 2017 22:16:41 +0000 (22:16 +0000)
v2: Use native_log2 instead of wrong constant

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317941

libclc/generic/include/clc/math/native_exp10.h
libclc/generic/lib/SOURCES
libclc/generic/lib/math/native_exp10.cl [new file with mode: 0644]
libclc/generic/lib/math/native_exp10.inc [new file with mode: 0644]

index 1156f58..4cd8123 100644 (file)
@@ -1 +1,9 @@
-#define native_exp10 exp10
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION native_exp10
+#define __FLOAT_ONLY
+
+#include <clc/math/gentype.inc>
+
+#undef __FLOAT_ONLY
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
index a230d38..2b31465 100644 (file)
@@ -121,6 +121,7 @@ math/mad.cl
 math/modf.cl
 math/native_cos.cl
 math/native_exp.cl
+math/native_exp10.cl
 math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl
diff --git a/libclc/generic/lib/math/native_exp10.cl b/libclc/generic/lib/math/native_exp10.cl
new file mode 100644 (file)
index 0000000..77959a7
--- /dev/null
@@ -0,0 +1,5 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <native_exp10.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/native_exp10.inc b/libclc/generic/lib/math/native_exp10.inc
new file mode 100644 (file)
index 0000000..b82a650
--- /dev/null
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp10(__CLC_GENTYPE val) {
+  return native_exp2(val * native_log2(10));
+}