MIPSr6/math: Use builtin fma and fmaf
[glibc.git] / sysdeps / i386 / fpu / s_log1p.S
blob10e0d2ceabe239e874617bfa1d3a1ca7790437f4
1 /*
2  * Public domain.
3  */
5 #include <machine/asm.h>
6 #include <i386-math-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
20 DEFINE_DBL_MIN
22 #ifdef PIC
23 # define MO(op) op##@GOTOFF(%edx)
24 #else
25 # define MO(op) op
26 #endif
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(__log1p)
34         fldln2
36         fldl    4(%esp)
38 #ifdef  PIC
39         LOAD_PIC_REG (dx)
40 #endif
42         fxam
43         fnstsw
44         fld     %st
45         sahf
46         jc      3f              // in case x is NaN or ±Inf
47 4:      fabs
48         fcompl  MO(limit)
49         fnstsw
50         sahf
51         jc      2f
53         faddl   MO(one)
54         fyl2x
55         ret
57 2:      fyl2xp1
58         DBL_CHECK_FORCE_UFLOW_NONNAN
59         ret
61 3:      jp      4b              // in case x is ±Inf
62         fstp    %st(1)
63         fstp    %st(1)
64         ret
66 END (__log1p)