correctly rounded sqrt() asm for x86 (i387)
[musl] / src / math / i386 / sqrt.s
1 .global sqrt
2 .type sqrt,@function
3 sqrt:   fldl 4(%esp)
4         fsqrt
5         fstsw %ax
6         sub $12,%esp
7         fld %st(0)
8         fstpt (%esp)
9         mov (%esp),%ecx
10         and $0x7ff,%ecx
11         cmp $0x400,%ecx
12         jnz 1f
13         and $0x200,%eax
14         sub $0x100,%eax
15         sub %eax,(%esp)
16         fstp %st(0)
17         fldt (%esp)
18 1:      add $12,%esp
19         fstpl 4(%esp)
20         fldl 4(%esp)
21         ret