[libc-commits] [PATCH] D122688: [libc][obvious] fix sqrt when long double is double
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Mar 29 16:06:01 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4ac3f7e41aae: [libc][obvious] fix sqrt when long double is double (authored by michaelrj).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122688/new/
https://reviews.llvm.org/D122688
Files:
libc/src/__support/FPUtil/x86_64/sqrt.h
Index: libc/src/__support/FPUtil/x86_64/sqrt.h
===================================================================
--- libc/src/__support/FPUtil/x86_64/sqrt.h
+++ libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -32,10 +32,18 @@
return result;
}
+#ifdef LONG_DOUBLE_IS_DOUBLE
+template <> inline long double sqrt<long double>(long double x) {
+ long double result;
+ __asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
+ return result;
+}
+#else
template <> inline long double sqrt<long double>(long double x) {
__asm__ __volatile__("fsqrt" : "+t"(x));
return x;
}
+#endif
} // namespace fputil
} // namespace __llvm_libc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122688.419004.patch
Type: text/x-patch
Size: 650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220329/ebc7d802/attachment.bin>
More information about the libc-commits
mailing list