2 * Written by J.T. Conklin <jtc@netbsd.org>.
4 * Adapted for float by Ulrich Drepper <drepper@cygnus.com>.
6 * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
9 #include <machine/asm.h>
11 .section .rodata.cst8,"aM",@progbits,8
16 ASM_SIZE_DIRECTIVE(one)
17 /* It is not important that this constant is precise. It is only
18 a value which is known to be on the safe side for using the
19 fyl2xp1 instruction. */
22 ASM_SIZE_DIRECTIVE(limit)
26 # define MO(op) op##@GOTOFF(%edx)
34 flds 4(%esp) // x : log(2)
40 fld %st // x : x : log(2)
42 jc 3f // in case x is NaN or +-Inf
43 4: fsubl MO(one) // x-1 : x : log(2)
44 fld %st // x-1 : x-1 : x : log(2)
45 fabs // |x-1| : x-1 : x : log(2)
46 fcompl MO(limit) // x-1 : x : log(2)
47 fnstsw // x-1 : x : log(2)
50 fstp %st(1) // x-1 : log(2)
54 2: fstp %st(0) // x : log(2)
58 3: jp 4b // in case x is +-Inf
66 flds 4(%esp) // x : log(2)
70 fld %st // x : x : log(2)
71 fsubl MO(one) // x-1 : x : log(2)
72 fld %st // x-1 : x-1 : x : log(2)
73 fabs // |x-1| : x-1 : x : log(2)
74 fcompl MO(limit) // x-1 : x : log(2)
75 fnstsw // x-1 : x : log(2)
78 fstp %st(1) // x-1 : log(2)