about summary refs log tree commit diff
path: root/src/fenv/i386/fenv.s
blob: ee2eae6e464516ef7753ec3c27656495f7d015ce (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
2:	not %ecx
	sub $32,%esp
	fnstenv (%esp)
	and %ecx,4(%esp)
	or %edx,4(%esp)
	fldenv (%esp)
	add $32,%esp
	ret

.global feclearexcept
.type feclearexcept,@function
feclearexcept:	
	xor %eax,%eax
	mov 4(%esp),%ecx
	xor %edx,%edx
	test %ecx,%ecx
	jnz 2b
	ret

.global feraiseexcept
.type feraiseexcept,@function
feraiseexcept:	
	xor %eax,%eax
	mov 4(%esp),%edx
	xor %ecx,%ecx
	test %edx,%edx
	jnz 2b
	ret

.global fesetround
.type fesetround,@function
fesetround:
	mov 4(%esp),%ecx
	xor %eax,%eax
	sub $4,%esp
	fnstcw (%esp)
	andb $0xf3,1(%esp)
	or %cx,(%esp)
	fldcw (%esp)
	add $4,%esp
	ret

.global fegetround
.type fegetround,@function
fegetround:
	sub $4,%esp
	fnstcw (%esp)
	mov (%esp),%ax
	add $4,%esp
	and $0xc00,%eax
	ret

.global fegetenv
.type fegetenv,@function
fegetenv:
	mov 4(%esp),%ecx
	xor %eax,%eax
	fnstenv (%ecx)
	ret

.global fesetenv
.type fesetenv,@function
fesetenv:
	mov 4(%esp),%ecx
	xor %eax,%eax
	test %ecx,%ecx
	jz 1f
	fldenv (%ecx)
	ret
1:	push %eax
	push %eax
	push %eax
	push %eax
	push %eax
	push %eax
	pushl $0x37f
	fldenv (%esp)
	add $28,%esp
	ret

.global fetestexcept
.type fetestexcept,@function
fetestexcept:
	mov 4(%esp),%ecx
	fnstsw %ax
	and %ecx,%eax
	ret