[PATCH] D74016: libclc/r600: Use target specific builtins to implement rsqrt and native_rsqrt

Jan Vesely via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 11:47:19 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG85e2fa44c64e: libclc/r600: Use target specific builtins to implement rsqrt and native_rsqrt (authored by jvesely).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74016/new/

https://reviews.llvm.org/D74016

Files:
  libclc/r600/lib/SOURCES
  libclc/r600/lib/math/native_rsqrt.cl
  libclc/r600/lib/math/rsqrt.cl


Index: libclc/r600/lib/math/rsqrt.cl
===================================================================
--- /dev/null
+++ libclc/r600/lib/math/rsqrt.cl
@@ -0,0 +1,23 @@
+#include <clc/clc.h>
+
+#include "../../../generic/lib/clcmacro.h"
+
+_CLC_OVERLOAD _CLC_DEF float rsqrt(float x)
+{
+    return __builtin_r600_recipsqrt_ieeef(x);
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, rsqrt, float);
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_OVERLOAD _CLC_DEF double rsqrt(double x)
+{
+    return __builtin_r600_recipsqrt_ieee(x);
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, rsqrt, double);
+
+#endif
Index: libclc/r600/lib/math/native_rsqrt.cl
===================================================================
--- /dev/null
+++ libclc/r600/lib/math/native_rsqrt.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+#include "../../../generic/lib/clcmacro.h"
+
+_CLC_OVERLOAD _CLC_DEF float native_rsqrt(float x)
+{
+    return __builtin_r600_recipsqrt_ieeef(x);
+}
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, native_rsqrt, float);
Index: libclc/r600/lib/SOURCES
===================================================================
--- libclc/r600/lib/SOURCES
+++ libclc/r600/lib/SOURCES
@@ -1,5 +1,7 @@
 math/fmax.cl
 math/fmin.cl
+math/native_rsqrt.cl
+math/rsqrt.cl
 synchronization/barrier.cl
 workitem/get_global_offset.cl
 workitem/get_group_id.cl


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74016.243455.patch
Type: text/x-patch
Size: 1419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200209/c0fa317e/attachment.bin>


More information about the llvm-commits mailing list