math: fix x86 asin, atan, exp, log1p to raise underflow
[musl] / src / math / i386 / asin.s
1 .global asinf
2 .type asinf,@function
3 asinf:
4         flds 4(%esp)
5         mov 4(%esp),%eax
6         add %eax,%eax
7         cmp $0x01000000,%eax
8         jae 1f
9                 # subnormal x, return x with underflow
10         fnstsw %ax
11         and $16,%ax
12         jnz 2f
13         fld %st(0)
14         fmul %st(1)
15         fstps 4(%esp)
16 2:      ret
17
18 .global asinl
19 .type asinl,@function
20 asinl:
21         fldt 4(%esp)
22         jmp 1f
23
24 .global asin
25 .type asin,@function
26 asin:
27         fldl 4(%esp)
28         mov 8(%esp),%eax
29         add %eax,%eax
30         cmp $0x00200000,%eax
31         jae 1f
32                 # subnormal x, return x with underflow
33         fnstsw %ax
34         and $16,%ax
35         jnz 2f
36         fsts 4(%esp)
37 2:      ret
38 1:      fld %st(0)
39         fld1
40         fsub %st(0),%st(1)
41         fadd %st(2)
42         fmulp
43         fsqrt
44         fpatan
45         ret