xref: /haiku/src/system/libroot/posix/musl/math/x86/sqrt.s (revision f504f61099b010fbfa94b1cc63d2e9072c7f7185)
1*f504f610SAugustin Cavalier.global sqrt
2*f504f610SAugustin Cavalier.type sqrt,@function
3*f504f610SAugustin Cavaliersqrt:	fldl 4(%esp)
4*f504f610SAugustin Cavalier	fsqrt
5*f504f610SAugustin Cavalier	fnstsw %ax
6*f504f610SAugustin Cavalier	sub $12,%esp
7*f504f610SAugustin Cavalier	fld %st(0)
8*f504f610SAugustin Cavalier	fstpt (%esp)
9*f504f610SAugustin Cavalier	mov (%esp),%ecx
10*f504f610SAugustin Cavalier	and $0x7ff,%ecx
11*f504f610SAugustin Cavalier	cmp $0x400,%ecx
12*f504f610SAugustin Cavalier	jnz 1f
13*f504f610SAugustin Cavalier	and $0x200,%eax
14*f504f610SAugustin Cavalier	sub $0x100,%eax
15*f504f610SAugustin Cavalier	sub %eax,(%esp)
16*f504f610SAugustin Cavalier	fstp %st(0)
17*f504f610SAugustin Cavalier	fldt (%esp)
18*f504f610SAugustin Cavalier1:	add $12,%esp
19*f504f610SAugustin Cavalier	fstpl 4(%esp)
20*f504f610SAugustin Cavalier	fldl 4(%esp)
21*f504f610SAugustin Cavalier	ret
22