hurd: fix fcntl visibility
[glibc.git] / sysdeps / x86_64 / fpu / s_log1pl.S
blob947e5e45521e507df03a6980d17d9959aa97989f
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  * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
7  */
9 #include <machine/asm.h>
11 RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
13         .section .rodata
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:  .tfloat 0.29
21         /* Please note:  we use a double value here.  Since 1.0 has
22            an exact representation this does not effect the accuracy
23            but it helps to optimize the code.  */
24 one:    .double 1.0
27  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
28  * otherwise fyl2x with the needed extra computation.
29  */
30 #ifdef PIC
31 #define MO(op) op##(%rip)
32 #else
33 #define MO(op) op
34 #endif
36         .text
37 ENTRY(__log1pl)
38         fldln2
40         fldt    8(%rsp)
42         fxam
43         fnstsw
44         fld     %st
45         testb   $1, %ah
46         jnz     3f              // in case x is NaN or ±Inf
48         fabs
49         fldt    MO(limit)
50         fcompp
51         fnstsw
52         andb    $1,%ah
53         jz      2f
55         movzwl  8+8(%rsp), %eax
56         xorb    $0x80, %ah
57         cmpl    $0xc040, %eax
58         jae     5f
60         faddl   MO(one)
61 5:      fyl2x
62         ret
64 2:      fyl2xp1
65         ret
67 3:      testb   $4, %ah
68         jnz     4b              // in case x is ±Inf
69         fstp    %st(1)
70         fstp    %st(1)
71         fadd    %st(0)
72         ret
74 END (__log1pl)