Get rid of ASM_TYPE_DIRECTIVE{,_PREFIX}.
[platform/upstream/glibc.git] / sysdeps / i386 / fpu / e_logf.S
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  * Adapted for float by Ulrich Drepper <drepper@cygnus.com>.
5  *
6  * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
7  */
8
9 #include <machine/asm.h>
10
11         .section .rodata.cst8,"aM",@progbits,8
12
13         .p2align 3
14         .type one,@object
15 one:    .double 1.0
16         ASM_SIZE_DIRECTIVE(one)
17         /* It is not important that this constant is precise.  It is only
18            a value which is known to be on the safe side for using the
19            fyl2xp1 instruction.  */
20         .type limit,@object
21 limit:  .double 0.29
22         ASM_SIZE_DIRECTIVE(limit)
23
24
25 #ifdef PIC
26 # define MO(op) op##@GOTOFF(%edx)
27 #else
28 # define MO(op) op
29 #endif
30
31         .text
32 ENTRY(__ieee754_logf)
33         fldln2                  // log(2)
34         flds    4(%esp)         // x : log(2)
35         fxam
36         fnstsw
37 #ifdef PIC
38         LOAD_PIC_REG (dx)
39 #endif
40         fld     %st             // x : x : log(2)
41         sahf
42         jc      3f              // in case x is NaN or +-Inf
43 4:      fsubl   MO(one)         // x-1 : x : log(2)
44         fld     %st             // x-1 : x-1 : x : log(2)
45         fabs                    // |x-1| : x-1 : x : log(2)
46         fcompl  MO(limit)       // x-1 : x : log(2)
47         fnstsw                  // x-1 : x : log(2)
48         andb    $0x45, %ah
49         jz      2f
50         fstp    %st(1)          // x-1 : log(2)
51         fyl2xp1                 // log(x)
52         ret
53
54 2:      fstp    %st(0)          // x : log(2)
55         fyl2x                   // log(x)
56         ret
57
58 3:      jp      4b              // in case x is +-Inf
59         fstp    %st(1)
60         fstp    %st(1)
61         ret
62 END (__ieee754_logf)
63
64 ENTRY(__logf_finite)
65         fldln2                  // log(2)
66         flds    4(%esp)         // x : log(2)
67 #ifdef PIC
68         LOAD_PIC_REG (dx)
69 #endif
70         fld     %st             // x : x : log(2)
71         fsubl   MO(one)         // x-1 : x : log(2)
72         fld     %st             // x-1 : x-1 : x : log(2)
73         fabs                    // |x-1| : x-1 : x : log(2)
74         fcompl  MO(limit)       // x-1 : x : log(2)
75         fnstsw                  // x-1 : x : log(2)
76         andb    $0x45, %ah
77         jz      2b
78         fstp    %st(1)          // x-1 : log(2)
79         fyl2xp1                 // log(x)
80         ret
81 END(__logf_finite)