]>
Commit | Line | Data |
---|---|---|
f7eac6eb RM |
1 | /* |
2 | * Written by J.T. Conklin <jtc@netbsd.org>. | |
3 | * Public domain. | |
4 | */ | |
5 | ||
6 | #include <machine/asm.h> | |
7 | ||
8 | RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") | |
9 | ||
d38cd08c UD |
10 | #ifdef __ELF__ |
11 | .section .rodata | |
12 | #else | |
13 | .text | |
14 | #endif | |
15 | .align ALIGNARG(4) | |
16 | /* The fyl2xp1 can only be used for values in | |
17 | -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 | |
18 | 0.29 is a safe value. | |
19 | */ | |
20 | limit: .double 0.29 | |
21 | one: .double 1.0 | |
22 | ||
f7eac6eb | 23 | /* |
d38cd08c UD |
24 | * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, |
25 | * otherwise fyl2x with the needed extra computation. | |
f7eac6eb | 26 | */ |
d38cd08c | 27 | .text |
f7eac6eb RM |
28 | ENTRY(__log1p) |
29 | fldln2 | |
d38cd08c UD |
30 | |
31 | fldl 4(%esp) | |
32 | ||
33 | #ifdef PIC | |
34 | call 1f | |
35 | 1: popl %edx | |
36 | addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx | |
37 | #endif | |
38 | ||
39 | fld %st | |
40 | fabs | |
41 | #ifdef PIC | |
42 | fcompl limit@GOTOFF(%edx) | |
43 | #else | |
44 | fcompl limit | |
45 | #endif | |
46 | fnstsw | |
47 | sahf | |
48 | jc 2f | |
49 | ||
50 | #ifdef PIC | |
51 | faddl one@GOTOFF(%edx) | |
52 | #else | |
53 | faddl one | |
54 | #endif | |
f7eac6eb RM |
55 | fyl2x |
56 | ret | |
d38cd08c UD |
57 | |
58 | 2: fyl2xp1 | |
59 | ret | |
60 | ||
61 | END (__log1p) | |
f7eac6eb | 62 | weak_alias (__log1p, log1p) |