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>
11 .section .rodata.cst8,"aM",@progbits,8
16 ASM_TYPE_DIRECTIVE(one,@object)
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. */
22 ASM_TYPE_DIRECTIVE(limit,@object)
24 ASM_SIZE_DIRECTIVE(limit)
28 # define MO(op) op##@GOTOFF(%edx)
36 fldl 4(%esp) // x : log(2)
42 fld %st // x : x : log(2)
44 jc 3f // in case x is NaN or +-Inf
45 4: fsubl MO(one) // x-1 : x : log(2)
46 fld %st // x-1 : x-1 : x : log(2)
47 fabs // |x-1| : x-1 : x : log(2)
48 fcompl MO(limit) // x-1 : x : log(2)
49 fnstsw // x-1 : x : log(2)
52 fstp %st(1) // x-1 : log(2)
56 2: fstp %st(0) // x : log(2)
60 3: jp 4b // in case x is +-Inf
65 strong_alias (__ieee754_log, __log_finite)