]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/x86_64/fpu/e_logl.S
[BZ #2510, BZ #2830, BZ #3137, BZ #3313, BZ #3426, BZ #3465, BZ #3480, BZ #3483,...
[thirdparty/glibc.git] / sysdeps / x86_64 / fpu / e_logl.S
CommitLineData
c9cf6dde
AJ
1/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 *
5 * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
6 * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
7 */
8
9#include <machine/asm.h>
10
11RCSID("$NetBSD: $")
12
13
14#ifdef __ELF__
15 .section .rodata
16#else
17 .text
18#endif
19 .align ALIGNARG(4)
20 ASM_TYPE_DIRECTIVE(one,@object)
21one: .double 1.0
22 ASM_SIZE_DIRECTIVE(one)
23 /* It is not important that this constant is precise. It is only
24 a value which is known to be on the safe side for using the
25 fyl2xp1 instruction. */
26 ASM_TYPE_DIRECTIVE(limit,@object)
27limit: .double 0.29
28 ASM_SIZE_DIRECTIVE(limit)
29
30
31#ifdef PIC
32#define MO(op) op##(%rip)
33#else
34#define MO(op) op
35#endif
36
37 .text
38ENTRY(__ieee754_logl)
39 fldln2 // log(2)
40 fldt 8(%rsp) // x : log(2)
41 fld %st // x : x : log(2)
11bf311e 42 fsubl MO(one) // x-1 : x : log(2)
c9cf6dde
AJ
43 fld %st // x-1 : x-1 : x : log(2)
44 fabs // |x-1| : x-1 : x : log(2)
45 fcompl MO(limit) // x-1 : x : log(2)
46 fnstsw // x-1 : x : log(2)
47 andb $0x45, %ah
48 jz 2f
49 fstp %st(1) // x-1 : log(2)
50 fyl2xp1 // log(x)
51 ret
52
532: fstp %st(0) // x : log(2)
54 fyl2x // log(x)
55 ret
56END (__ieee754_logl)