2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
6 * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
9 #include <machine/asm.h>
17 ASM_TYPE_DIRECTIVE(one,@object)
19 ASM_SIZE_DIRECTIVE(one)
20 /* It is not important that this constant is precise. It is only
21 a value which is known to be on the safe side for using the
22 fyl2xp1 instruction. */
23 ASM_TYPE_DIRECTIVE(limit,@object)
25 ASM_SIZE_DIRECTIVE(limit)
29 #define MO(op) op##@GOTOFF(%edx)
39 addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
44 fsub %st(2), %st // x-1 : x : 1
45 fld %st // x-1 : x-1 : x : 1
46 fabs // |x-1| : x-1 : x : 1
47 fcompl MO(limit) // x-1 : x : 1
51 fstp %st(1) // x-1 : 1
55 2: fstp %st(0) // x : 1
59 weak_alias (__log2l, log2l)