Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / i386 / fpu / s_log1p.S
blob797a2abf625f3d04387e9cda6383aa551e4effb9
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
6 #include <machine/asm.h>
8 RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
10         .section .rodata
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:  .double 0.29
18 one:    .double 1.0
21  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
22  * otherwise fyl2x with the needed extra computation.
23  */
24         .text
25 ENTRY(__log1p)
26         fldln2
28         fldl    4(%esp)
30 #ifdef  PIC
31         LOAD_PIC_REG (dx)
32 #endif
34         fxam
35         fnstsw
36         fld     %st
37         sahf
38         jc      3f              // in case x is NaN or ±Inf
39 4:      fabs
40 #ifdef PIC
41         fcompl  limit@GOTOFF(%edx)
42 #else
43         fcompl  limit
44 #endif
45         fnstsw
46         sahf
47         jc      2f
49 #ifdef PIC
50         faddl   one@GOTOFF(%edx)
51 #else
52         faddl   one
53 #endif
54         fyl2x
55         ret
57 2:      fyl2xp1
58         ret
60 3:      jp      4b              // in case x is ±Inf
61         fstp    %st(1)
62         fstp    %st(1)
63         ret
65 END (__log1p)
66 weak_alias (__log1p, log1p)