]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/i386/fpu/e_exp2.S
Remove "Contributed by" lines
[thirdparty/glibc.git] / sysdeps / i386 / fpu / e_exp2.S
1 /*
2 * Public domain.
3 */
4
5 #include <machine/asm.h>
6 #include <i386-math-asm.h>
7 #include <libm-alias-finite.h>
8
9 DEFINE_DBL_MIN
10
11 #ifdef PIC
12 # define MO(op) op##@GOTOFF(%ecx)
13 #else
14 # define MO(op) op
15 #endif
16
17 .text
18 ENTRY(__ieee754_exp2)
19 #ifdef PIC
20 LOAD_PIC_REG (cx)
21 #endif
22 fldl 4(%esp)
23 /* I added the following ugly construct because exp(+-Inf) resulted
24 in NaN. The ugliness results from the bright minds at Intel.
25 For the i686 the code can be written better.
26 -- drepper@cygnus.com. */
27 fxam /* Is NaN or +-Inf? */
28 fstsw %ax
29 movb $0x45, %dh
30 andb %ah, %dh
31 cmpb $0x05, %dh
32 je 1f /* Is +-Inf, jump. */
33 fld %st
34 frndint /* int(x) */
35 fsubr %st,%st(1) /* fract(x) */
36 fxch
37 f2xm1 /* 2^(fract(x)) - 1 */
38 fld1
39 faddp /* 2^(fract(x)) */
40 fscale /* e^x */
41 fstp %st(1)
42 DBL_NARROW_EVAL_UFLOW_NONNEG_NAN
43 ret
44
45 1: testl $0x200, %eax /* Test sign. */
46 jz 2f /* If positive, jump. */
47 fstp %st
48 fldz /* Set result to 0. */
49 2: ret
50 END (__ieee754_exp2)
51 libm_alias_finite (__ieee754_exp2, __exp2)