2 * Written by J.T. Conklin <jtc@netbsd.org>.
5 * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
7 * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
8 * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
11 #include <machine/asm.h>
13 .section .rodata.cst8,"aM",@progbits,8
18 ASM_SIZE_DIRECTIVE(one)
19 /* It is not important that this constant is precise. It is only
20 a value which is known to be on the safe side for using the
21 fyl2xp1 instruction. */
24 ASM_SIZE_DIRECTIVE(limit)
28 # define MO(op) op##(%rip)
34 ENTRY(__ieee754_log10l)
36 fldt 8(%rsp) // x : log10(2)
39 fld %st // x : x : log10(2)
41 jnz 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)
54 fabs // log10(1) is +0 in all rounding modes.
55 5: fstp %st(1) // x-1 : log10(2)
59 2: fstp %st(0) // x : log10(2)
64 jnz 4b // in case x is ±Inf
71 ENTRY(__log10l_finite)
73 fldt 8(%rsp) // x : log10(2)
74 fld %st // x : x : log10(2)
75 4: fsubl MO(one) // x-1 : x : log10(2)
76 fld %st // x-1 : x-1 : x : log10(2)
77 fabs // |x-1| : x-1 : x : log10(2)
78 fcompl MO(limit) // x-1 : x : log10(2)
79 fnstsw // x-1 : x : log10(2)
82 fstp %st(1) // x-1 : log10(2)