[Libclc-dev] [PATCH 04/14] amdgpu: Add workaround for unimplemented llvm.exp intrinsic

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Fri Nov 3 16:07:16 PDT 2017


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 amdgpu/lib/SOURCES             | 1 +
 amdgpu/lib/math/native_exp.cl  | 5 +++++
 amdgpu/lib/math/native_exp.inc | 3 +++
 3 files changed, 9 insertions(+)
 create mode 100644 amdgpu/lib/math/native_exp.cl
 create mode 100644 amdgpu/lib/math/native_exp.inc

diff --git a/amdgpu/lib/SOURCES b/amdgpu/lib/SOURCES
index 59d8b22..20322ec 100644
--- a/amdgpu/lib/SOURCES
+++ b/amdgpu/lib/SOURCES
@@ -1,3 +1,4 @@
+math/native_exp.cl
 math/native_log.cl
 math/native_log10.cl
 math/nextafter.cl
diff --git a/amdgpu/lib/math/native_exp.cl b/amdgpu/lib/math/native_exp.cl
new file mode 100644
index 0000000..71c9a2e
--- /dev/null
+++ b/amdgpu/lib/math/native_exp.cl
@@ -0,0 +1,5 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <native_exp.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
diff --git a/amdgpu/lib/math/native_exp.inc b/amdgpu/lib/math/native_exp.inc
new file mode 100644
index 0000000..c61ec01
--- /dev/null
+++ b/amdgpu/lib/math/native_exp.inc
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp(__CLC_GENTYPE val) {
+  return native_exp2(val * M_LOG2E_F);
+}
-- 
2.13.6



More information about the Libclc-dev mailing list