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>
12 /* e^x = 2^(x * log2l(e)) */
15 /* I added the following ugly construct because expl(+-Inf) resulted
16 in NaN. The ugliness results from the bright minds at Intel.
17 For the i686 the code can be written better.
18 -- drepper@cygnus.com. */
19 fxam /* Is NaN or +-Inf? */
24 je 1f /* Is +-Inf, jump. */
26 fmulp /* x * log2(e) */
28 frndint /* int(x * log2(e)) */
29 fsubr %st,%st(1) /* fract(x * log2(e)) */
31 f2xm1 /* 2^(fract(x * log2(e))) - 1 */
33 faddp /* 2^(fract(x * log2(e))) */
38 1: testl $0x200, %eax /* Test sign. */
39 jz 2f /* If positive, jump. */
41 fldz /* Set result to 0. */