initial commit
[glibc.git] / sysdeps / i386 / fpu / s_log1pf.S
1 /*
2 * Public domain.
3 */
4
5 #include <machine/asm.h>
6 #include <i386-math-asm.h>
7
8 RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $")
9
10 .section .rodata
11
12 .align ALIGNARG(4)
13 /* The fyl2xp1 can only be used for values in
14 -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
15 0.29 is a safe value.
16 */
17 limit: .float 0.29
18 one: .float 1.0
19
20 DEFINE_FLT_MIN
21
22 #ifdef PIC
23 # define MO(op) op##@GOTOFF(%edx)
24 #else
25 # define MO(op) op
26 #endif
27
28 /*
29 * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
30 * otherwise fyl2x with the needed extra computation.
31 */
32 .text
33 ENTRY(__log1pf)
34 fldln2
35
36 flds 4(%esp)
37
38 #ifdef PIC
39 LOAD_PIC_REG (dx)
40 #endif
41
42 fxam
43 fnstsw
44 fld %st
45 sahf
46 jc 3f // in case x is NaN or ±Inf
47 4: fabs
48 fcomps MO(limit)
49 fnstsw
50 sahf
51 jc 2f
52
53 fadds MO(one)
54 fyl2x
55 ret
56
57 2: fyl2xp1
58 FLT_CHECK_FORCE_UFLOW_NONNAN
59 ret
60
61 3: jp 4b // in case x is ±Inf
62 fstp %st(1)
63 fstp %st(1)
64 ret
65
66 END (__log1pf)