i386: ulp update for SSE2 --disable-multi-arch configurations
[glibc.git] / sysdeps / i386 / fpu / s_log1pl.S
blob86aa438f0177c5ebe50153a52e90f2c82983713f
1 /*
2  * Public domain.
3  *
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:  .quad   0x947ae147ae147ae1 /* 0.29  */
18         .short  0x3ffd
19         /* Please note:  we use a double value here.  Since 1.0 has
20            an exact representation this does not effect the accuracy
21            but it helps to optimize the code.  */
22 one:    .double 1.0
24 #ifdef PIC
25 # define MO(op) op##@GOTOFF(%edx)
26 #else
27 # define MO(op) op
28 #endif
31  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
32  * otherwise fyl2x with the needed extra computation.
33  */
34         .text
35 ENTRY(__log1pl)
36         fldln2
38         fldt    4(%esp)
40 #ifdef PIC
41         LOAD_PIC_REG (dx)
42 #endif
44         fxam
45         fnstsw
46         fld     %st
47         sahf
48         jc      3f              // in case x is NaN or ±Inf
50         fabs
51         fldt    MO(limit)
52         fcompp
53         fnstsw
54         sahf
55         jnc     2f
57         movzwl  4+8(%esp), %eax
58         xorb    $0x80, %ah
59         cmpl    $0xc040, %eax
60         jae     5f
62         faddl   MO(one)
63 5:      fyl2x
64         ret
66 2:      fyl2xp1
67         ret
69 3:      jp      4b              // in case x is ±Inf
70         fstp    %st(1)
71         fstp    %st(1)
72         fadd    %st(0)
73         ret
75 END (__log1pl)