Smack: add the execute lable to ldconfig
[platform/upstream/glibc.git] / sysdeps / i386 / fpu / e_exp.S
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
5
6 #include <machine/asm.h>
7
8
9 /* e^x = 2^(x * log2(e)) */
10 ENTRY(__ieee754_exp)
11         fldl    4(%esp)
12 /* I added the following ugly construct because exp(+-Inf) resulted
13    in NaN.  The ugliness results from the bright minds at Intel.
14    For the i686 the code can be written better.
15    -- drepper@cygnus.com.  */
16         fxam                            /* Is NaN or +-Inf?  */
17         fstsw   %ax
18         movb    $0x45, %dh
19         andb    %ah, %dh
20         cmpb    $0x05, %dh
21         je      1f                      /* Is +-Inf, jump.  */
22         fldl2e
23         fmulp                           /* x * log2(e) */
24         fld     %st
25         frndint                         /* int(x * log2(e)) */
26         fsubr   %st,%st(1)              /* fract(x * log2(e)) */
27         fxch
28         f2xm1                           /* 2^(fract(x * log2(e))) - 1 */
29         fld1
30         faddp                           /* 2^(fract(x * log2(e))) */
31         fscale                          /* e^x */
32         fstp    %st(1)
33         ret
34
35 1:      testl   $0x200, %eax            /* Test sign.  */
36         jz      2f                      /* If positive, jump.  */
37         fstp    %st
38         fldz                            /* Set result to 0.  */
39 2:      ret
40 END (__ieee754_exp)
41
42
43 ENTRY(__exp_finite)
44         fldl2e
45         fmull   4(%esp)                 /* x * log2(e) */
46         fld     %st
47         frndint                         /* int(x * log2(e)) */
48         fsubr   %st,%st(1)              /* fract(x * log2(e)) */
49         fxch
50         f2xm1                           /* 2^(fract(x * log2(e))) - 1 */
51         fld1
52         faddp                           /* 2^(fract(x * log2(e))) */
53         fscale                          /* e^x */
54         fstp    %st(1)
55         ret
56 END(__exp_finite)