From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15098 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] math: move trivial x86-family sqrt functions to C Date: Mon, 6 Jan 2020 19:50:29 +0300 Message-ID: <20200106165029.6232-1-amonakov@ispras.ru> References: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.11.0" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="42618"; mail-complaints-to="usenet@blaine.gmane.org" To: musl@lists.openwall.com Original-X-From: musl-return-15114-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 06 17:50:44 2020 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1ioVaV-000Ay6-F4 for gllmg-musl@m.gmane.org; Mon, 06 Jan 2020 17:50:43 +0100 Original-Received: (qmail 13857 invoked by uid 550); 6 Jan 2020 16:50:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13825 invoked from network); 6 Jan 2020 16:50:40 -0000 X-Mailer: git-send-email 2.11.0 In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:15098 Archived-At: This is a multi-part message in MIME format. --------------2.11.0 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- This does not touch i386 sqrt and sqrtf, which are non-trivial. src/math/i386/sqrtl.c | 7 +++++++ src/math/i386/sqrtl.s | 5 ----- src/math/x86_64/sqrt.c | 7 +++++++ src/math/x86_64/sqrt.s | 4 ---- src/math/x86_64/sqrtf.c | 7 +++++++ src/math/x86_64/sqrtf.s | 4 ---- src/math/x86_64/sqrtl.c | 7 +++++++ src/math/x86_64/sqrtl.s | 5 ----- 8 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 src/math/i386/sqrtl.c delete mode 100644 src/math/i386/sqrtl.s create mode 100644 src/math/x86_64/sqrt.c delete mode 100644 src/math/x86_64/sqrt.s create mode 100644 src/math/x86_64/sqrtf.c delete mode 100644 src/math/x86_64/sqrtf.s create mode 100644 src/math/x86_64/sqrtl.c delete mode 100644 src/math/x86_64/sqrtl.s --------------2.11.0 Content-Type: text/x-patch; name="0003-math-move-trivial-x86-family-sqrt-functions-to-C.patch" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="0003-math-move-trivial-x86-family-sqrt-functions-to-C.patch" diff --git a/src/math/i386/sqrtl.c b/src/math/i386/sqrtl.c new file mode 100644 index 00000000..864cfcc4 --- /dev/null +++ b/src/math/i386/sqrtl.c @@ -0,0 +1,7 @@ +#include + +long double sqrtl(long double x) +{ + __asm__ ("fsqrt" : "+t"(x)); + return x; +} diff --git a/src/math/i386/sqrtl.s b/src/math/i386/sqrtl.s deleted file mode 100644 index e0d42616..00000000 --- a/src/math/i386/sqrtl.s +++ /dev/null @@ -1,5 +0,0 @@ -.global sqrtl -.type sqrtl,@function -sqrtl: fldt 4(%esp) - fsqrt - ret diff --git a/src/math/x86_64/sqrt.c b/src/math/x86_64/sqrt.c new file mode 100644 index 00000000..657e09e3 --- /dev/null +++ b/src/math/x86_64/sqrt.c @@ -0,0 +1,7 @@ +#include + +double sqrt(double x) +{ + __asm__ ("sqrtsd %1, %0" : "=x"(x) : "x"(x)); + return x; +} diff --git a/src/math/x86_64/sqrt.s b/src/math/x86_64/sqrt.s deleted file mode 100644 index d3c609f9..00000000 --- a/src/math/x86_64/sqrt.s +++ /dev/null @@ -1,4 +0,0 @@ -.global sqrt -.type sqrt,@function -sqrt: sqrtsd %xmm0, %xmm0 - ret diff --git a/src/math/x86_64/sqrtf.c b/src/math/x86_64/sqrtf.c new file mode 100644 index 00000000..720baec6 --- /dev/null +++ b/src/math/x86_64/sqrtf.c @@ -0,0 +1,7 @@ +#include + +float sqrtf(float x) +{ + __asm__ ("sqrtss %1, %0" : "=x"(x) : "x"(x)); + return x; +} diff --git a/src/math/x86_64/sqrtf.s b/src/math/x86_64/sqrtf.s deleted file mode 100644 index eec48c60..00000000 --- a/src/math/x86_64/sqrtf.s +++ /dev/null @@ -1,4 +0,0 @@ -.global sqrtf -.type sqrtf,@function -sqrtf: sqrtss %xmm0, %xmm0 - ret diff --git a/src/math/x86_64/sqrtl.c b/src/math/x86_64/sqrtl.c new file mode 100644 index 00000000..864cfcc4 --- /dev/null +++ b/src/math/x86_64/sqrtl.c @@ -0,0 +1,7 @@ +#include + +long double sqrtl(long double x) +{ + __asm__ ("fsqrt" : "+t"(x)); + return x; +} diff --git a/src/math/x86_64/sqrtl.s b/src/math/x86_64/sqrtl.s deleted file mode 100644 index 23cd687d..00000000 --- a/src/math/x86_64/sqrtl.s +++ /dev/null @@ -1,5 +0,0 @@ -.global sqrtl -.type sqrtl,@function -sqrtl: fldt 8(%rsp) - fsqrt - ret --------------2.11.0--