[Libclc-dev] [PATCH 4/4] ptx: Use __clc_nextafter to implement nextafter

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Sun Oct 8 01:55:59 PDT 2017


using clang builtin results in external library call

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 ptx/lib/SOURCES           |  1 +
 ptx/lib/math/nextafter.cl | 10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 ptx/lib/SOURCES
 create mode 100644 ptx/lib/math/nextafter.cl

diff --git a/ptx/lib/SOURCES b/ptx/lib/SOURCES
new file mode 100644
index 0000000..ff5bff2
--- /dev/null
+++ b/ptx/lib/SOURCES
@@ -0,0 +1 @@
+math/nextafter.cl
diff --git a/ptx/lib/math/nextafter.cl b/ptx/lib/math/nextafter.cl
new file mode 100644
index 0000000..5b4521d
--- /dev/null
+++ b/ptx/lib/math/nextafter.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+#include "../lib/clcmacro.h"
+#include <math/clc_nextafter.h>
+
+_CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float)
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+_CLC_DEFINE_BINARY_BUILTIN(double, nextafter, __clc_nextafter, double, double)
+#endif
-- 
2.13.6



More information about the Libclc-dev mailing list