5 #include <machine/asm.h>
6 #include <i386-math-asm.h>
7 #include <libm-alias-finite.h>
12 # define MO(op) op##@GOTOFF(%ecx)
18 /* e^x = 2^(x * log2(e)) */
24 /* I added the following ugly construct because exp(+-Inf) resulted
25 in NaN. The ugliness results from the bright minds at Intel.
26 For the i686 the code can be written better.
27 -- drepper@cygnus.com. */
28 fxam /* Is NaN or +-Inf? */
33 je 1f /* Is +-Inf, jump. */
35 fmulp /* x * log2(e) */
37 frndint /* int(x * log2(e)) */
38 fsubr %st,%st(1) /* fract(x * log2(e)) */
40 f2xm1 /* 2^(fract(x * log2(e))) - 1 */
42 faddp /* 2^(fract(x * log2(e))) */
45 DBL_NARROW_EVAL_UFLOW_NONNEG_NAN
48 1: testl $0x200, %eax /* Test sign. */
49 jz 2f /* If positive, jump. */
51 fldz /* Set result to 0. */
61 fmull 4(%esp) /* x * log2(e) */
63 frndint /* int(x * log2(e)) */
64 fsubr %st,%st(1) /* fract(x * log2(e)) */
66 f2xm1 /* 2^(fract(x * log2(e))) - 1 */
68 faddp /* 2^(fract(x * log2(e))) */
71 DBL_NARROW_EVAL_UFLOW_NONNEG
74 libm_alias_finite (__exp_finite, __exp)