summaryrefslogtreecommitdiffstats
path: root/libclc/generic/include/clc
diff options
context:
space:
mode:
Diffstat (limited to 'libclc/generic/include/clc')
-rw-r--r--libclc/generic/include/clc/clc.h6
-rw-r--r--libclc/generic/include/clc/clcmacro.h6
-rw-r--r--libclc/generic/include/clc/math/clc_nextafter.h11
-rw-r--r--libclc/generic/include/clc/math/nextafter.h5
4 files changed, 28 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h
index fce9f6edc80..0e87ec78f09 100644
--- a/libclc/generic/include/clc/clc.h
+++ b/libclc/generic/include/clc/clc.h
@@ -45,6 +45,7 @@
#include <clc/math/log.h>
#include <clc/math/log2.h>
#include <clc/math/mad.h>
+#include <clc/math/nextafter.h>
#include <clc/math/pow.h>
#include <clc/math/rint.h>
#include <clc/math/sin.h>
@@ -107,4 +108,9 @@
#include <clc/atomic/atomic_inc.h>
#include <clc/atomic/atomic_sub.h>
+/* libclc internal defintions */
+#ifdef __CLC_INTERNAL
+#include <math/clc_nextafter.h>
+#endif
+
#pragma OPENCL EXTENSION all : disable
diff --git a/libclc/generic/include/clc/clcmacro.h b/libclc/generic/include/clc/clcmacro.h
index ece0d3b67d5..730073ae1f9 100644
--- a/libclc/generic/include/clc/clcmacro.h
+++ b/libclc/generic/include/clc/clcmacro.h
@@ -41,6 +41,12 @@
return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
}
+#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
+_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
+ return BUILTIN(x, y); \
+} \
+_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
+
#define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \
_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \
return BUILTIN(x); \
diff --git a/libclc/generic/include/clc/math/clc_nextafter.h b/libclc/generic/include/clc/math/clc_nextafter.h
new file mode 100644
index 00000000000..81c8f369c3b
--- /dev/null
+++ b/libclc/generic/include/clc/math/clc_nextafter.h
@@ -0,0 +1,11 @@
+#define __CLC_BODY <clc/math/binary_decl.inc>
+
+#define __CLC_FUNCTION nextafter
+#include <clc/math/gentype.inc>
+#undef __CLC_FUNCTION
+
+#define __CLC_FUNCTION __clc_nextafter
+#include <clc/math/gentype.inc>
+#undef __CLC_FUNCTION
+
+#undef __CLC_BODY
diff --git a/libclc/generic/include/clc/math/nextafter.h b/libclc/generic/include/clc/math/nextafter.h
new file mode 100644
index 00000000000..06e1b2a53c5
--- /dev/null
+++ b/libclc/generic/include/clc/math/nextafter.h
@@ -0,0 +1,5 @@
+#define __CLC_BODY <clc/math/binary_decl.inc>
+#define __CLC_FUNCTION nextafter
+#include <clc/math/gentype.inc>
+#undef __CLC_FUNCTION
+#undef __CLC_BODY
OpenPOWER on IntegriCloud