]>
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 | ||
10 | RCSID("$NetBSD: $") | |
11 | ||
d38cd08c UD |
12 | |
13 | #ifdef __ELF__ | |
14 | .section .rodata | |
15 | #else | |
16 | .text | |
17 | #endif | |
18 | .align ALIGNARG(4) | |
19 | ASM_TYPE_DIRECTIVE(one,@object) | |
20 | one: .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) | |
26 | limit: .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 | |
ee188d55 | 37 | ENTRY(__ieee754_logl) |
d38cd08c UD |
38 | fldln2 // log(2) |
39 | fldt 4(%esp) // x : log(2) | |
40 | #ifdef PIC | |
a334319f UD |
41 | call 1f |
42 | 1: popl %edx | |
43 | addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx | |
d38cd08c UD |
44 | #endif |
45 | fld %st // x : x : log(2) | |
a334319f | 46 | 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 |
d38cd08c | 60 | END (__ieee754_logl) |