simplify nan check in sqrt (x86 asm); result of sqrt is never negative
[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),%cx
14         inc %cx
15         jo 1f
16         and $0x200,%eax
17         sub $0x100,%eax
18         sub %eax,(%esp)
19         fstp %st(0)
20         fldt (%esp)
21 1:      add $12,%esp
22         fstpl 4(%esp)
23         fldl 4(%esp)
24         ret