64c1c78e32fd7dfaf05aa75317338c9594923c7a
[musl] / src / math / x86_64 / expl.s
1 .global expm1l
2 .type expm1l,@function
3 expm1l:
4         fldt 8(%rsp)
5 1:      fldl2e
6         fmulp
7         fld1
8         fld %st(1)
9         fabs
10         fucom %st(1)
11         fnstsw %ax
12         fstp %st(0)
13         fstp %st(0)
14         sahf
15         ja 1f
16         f2xm1
17         ret
18 1:      push %rax
19         call 1f
20         pop %rax
21         fld1
22         fsubrp
23         ret
24
25 .global expl
26 .type expl,@function
27 expl:
28         fldt 8(%rsp)
29         fldl2e
30         fmulp
31         jmp 1f
32
33 .global exp2l
34 .type exp2l,@function
35 exp2l:
36         fldt 8(%rsp)
37 1:      mov $0x467ff000,%eax
38         mov %eax,-16(%rsp)
39         mov $0x80000000,%eax
40         mov %eax,-20(%rsp)
41         xor %eax,%eax
42         mov %eax,-24(%rsp)
43         flds -16(%rsp)
44         fld %st(1)
45         fabs
46         fucom %st(1)
47         fnstsw
48         fstp %st(0)
49         fstp %st(0)
50         sahf
51         ja 2f
52         fld %st(0)
53         fistpl -16(%rsp)
54         fildl -16(%rsp)
55         fxch %st(1)
56         fsub %st(1)
57         mov $0x3fff,%eax
58         add %eax,-16(%rsp)
59         f2xm1
60         fld1
61         faddp
62         fldt -24(%rsp)
63         fmulp
64         fstp %st(1)
65         ret
66
67 2:      fld %st(0)
68         fstpt -24(%rsp)
69         mov -15(%rsp),%ah
70         and $0x7f,%ah
71         cmp $0x7f,%ah
72         jne 1f
73         decb -15(%rsp)
74         fstp %st(0)
75         fldt -24(%rsp)
76 1:      fld %st(0)
77         frndint
78         fxch %st(1)
79         fsub %st(1)
80         f2xm1
81         fld1
82         faddp
83         fscale
84         fstp %st(1)
85         ret