[libclc] r322899 - half_divide: Implement using x/y

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 13:12:06 PST 2018


Author: jvesely
Date: Thu Jan 18 13:12:06 2018
New Revision: 322899

URL: http://llvm.org/viewvc/llvm-project?rev=322899&view=rev
Log:
half_divide: Implement using x/y

Passes CTS on carrizo
v2: Use full precision implementation

Reviewer: Jeroen Ketema <j.ketema at xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>

Added:
    libclc/trunk/generic/include/clc/math/half_divide.h
    libclc/trunk/generic/lib/math/half_binary.inc
    libclc/trunk/generic/lib/math/half_divide.cl
Modified:
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=322899&r1=322898&r2=322899&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu Jan 18 13:12:06 2018
@@ -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>

Added: libclc/trunk/generic/include/clc/math/half_divide.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/half_divide.h?rev=322899&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/half_divide.h (added)
+++ libclc/trunk/generic/include/clc/math/half_divide.h Thu Jan 18 13:12:06 2018
@@ -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

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=322899&r1=322898&r2=322899&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Thu Jan 18 13:12:06 2018
@@ -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

Added: libclc/trunk/generic/lib/math/half_binary.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/half_binary.inc?rev=322899&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/half_binary.inc (added)
+++ libclc/trunk/generic/lib/math/half_binary.inc Thu Jan 18 13:12:06 2018
@@ -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

Added: libclc/trunk/generic/lib/math/half_divide.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/half_divide.cl?rev=322899&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/half_divide.cl (added)
+++ libclc/trunk/generic/lib/math/half_divide.cl Thu Jan 18 13:12:06 2018
@@ -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




More information about the cfe-commits mailing list