
Date: Tue, 7 Jan 2020 16:06:05 +0300
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: [PATCH] math: move i386 sqrt to C

Since union ldshape does not have a dedicated field for 32 least significant
bits of the x87 long double mantissa, keeping the original approach with
ux.i.m = (fpsr & 0x200)  0x100;
would lead to a 64bit subtraction that is not trivial for the compiler to
optimize to 32bit subtraction as done in the original assembly. Therefore
I have elected to change the approach and use
ux.i.m ^= (fpsr & 0x200) + 0x200;
which is easier to optimize to a 32bit rather than 64bit xor.
Thoughts?
src/math/i386/sqrt.c  15 +++++++++++++++
src/math/i386/sqrt.s  21 
2 files changed, 15 insertions(+), 21 deletions()
create mode 100644 src/math/i386/sqrt.c
delete mode 100644 src/math/i386/sqrt.s
View attachment "0005mathmovei386sqrttoC.patch" of type "text/xpatch" (1104 bytes)
Powered by blists  more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.