|
Packit |
6c4009 |
/* ix87 specific implementation of arctanh function.
|
|
Packit |
6c4009 |
Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <machine/asm.h>
|
|
Packit |
6c4009 |
#include <i386-math-asm.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.section .rodata
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align ALIGNARG(4)
|
|
Packit |
6c4009 |
.type half,@object
|
|
Packit |
6c4009 |
half: .double 0.5
|
|
Packit |
6c4009 |
ASM_SIZE_DIRECTIVE(half)
|
|
Packit |
6c4009 |
.type one,@object
|
|
Packit |
6c4009 |
one: .double 1.0
|
|
Packit |
6c4009 |
ASM_SIZE_DIRECTIVE(one)
|
|
Packit |
6c4009 |
.type limit,@object
|
|
Packit |
6c4009 |
limit: .double 0.29
|
|
Packit |
6c4009 |
ASM_SIZE_DIRECTIVE(limit)
|
|
Packit |
6c4009 |
.type ln2_2,@object
|
|
Packit |
6c4009 |
ln2_2: .tfloat 0.3465735902799726547086160
|
|
Packit |
6c4009 |
ASM_SIZE_DIRECTIVE(ln2_2)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
DEFINE_DBL_MIN
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef PIC
|
|
Packit |
6c4009 |
#define MO(op) op##@GOTOFF(%edx)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
#define MO(op) op
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
ENTRY(__ieee754_atanh)
|
|
Packit |
6c4009 |
movl 8(%esp), %ecx
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
movl %ecx, %eax
|
|
Packit |
6c4009 |
andl $0x7fffffff, %eax
|
|
Packit |
6c4009 |
cmpl $0x7ff00000, %eax
|
|
Packit |
6c4009 |
jae 5f
|
|
Packit |
6c4009 |
7:
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef PIC
|
|
Packit |
6c4009 |
LOAD_PIC_REG (dx)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
andl $0x80000000, %ecx // ECX == 0 iff X >= 0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
fldt MO(ln2_2) // 0.5*ln2
|
|
Packit |
6c4009 |
xorl %ecx, 8(%esp)
|
|
Packit |
6c4009 |
fldl 4(%esp) // |x| : 0.5*ln2
|
|
Packit |
6c4009 |
fcoml MO(half) // |x| : 0.5*ln2
|
|
Packit |
6c4009 |
fld %st // |x| : |x| : 0.5*ln2
|
|
Packit |
6c4009 |
fnstsw // |x| : |x| : 0.5*ln2
|
|
Packit |
6c4009 |
sahf
|
|
Packit |
6c4009 |
jae 2f
|
|
Packit |
6c4009 |
fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fld %st // |x| : |x| : 2*|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
|
|
Packit |
6c4009 |
faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
|
|
Packit |
6c4009 |
fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
|
|
Packit |
6c4009 |
fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
|
|
Packit |
6c4009 |
sahf
|
|
Packit |
6c4009 |
jae 4f
|
|
Packit |
6c4009 |
fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
|
|
Packit |
6c4009 |
DBL_CHECK_FORCE_UFLOW_NONNEG
|
|
Packit |
6c4009 |
jecxz 3f
|
|
Packit |
6c4009 |
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
|
|
Packit |
6c4009 |
3: ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align ALIGNARG(4)
|
|
Packit |
6c4009 |
4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
|
|
Packit |
6c4009 |
fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
|
|
Packit |
6c4009 |
jecxz 3f
|
|
Packit |
6c4009 |
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
|
|
Packit |
6c4009 |
3: ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.align ALIGNARG(4)
|
|
Packit |
6c4009 |
2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
|
|
Packit |
6c4009 |
fxch // |x| : 1+|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
|
|
Packit |
6c4009 |
fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
|
|
Packit |
6c4009 |
fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
|
|
Packit |
6c4009 |
jecxz 3f
|
|
Packit |
6c4009 |
fchs // 0.5*ln2*ld((1+x)/(1-x))
|
|
Packit |
6c4009 |
3: ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
// x == NaN or ±Inf
|
|
Packit |
6c4009 |
5: ja 6f
|
|
Packit |
6c4009 |
cmpl $0, 4(%esp)
|
|
Packit |
6c4009 |
je 7b
|
|
Packit |
6c4009 |
6: fldl 4(%esp)
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
END(__ieee754_atanh)
|
|
Packit |
6c4009 |
strong_alias (__ieee754_atanh, __atanh_finite)
|