[libclc] r318065 - native_rsqrt: Switch implementation to 1 / native_sqrt

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 10:28:51 PST 2017


Author: jvesely
Date: Mon Nov 13 10:28:51 2017
New Revision: 318065

URL: http://llvm.org/viewvc/llvm-project?rev=318065&view=rev
Log:
native_rsqrt: Switch implementation to 1 / native_sqrt

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

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

Modified: libclc/trunk/generic/include/clc/math/native_rsqrt.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_rsqrt.h?rev=318065&r1=318064&r2=318065&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_rsqrt.h (original)
+++ libclc/trunk/generic/include/clc/math/native_rsqrt.h Mon Nov 13 10:28:51 2017
@@ -1 +1,9 @@
-#define native_rsqrt rsqrt
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION native_rsqrt
+#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=318065&r1=318064&r2=318065&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Nov 13 10:28:51 2017
@@ -126,6 +126,7 @@ math/native_exp2.cl
 math/native_log.cl
 math/native_log10.cl
 math/native_log2.cl
+math/native_rsqrt.cl
 math/native_sin.cl
 math/native_sqrt.cl
 math/native_tan.cl

Added: libclc/trunk/generic/lib/math/native_rsqrt.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_rsqrt.cl?rev=318065&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/native_rsqrt.cl (added)
+++ libclc/trunk/generic/lib/math/native_rsqrt.cl Mon Nov 13 10:28:51 2017
@@ -0,0 +1,5 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <native_rsqrt.inc>
+#define __FLOAT_ONLY
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/lib/math/native_rsqrt.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/native_rsqrt.inc?rev=318065&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/native_rsqrt.inc (added)
+++ libclc/trunk/generic/lib/math/native_rsqrt.inc Mon Nov 13 10:28:51 2017
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_rsqrt(__CLC_GENTYPE val) {
+  return 1.0f / native_sqrt(val);
+}




More information about the cfe-commits mailing list