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