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)
33 fldl 4(%esp) // x : log(2)
39 fld %st // x : x : log(2)
41 jc 3f // in case x is NaN or +-Inf
42 4: fsubl MO(one) // x-1 : x : log(2)
43 fld %st // x-1 : x-1 : x : log(2)
44 fabs // |x-1| : x-1 : x : log(2)
45 fcompl MO(limit) // x-1 : x : log(2)
46 fnstsw // x-1 : x : log(2)
49 fstp %st(1) // x-1 : log(2)
53 2: fstp %st(0) // x : log(2)
57 3: jp 4b // in case x is +-Inf
65 fldl 4(%esp) // x : log(2)
69 fld %st // x : x : log(2)
70 fsubl MO(one) // x-1 : x : log(2)
71 fld %st // x-1 : x-1 : x : log(2)
72 fabs // |x-1| : x-1 : x : log(2)
73 fcompl MO(limit) // x-1 : x : log(2)
74 fnstsw // x-1 : x : log(2)
77 fstp %st(1) // x-1 : log(2)