8e3ea50d82f428bd5bc927139ce9b7f3455a93b3
[musl] / src / math / i386 / modf.s
1 .global modf
2 .type modf,@function
3 modf:
4         mov 12(%esp),%ecx
5         fldl 4(%esp)
6         fxam
7         fnstsw %ax
8         sahf
9         jnp 1f
10         jc 2f
11 1:      fld1
12         fld %st(1)
13 1:      fprem
14         fnstsw %ax
15         sahf
16         jp 1b
17         fstp %st(1)
18         fsubr %st(0),%st(1)
19         fxch %st(1)
20         fstpl (%ecx)
21         ret
22
23 2:      fstpl (%ecx)
24         mov 4(%ecx),%eax
25         and $0x80000000,%eax
26         mov %eax,4(%esp)
27         flds 4(%esp)
28         ret