about summary refs log tree commit diff
path: root/src/math/i386/s_trunc.s
blob: 0773891af6d5419e52780eec561c42616e7b35bd (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
.global ceilf
ceilf:	flds 4(%esp)
	jmp 1f
	
.global ceil
ceil:	fldl 4(%esp)
1:	mov $0x08fb,%edx
	jmp 0f

.global floorf
floorf:	flds 4(%esp)
	jmp 1f

.global floor
floor:	fldl 4(%esp)
1:	mov $0x04f7,%edx
	jmp 0f

.global truncf
truncf:	flds 4(%esp)
	jmp 1f

.global trunc
trunc:	fldl 4(%esp)
1:	mov $0x0cff,%edx

0:	fstcw 4(%esp)
	mov 5(%esp),%ah
	or %dh,%ah
	and %dl,%ah
	xchg %ah,5(%esp)
	fldcw 4(%esp)
	frndint
	mov %ah,5(%esp)
	fldcw 4(%esp)
	ret