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 RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
18 ASM_TYPE_DIRECTIVE(one,@object)
20 ASM_SIZE_DIRECTIVE(one)
21 /* It is not important that this constant is precise. It is only
22 a value which is known to be on the safe side for using the
23 fyl2xp1 instruction. */
24 ASM_TYPE_DIRECTIVE(limit,@object)
26 ASM_SIZE_DIRECTIVE(limit)
30 #define MO(op) op##@GOTOFF(%edx)
38 fldl 4(%esp) // x : log(2)
42 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
44 fld %st // x : x : log(2)
45 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)