summaryrefslogtreecommitdiff
path: root/src/math/i386/floor.s
blob: 46ba88db535dbd16161fdd95d441c9ea9066eb61 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.global floorf
.type floorf,@function
floorf:
	flds 4(%esp)
	jmp 1f

.global floorl
.type floorl,@function
floorl:
	fldt 4(%esp)
	jmp 1f

.global floor
.type floor,@function
floor:
	fldl 4(%esp)
1:	mov $0x7,%al
1:	fstcw 4(%esp)
	mov 5(%esp),%ah
	mov %al,5(%esp)
	fldcw 4(%esp)
	frndint
	mov %ah,5(%esp)
	fldcw 4(%esp)
	ret

.global ceil
.type ceil,@function
ceil:
	fldl 4(%esp)
	mov $0xb,%al
	jmp 1b

.global ceilf
.type ceilf,@function
ceilf:
	flds 4(%esp)
	mov $0xb,%al
	jmp 1b

.global ceill
.type ceill,@function
ceill:
	fldt 4(%esp)
	mov $0xb,%al
	jmp 1b

.global trunc
.type trunc,@function
trunc:
	fldl 4(%esp)
	mov $0xf,%al
	jmp 1b

.global truncf
.type truncf,@function
truncf:
	flds 4(%esp)
	mov $0xf,%al
	jmp 1b

.global truncl
.type truncl,@function
truncl:
	fldt 4(%esp)
	mov $0xf,%al
	jmp 1b