avoid changing NaNs in sqrt (x86 asm) to satisfy c99 f.9 recommendation
[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         mov 8(%esp),%ecx
14         or $0xffff8000,%ecx
15         inc %ecx
16         jz 1f
17         and $0x200,%eax
18         sub $0x100,%eax
19         sub %eax,(%esp)
20         fstp %st(0)
21         fldt (%esp)
22 1:      add $12,%esp
23         fstpl 4(%esp)
24         fldl 4(%esp)
25         ret