]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/fpu/e_atanh.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / i386 / fpu / e_atanh.S
CommitLineData
d38cd08c 1/* ix87 specific implementation of arctanh function.
d4697bc9 2 Copyright (C) 1996-2014 Free Software Foundation, Inc.
d38cd08c
UD
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
5
6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
d38cd08c
UD
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 14 Lesser General Public License for more details.
d38cd08c 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
d38cd08c
UD
19
20#include <machine/asm.h>
21
d38cd08c 22 .section .rodata
d38cd08c
UD
23
24 .align ALIGNARG(4)
b67e9372 25 .type half,@object
d38cd08c
UD
26half: .double 0.5
27 ASM_SIZE_DIRECTIVE(half)
b67e9372 28 .type one,@object
d38cd08c
UD
29one: .double 1.0
30 ASM_SIZE_DIRECTIVE(one)
b67e9372 31 .type limit,@object
d38cd08c
UD
32limit: .double 0.29
33 ASM_SIZE_DIRECTIVE(limit)
b67e9372 34 .type ln2_2,@object
d38cd08c
UD
35ln2_2: .tfloat 0.3465735902799726547086160
36 ASM_SIZE_DIRECTIVE(ln2_2)
37
38#ifdef PIC
39#define MO(op) op##@GOTOFF(%edx)
40#else
41#define MO(op) op
42#endif
43
44 .text
45ENTRY(__ieee754_atanh)
46 movl 8(%esp), %ecx
47
15daa639
UD
48 movl %ecx, %eax
49 andl $0x7fffffff, %eax
50 cmpl $0x7ff00000, %eax
51 jae 5f
527:
53
d38cd08c
UD
54#ifdef PIC
55 call 1f
fee732e5 56 cfi_adjust_cfa_offset (4)
d38cd08c 571: popl %edx
fee732e5 58 cfi_adjust_cfa_offset (-4)
d38cd08c
UD
59 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
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|))
84 jecxz 3f
85 fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
863: ret
87
88 .align ALIGNARG(4)
894: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
90 fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
91 jecxz 3f
92 fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
933: ret
94
95 .align ALIGNARG(4)
962: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
97 fxch // |x| : 1+|x| : 0.5*ln2
98 fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
99 fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
100 fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
101 jecxz 3f
102 fchs // 0.5*ln2*ld((1+x)/(1-x))
1033: ret
15daa639
UD
104
105