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 RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
19 ASM_TYPE_DIRECTIVE(one,@object)
21 ASM_SIZE_DIRECTIVE(one)
22 /* It is not important that this constant is precise. It is only
23 a value which is known to be on the safe side for using the
24 fyl2xp1 instruction. */
25 ASM_TYPE_DIRECTIVE(limit,@object)
27 ASM_SIZE_DIRECTIVE(limit)
31 #define MO(op) op##@GOTOFF(%edx)
39 flds 4(%esp) // x : log(2)
45 fld %st // x : x : log(2)
47 jc 3f // in case x is NaN or +-Inf
48 4: fsubl MO(one) // x-1 : x : log(2)
49 fld %st // x-1 : x-1 : x : log(2)
50 fabs // |x-1| : x-1 : x : log(2)
51 fcompl MO(limit) // x-1 : x : log(2)
52 fnstsw // x-1 : x : log(2)
55 fstp %st(1) // x-1 : log(2)
59 2: fstp %st(0) // x : log(2)
63 3: jp 4b // in case x is +-Inf