[Libclc-dev] [PATCH v2 13/14] half_divide: Implement using x/y
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Wed Jan 17 15:41:19 PST 2018
Passes CTS on carrizo
v2: Use full precision implementation
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_binary.inc | 9 +++++++++
generic/lib/math/half_divide.cl | 9 +++++++++
5 files changed, 27 insertions(+)
create mode 100644 generic/include/clc/math/half_divide.h
create mode 100644 generic/lib/math/half_binary.inc
create mode 100644 generic/lib/math/half_divide.cl
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 9e4b185..930bbfc 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 c0d1238..9dbd35e 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_binary.inc b/generic/lib/math/half_binary.inc
new file mode 100644
index 0000000..f831b53
--- /dev/null
+++ b/generic/lib/math/half_binary.inc
@@ -0,0 +1,9 @@
+#include <utils.h>
+
+#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x)
+
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE x, __CLC_GENTYPE y) {
+ return __CLC_FUNC(x, y);
+}
+
+#undef __CLC_HALF_FUNC
diff --git a/generic/lib/math/half_divide.cl b/generic/lib/math/half_divide.cl
new file mode 100644
index 0000000..ee9c895
--- /dev/null
+++ b/generic/lib/math/half_divide.cl
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define divide(x,y) (x/y)
+
+#define __CLC_FUNC divide
+#define __CLC_BODY <half_binary.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
+#undef divide
--
2.14.3
More information about the Libclc-dev
mailing list