2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
4 * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
8 #include <machine/asm.h>
9 #include <x86_64-math-asm.h>
14 # define MO(op) op##(%rip)
20 ENTRY(__ieee754_exp2l)
22 /* I added the following ugly construct because exp(+-Inf) resulted
23 in NaN. The ugliness results from the bright minds at Intel.
24 For the i686 the code can be written better.
25 -- drepper@cygnus.com. */
26 fxam /* Is NaN or +-Inf? */
31 je 1f /* Is +-Inf, jump. */
32 movzwl 8+8(%rsp), %eax
36 /* Argument's exponent below -65, result rounds to 1. */
42 fsubr %st,%st(1) /* fract(x) */
44 f2xm1 /* 2^(fract(x)) - 1 */
46 faddp /* 2^(fract(x)) */
49 LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN
52 1: testl $0x200, %eax /* Test sign. */
53 jz 2f /* If positive, jump. */
55 fldz /* Set result to 0. */
58 strong_alias (__ieee754_exp2l, __exp2l_finite)