]>
Commit | Line | Data |
---|---|---|
ee188d55 RM |
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 | */ | |
7 | ||
8 | #include <machine/asm.h> | |
9 | ||
d38cd08c UD |
10 | |
11 | #ifdef __ELF__ | |
0ac5ae23 | 12 | .section .rodata.cst8,"aM",@progbits,8 |
d38cd08c UD |
13 | #else |
14 | .text | |
15 | #endif | |
0ac5ae23 | 16 | .p2align 3 |
d38cd08c UD |
17 | ASM_TYPE_DIRECTIVE(one,@object) |
18 | one: .double 1.0 | |
19 | ASM_SIZE_DIRECTIVE(one) | |
20 | /* It is not important that this constant is precise. It is only | |
21 | a value which is known to be on the safe side for using the | |
22 | fyl2xp1 instruction. */ | |
23 | ASM_TYPE_DIRECTIVE(limit,@object) | |
24 | limit: .double 0.29 | |
25 | ASM_SIZE_DIRECTIVE(limit) | |
26 | ||
27 | ||
28 | #ifdef PIC | |
0ac5ae23 | 29 | # define MO(op) op##@GOTOFF(%edx) |
d38cd08c | 30 | #else |
0ac5ae23 | 31 | # define MO(op) op |
d38cd08c UD |
32 | #endif |
33 | ||
34 | .text | |
ee188d55 | 35 | ENTRY(__ieee754_logl) |
d38cd08c UD |
36 | fldln2 // log(2) |
37 | fldt 4(%esp) // x : log(2) | |
6b2665f5 UD |
38 | fxam |
39 | fnstsw | |
d38cd08c | 40 | #ifdef PIC |
fee732e5 | 41 | LOAD_PIC_REG (dx) |
d38cd08c UD |
42 | #endif |
43 | fld %st // x : x : log(2) | |
6b2665f5 UD |
44 | sahf |
45 | jc 3f // in case x is NaN or +-Inf | |
46 | 4: fsubl MO(one) // x-1 : x : log(2) | |
d38cd08c UD |
47 | fld %st // x-1 : x-1 : x : log(2) |
48 | fabs // |x-1| : x-1 : x : log(2) | |
49 | fcompl MO(limit) // x-1 : x : log(2) | |
50 | fnstsw // x-1 : x : log(2) | |
0d8733c4 UD |
51 | andb $0x45, %ah |
52 | jz 2f | |
d38cd08c UD |
53 | fstp %st(1) // x-1 : log(2) |
54 | fyl2xp1 // log(x) | |
55 | ret | |
56 | ||
6bc31da0 | 57 | 2: fstp %st(0) // x : log(2) |
d38cd08c | 58 | fyl2x // log(x) |
ee188d55 | 59 | ret |
6b2665f5 UD |
60 | |
61 | 3: jp 4b // in case x is +-Inf | |
62 | fstp %st(1) | |
63 | fstp %st(1) | |
64 | ret | |
d38cd08c | 65 | END (__ieee754_logl) |
0ac5ae23 | 66 | strong_alias (__ieee754_logl, __logl_finite) |