Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / i386 / fpu / s_log1pl.S
blobd2d5d3bc7ce64053b35ca11e98b882eb9354dc03
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  */
8 #include <machine/asm.h>
10 RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
12         .section .rodata
14         .align ALIGNARG(4)
15         /* The fyl2xp1 can only be used for values in
16                 -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
17            0.29 is a safe value.
18         */
19 limit:  .tfloat 0.29
20         /* Please note:  we use a double value here.  Since 1.0 has
21            an exact representation this does not effect the accuracy
22            but it helps to optimize the code.  */
23 one:    .double 1.0
26  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
27  * otherwise fyl2x with the needed extra computation.
28  */
29         .text
30 ENTRY(__log1pl)
31         fldln2
33         fldt    4(%esp)
35 #ifdef PIC
36         LOAD_PIC_REG (dx)
37 #endif
39         fxam
40         fnstsw
41         fld     %st
42         sahf
43         jc      3f              // in case x is NaN or ±Inf
45         fabs
46 #ifdef PIC
47         fldt    limit@GOTOFF(%edx)
48 #else
49         fldt    limit
50 #endif
51         fcompp
52         fnstsw
53         sahf
54         jnc     2f
56         movzwl  4+8(%esp), %eax
57         xorb    $0x80, %ah
58         cmpl    $0xc040, %eax
59         jae     5f
61 #ifdef PIC
62         faddl   one@GOTOFF(%edx)
63 #else
64         faddl   one
65 #endif
66 5:      fyl2x
67         ret
69 2:      fyl2xp1
70         ret
72 3:      jp      4b              // in case x is ±Inf
73         fstp    %st(1)
74         fstp    %st(1)
75         ret
77 END (__log1pl)
78 weak_alias (__log1pl, log1pl)