[libclc] r322896 - half_recip: Implement using 1/x

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


Author: jvesely
Date: Thu Jan 18 13:11:58 2018
New Revision: 322896

URL: http://llvm.org/viewvc/llvm-project?rev=322896&view=rev
Log:
half_recip: Implement using 1/x

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_recip.h
    libclc/trunk/generic/lib/math/half_recip.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=322896&r1=322895&r2=322896&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu Jan 18 13:11:58 2018
@@ -77,6 +77,7 @@
 #include <clc/math/half_log.h>
 #include <clc/math/half_log10.h>
 #include <clc/math/half_log2.h>
+#include <clc/math/half_recip.h>
 #include <clc/math/half_rsqrt.h>
 #include <clc/math/half_sqrt.h>
 #include <clc/math/hypot.h>

Added: libclc/trunk/generic/include/clc/math/half_recip.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/half_recip.h?rev=322896&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/half_recip.h (added)
+++ libclc/trunk/generic/include/clc/math/half_recip.h Thu Jan 18 13:11:58 2018
@@ -0,0 +1,9 @@
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION half_recip
+#define __FLOAT_ONLY
+
+#include <clc/math/gentype.inc>
+
+#undef __FLOAT_ONLY
+#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=322896&r1=322895&r2=322896&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Thu Jan 18 13:11:58 2018
@@ -111,6 +111,7 @@ math/half_exp2.cl
 math/half_log.cl
 math/half_log10.cl
 math/half_log2.cl
+math/half_recip.cl
 math/half_rsqrt.cl
 math/half_sqrt.cl
 math/hypot.cl

Added: libclc/trunk/generic/lib/math/half_recip.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/half_recip.cl?rev=322896&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/half_recip.cl (added)
+++ libclc/trunk/generic/lib/math/half_recip.cl Thu Jan 18 13:11:58 2018
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+#define recip(x) (1.0f/x)
+
+#define __CLC_FUNC recip
+#define __CLC_BODY <half_unary.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>
+
+#undef recip




More information about the cfe-commits mailing list