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