diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-10-21 10:51:09 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-12-18 17:24:43 -0300 |
commit | 673e6fe11083760f77001285790b1117b09b2283 (patch) | |
tree | 6363f82c3c251af88c7b84a930586b46b961737e /sysdeps/i386/fpu | |
parent | 66fa7ad437affc64b3a81332d750e6f998b2e343 (diff) | |
download | glibc-673e6fe11083760f77001285790b1117b09b2283.zip glibc-673e6fe11083760f77001285790b1117b09b2283.tar.gz glibc-673e6fe11083760f77001285790b1117b09b2283.tar.bz2 |
math: Use acoshf from CORE-MATH
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic acoshf.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):
Latency master patched improvement
x86_64 61.2471 58.7742 4.04%
x86_64-v2 62.6519 59.0523 5.75%
x86_64-v3 58.7408 50.1393 14.64%
aarch64 24.8580 21.3317 14.19%
power10 17.0469 13.1345 22.95%
reciprocal-throughput master patched improvement
x86_64 16.1618 15.1864 6.04%
x86_64-v2 15.7729 14.7563 6.45%
x86_64-v3 14.1669 11.9568 15.60%
aarch64 10.911 9.5486 12.49%
power10 6.38196 5.06734 20.60%
Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'sysdeps/i386/fpu')
-rw-r--r-- | sysdeps/i386/fpu/e_acoshf.S | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S deleted file mode 100644 index 6eda9dc..0000000 --- a/sysdeps/i386/fpu/e_acoshf.S +++ /dev/null @@ -1,101 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <https://www.gnu.org/licenses/>. */ - -#include <machine/asm.h> -#include <libm-alias-finite.h> - - .section .rodata.cst8,"aM",@progbits,8 - - .p2align 3 - .type one,@object -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - .type limit,@object -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_acoshf) - movl 4(%esp), %ecx - cmpl $0x3f800000, %ecx - jl 5f // < 1 => invalid - fldln2 // log(2) - flds 4(%esp) // x : log(2) - cmpl $0x47000000, %ecx - ja 3f // x > 2^14 -#ifdef PIC - LOAD_PIC_REG (dx) -#endif - cmpl $0x40000000, %ecx - ja 4f // x > 2 - - // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - fsubl MO(one) // x-1 : log(2) - fabs // acosh(1) is +0 in all rounding modes - fld %st // x-1 : x-1 : log(2) - fmul %st(1) // (x-1)^2 : x-1 : log(2) - fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) - fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) - fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) - faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 2f - fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - ret - -2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) - fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) - ret - - // x > 2^14 => y = log(x) + log(2) - .align ALIGNARG(4) -3: fyl2x // log(x) - fldln2 // log(2) : log(x) - faddp // log(x)+log(2) - ret - - // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) - .align ALIGNARG(4) -4: fld %st // x : x : log(2) - fadd %st, %st(1) // x : 2*x : log(2) - fld %st // x : x : 2*x : log(2) - fmul %st(1) // x^2 : x : 2*x : log(2) - fsubl MO(one) // x^2-1 : x : 2*x : log(2) - fsqrt // sqrt(x^2-1) : x : 2*x : log(2) - faddp // x+sqrt(x^2-1) : 2*x : log(2) - fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) - fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) - fyl2x // log(2*x+1/(x+sqrt(x^2-1))) - ret - - // x < 1 (or -NaN) => NaN - .align ALIGNARG(4) -5: flds 4(%esp) - fsub %st - fdiv %st, %st(0) - ret -END(__ieee754_acoshf) -libm_alias_finite (__ieee754_acoshf, __acoshf) |