1 /* ix87 specific implementation of arctanh function.
2 Copyright (C) 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
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
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #include <machine/asm.h>
30 ASM_TYPE_DIRECTIVE(half,@object)
32 ASM_SIZE_DIRECTIVE(half)
33 ASM_TYPE_DIRECTIVE(one,@object)
35 ASM_SIZE_DIRECTIVE(one)
36 ASM_TYPE_DIRECTIVE(limit,@object)
38 ASM_SIZE_DIRECTIVE(limit)
39 ASM_TYPE_DIRECTIVE(ln2_2,@object)
40 ln2_2: .tfloat 0.3465735902799726547086160
41 ASM_SIZE_DIRECTIVE(ln2_2)
44 #define MO(op) op##@GOTOFF(%edx)
50 ENTRY(__ieee754_atanh)
56 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
59 andl $0x80000000, %ecx // ECX == 0 iff X >= 0
61 fldt MO(ln2_2) // 0.5*ln2
63 fldl 4(%esp) // |x| : 0.5*ln2
64 fcoml MO(half) // |x| : 0.5*ln2
65 fld %st // |x| : |x| : 0.5*ln2
66 fnstsw // |x| : |x| : 0.5*ln2
69 fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
70 fld %st // |x| : |x| : 2*|x| : 0.5*ln2
71 fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
72 fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
73 fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
74 fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
75 faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
76 fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
77 fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
80 fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
82 fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
86 4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
87 fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
89 fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
93 2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
94 fxch // |x| : 1+|x| : 0.5*ln2
95 fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
96 fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
97 fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
99 fchs // 0.5*ln2*ld((1+x)/(1-x))