[Libclc-dev] [PATCH 08/11] trunc: Remove llvm intrinsic from the header.
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Tue Mar 12 10:11:05 PDT 2019
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
generic/include/clc/math/trunc.h | 10 ++++------
generic/lib/SOURCES | 1 +
generic/lib/math/trunc.cl | 10 ++++++++++
3 files changed, 15 insertions(+), 6 deletions(-)
create mode 100644 generic/lib/math/trunc.cl
diff --git a/generic/include/clc/math/trunc.h b/generic/include/clc/math/trunc.h
index d34f661..e8cc1f8 100644
--- a/generic/include/clc/math/trunc.h
+++ b/generic/include/clc/math/trunc.h
@@ -1,9 +1,7 @@
-#undef trunc
-#define trunc __clc_trunc
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION trunc
-#define __CLC_FUNCTION __clc_trunc
-#define __CLC_INTRINSIC "llvm.trunc"
-#include <clc/math/unary_intrin.inc>
+#include <clc/math/gentype.inc>
+#undef __CLC_BODY
#undef __CLC_FUNCTION
-#undef __CLC_INTRINSIC
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index a54aa8a..df7f68f 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -189,6 +189,7 @@ math/tanh.cl
math/clc_tanpi.cl
math/tanpi.cl
math/tgamma.cl
+math/trunc.cl
misc/shuffle.cl
misc/shuffle2.cl
relational/all.cl
diff --git a/generic/lib/math/trunc.cl b/generic/lib/math/trunc.cl
new file mode 100644
index 0000000..930bf78
--- /dev/null
+++ b/generic/lib/math/trunc.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+// Map the llvm intrinsic to an OpenCL function.
+#define __CLC_FUNCTION __clc_trunc
+#define __CLC_INTRINSIC "llvm.trunc"
+#include <clc/math/unary_intrin.inc>
+
+#undef __CLC_FUNCTION
+#define __CLC_FUNCTION trunc
+#include "unary_builtin.inc"
--
2.19.2
More information about the Libclc-dev
mailing list