2 * Written by J.T. Conklin <jtc@netbsd.org>.
5 * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
8 #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 fldt 4(%esp) // x : log(2)
40 fld %st // x : x : log(2)
42 jc 3f // in case x is NaN or +-Inf
43 movzwl 4+8(%esp), %eax
45 jae 6f // x <= -2, avoid overflow from -LDBL_MAX - 1.
46 4: fsubl MO(one) // x-1 : x : log(2)
47 6: fld %st // x-1 : x-1 : x : log(2)
48 fabs // |x-1| : x-1 : x : log(2)
49 fcompl MO(limit) // x-1 : x : log(2)
50 fnstsw // x-1 : x : log(2)
58 fabs // log(1) is +0 in all rounding modes.
59 5: fstp %st(1) // x-1 : log(2)
63 2: fstp %st(0) // x : log(2)
67 3: jp 4b // in case x is +-Inf
76 fldt 4(%esp) // x : log(2)
80 fld %st // x : x : log(2)
81 fsubl MO(one) // x-1 : x : log(2)
82 fld %st // x-1 : x-1 : x : log(2)
83 fabs // |x-1| : x-1 : x : log(2)
84 fcompl MO(limit) // x-1 : x : log(2)
85 fnstsw // x-1 : x : log(2)
93 fabs // log(1) is +0 in all rounding modes.
94 7: fstp %st(1) // x-1 : log(2)