[Libclc-dev] [PATCH 06/11] rint: Remove llvm intrinsic from the header.

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Tue Mar 12 10:11:02 PDT 2019


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 generic/include/clc/math/rint.h | 11 ++++++-----
 generic/lib/SOURCES             |  1 +
 generic/lib/math/rint.cl        | 10 ++++++++++
 3 files changed, 17 insertions(+), 5 deletions(-)
 create mode 100644 generic/lib/math/rint.cl

diff --git a/generic/include/clc/math/rint.h b/generic/include/clc/math/rint.h
index d257634..d036d3e 100644
--- a/generic/include/clc/math/rint.h
+++ b/generic/include/clc/math/rint.h
@@ -1,6 +1,7 @@
-#undef rint
-#define rint __clc_rint
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION rint
 
-#define __CLC_FUNCTION __clc_rint
-#define __CLC_INTRINSIC "llvm.rint"
-#include <clc/math/unary_intrin.inc>
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index d2ad430..fa50f10 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -172,6 +172,7 @@ math/clc_remainder.cl
 math/remainder.cl
 math/clc_remquo.cl
 math/remquo.cl
+math/rint.cl
 math/clc_rootn.cl
 math/rootn.cl
 math/sin.cl
diff --git a/generic/lib/math/rint.cl b/generic/lib/math/rint.cl
new file mode 100644
index 0000000..eb0a209
--- /dev/null
+++ b/generic/lib/math/rint.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+// Map the llvm intrinsic to an OpenCL function.
+#define __CLC_FUNCTION __clc_rint
+#define __CLC_INTRINSIC "llvm.rint"
+#include <clc/math/unary_intrin.inc>
+
+#undef __CLC_FUNCTION
+#define __CLC_FUNCTION rint
+#include "unary_builtin.inc"
-- 
2.19.2



More information about the Libclc-dev mailing list