]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/fpu/e_atanh.S
INSTALL: regenerate
[thirdparty/glibc.git] / sysdeps / i386 / fpu / e_atanh.S
CommitLineData
d38cd08c 1/* ix87 specific implementation of arctanh function.
dff8da6b 2 Copyright (C) 1996-2024 Free Software Foundation, Inc.
d38cd08c 3 This file is part of the GNU C Library.
d38cd08c
UD
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
d38cd08c
UD
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
d38cd08c 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
d38cd08c
UD
18
19#include <machine/asm.h>
37825319 20#include <i386-math-asm.h>
220622dd 21#include <libm-alias-finite.h>
d38cd08c 22
d38cd08c 23 .section .rodata
d38cd08c
UD
24
25 .align ALIGNARG(4)
b67e9372 26 .type half,@object
d38cd08c
UD
27half: .double 0.5
28 ASM_SIZE_DIRECTIVE(half)
b67e9372 29 .type one,@object
d38cd08c
UD
30one: .double 1.0
31 ASM_SIZE_DIRECTIVE(one)
b67e9372 32 .type limit,@object
d38cd08c
UD
33limit: .double 0.29
34 ASM_SIZE_DIRECTIVE(limit)
b67e9372 35 .type ln2_2,@object
114e299c
AZ
36ln2_2: .quad 0xb17217f7d1cf79ac /* 0.3465735902799726547086160 */
37 .short 0x3ffd
d38cd08c
UD
38 ASM_SIZE_DIRECTIVE(ln2_2)
39
37825319 40DEFINE_DBL_MIN
8020a808 41
d38cd08c
UD
42#ifdef PIC
43#define MO(op) op##@GOTOFF(%edx)
44#else
45#define MO(op) op
46#endif
47
48 .text
49ENTRY(__ieee754_atanh)
50 movl 8(%esp), %ecx
51
15daa639
UD
52 movl %ecx, %eax
53 andl $0x7fffffff, %eax
54 cmpl $0x7ff00000, %eax
55 jae 5f
567:
57
d38cd08c 58#ifdef PIC
1a19b889 59 LOAD_PIC_REG (dx)
d38cd08c
UD
60#endif
61
62 andl $0x80000000, %ecx // ECX == 0 iff X >= 0
63
64 fldt MO(ln2_2) // 0.5*ln2
65 xorl %ecx, 8(%esp)
66 fldl 4(%esp) // |x| : 0.5*ln2
67 fcoml MO(half) // |x| : 0.5*ln2
68 fld %st // |x| : |x| : 0.5*ln2
69 fnstsw // |x| : |x| : 0.5*ln2
70 sahf
71 jae 2f
72 fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
73 fld %st // |x| : |x| : 2*|x| : 0.5*ln2
74 fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
75 fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
76 fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
77 fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
78 faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
79 fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
80 fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
81 sahf
82 jae 4f
83 fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
37825319
JM
84 DBL_CHECK_FORCE_UFLOW_NONNEG
85 jecxz 3f
d38cd08c
UD
86 fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
873: ret
88
89 .align ALIGNARG(4)
904: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
91 fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
92 jecxz 3f
93 fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
943: ret
95
96 .align ALIGNARG(4)
972: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
98 fxch // |x| : 1+|x| : 0.5*ln2
99 fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
100 fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
101 fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
102 jecxz 3f
103 fchs // 0.5*ln2*ld((1+x)/(1-x))
1043: ret
15daa639
UD
105
106