]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/fpu/e_logf.S
.
[thirdparty/glibc.git] / sysdeps / i386 / fpu / e_logf.S
CommitLineData
d38cd08c
UD
1/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 * Adapted for float by Ulrich Drepper <drepper@cygnus.com>.
5 *
6 * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
7 */
8
9#include <machine/asm.h>
10
11RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
12
13#ifdef __ELF__
14 .section .rodata
15#else
16 .text
17#endif
18 .align ALIGNARG(4)
19 ASM_TYPE_DIRECTIVE(one,@object)
20one: .double 1.0
21 ASM_SIZE_DIRECTIVE(one)
22 /* It is not important that this constant is precise. It is only
23 a value which is known to be on the safe side for using the
24 fyl2xp1 instruction. */
25 ASM_TYPE_DIRECTIVE(limit,@object)
26limit: .double 0.29
27 ASM_SIZE_DIRECTIVE(limit)
28
29
30#ifdef PIC
31#define MO(op) op##@GOTOFF(%edx)
32#else
33#define MO(op) op
34#endif
35
36 .text
37ENTRY(__ieee754_logf)
38 fldln2 // log(2)
39 flds 4(%esp) // x : log(2)
32c075e1
JJ
40 fxam
41 fnstsw
d38cd08c 42#ifdef PIC
fee732e5 43 LOAD_PIC_REG (dx)
d38cd08c
UD
44#endif
45 fld %st // x : x : log(2)
32c075e1
JJ
46 sahf
47 jc 3f // in case x is NaN or +-Inf
484: fsubl MO(one) // x-1 : x : log(2)
d38cd08c
UD
49 fld %st // x-1 : x-1 : x : log(2)
50 fabs // |x-1| : x-1 : x : log(2)
51 fcompl MO(limit) // x-1 : x : log(2)
52 fnstsw // x-1 : x : log(2)
0d8733c4
UD
53 andb $0x45, %ah
54 jz 2f
d38cd08c
UD
55 fstp %st(1) // x-1 : log(2)
56 fyl2xp1 // log(x)
57 ret
58
6bc31da0 592: fstp %st(0) // x : log(2)
d38cd08c
UD
60 fyl2x // log(x)
61 ret
32c075e1
JJ
62
633: jp 4b // in case x is +-Inf
64 fstp %st(1)
65 fstp %st(1)
66 ret
d38cd08c 67END (__ieee754_logf)