2 * Written by J.T. Conklin <jtc@netbsd.org>.
5 * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
8 #include <machine/asm.h>
10 .section .rodata.cst8,"aM",@progbits,8
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. */
21 ASM_SIZE_DIRECTIVE(limit)
25 # define MO(op) op##@GOTOFF(%edx)
31 ENTRY(__ieee754_log10)
33 fldl 4(%esp) // x : log10(2)
39 fld %st // x : x : log10(2)
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)
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)
63 3: jp 4b // in case x is ±Inf
68 strong_alias (__ieee754_log10, __log10_finite)