about summary refs log tree commit diff
path: root/src/math/i386/hypot.s
blob: 299c2e186cab4d9287e08e7eb79522790a35b6fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.global hypot
.type hypot,@function
hypot:
	mov 8(%esp),%eax
	mov 16(%esp),%ecx
	add %eax,%eax
	add %ecx,%ecx
	and %eax,%ecx
	cmp $0xffe00000,%ecx
	jae 2f
	or 4(%esp),%eax
	jnz 1f
	fldl 12(%esp)
	fabs
	ret
1:	mov 16(%esp),%eax
	add %eax,%eax
	or 12(%esp),%eax
	jnz 1f
	fldl 4(%esp)
	fabs
	ret
1:	fldl 4(%esp)
	fld %st(0)
	fmulp
	fldl 12(%esp)
	fld %st(0)
	fmulp
	faddp
	fsqrt
	ret
2:	sub $0xffe00000,%eax
	or 4(%esp),%eax
	jnz 1f
	fldl 4(%esp)
	fabs
	ret
1:	mov 16(%esp),%eax
	add %eax,%eax
	sub $0xffe00000,%eax
	or 12(%esp),%eax
	fldl 12(%esp)
	jnz 1f
	fabs
1:	ret