[Libclc-dev] [PATCH 13/14] half_divide: Implement using native_divide
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Fri Nov 3 18:32:38 PDT 2017
Passes CTS on carrizo
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
generic/include/clc/clc.h | 1 +
generic/include/clc/math/half_divide.h | 7 +++++++
generic/lib/SOURCES | 1 +
generic/lib/math/half_divide.cl | 6 ++++++
generic/lib/math/half_native_binary.inc | 11 +++++++++++
5 files changed, 26 insertions(+)
create mode 100644 generic/include/clc/math/half_divide.h
create mode 100644 generic/lib/math/half_divide.cl
create mode 100644 generic/lib/math/half_native_binary.inc
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 029d89b..538c94f 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -71,6 +71,7 @@
#include <clc/math/fract.h>
#include <clc/math/frexp.h>
#include <clc/math/half_cos.h>
+#include <clc/math/half_divide.h>
#include <clc/math/half_exp.h>
#include <clc/math/half_exp10.h>
#include <clc/math/half_exp2.h>
diff --git a/generic/include/clc/math/half_divide.h b/generic/include/clc/math/half_divide.h
new file mode 100644
index 0000000..84096b9
--- /dev/null
+++ b/generic/include/clc/math/half_divide.h
@@ -0,0 +1,7 @@
+#define __CLC_BODY <clc/math/binary_decl_tt.inc>
+#define __CLC_FUNCTION half_divide
+
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index e63b439..83ed527 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -105,6 +105,7 @@ math/fmod.cl
math/fract.cl
math/frexp.cl
math/half_cos.cl
+math/half_divide.cl
math/half_exp.cl
math/half_exp10.cl
math/half_exp2.cl
diff --git a/generic/lib/math/half_divide.cl b/generic/lib/math/half_divide.cl
new file mode 100644
index 0000000..131e415
--- /dev/null
+++ b/generic/lib/math/half_divide.cl
@@ -0,0 +1,6 @@
+#include <clc/clc.h>
+
+#define __CLC_FUNC divide
+#define __CLC_BODY <half_native_binary.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
diff --git a/generic/lib/math/half_native_binary.inc b/generic/lib/math/half_native_binary.inc
new file mode 100644
index 0000000..04e3bfb
--- /dev/null
+++ b/generic/lib/math/half_native_binary.inc
@@ -0,0 +1,11 @@
+#include <utils.h>
+
+#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
+#define __CLC_NATIVE_FUNC(x) __CLC_CONCAT(native_, x)
+
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE x, __CLC_GENTYPE y) {
+ return __CLC_NATIVE_FUNC(__CLC_FUNC)(x, y);
+}
+
+#undef __CLC_NATIVE_FUNC
+#undef __CLC_HALF_FUNC
--
2.13.6
More information about the Libclc-dev
mailing list