floating point environment, untested
[musl] / src / fenv / i386 / fenv.s
1 2:      not %ecx
2         sub $32,%esp
3         fnstenv (%esp)
4         and %ecx,4(%esp)
5         or %edx,4(%esp)
6         fldenv (%esp)
7         add $32,%esp
8         ret
9
10 .global feclearexcept
11 feclearexcept:  
12         xor %eax,%eax
13         mov 4(%esp),%ecx
14         xor %edx,%edx
15         test %ecx,%ecx
16         jnz 2b
17         ret
18
19 .global feraiseexcept
20 feraiseexcept:  
21         xor %eax,%eax
22         mov 4(%esp),%edx
23         xor %ecx,%ecx
24         test %edx,%edx
25         jnz 2b
26         ret
27
28 .global fesetround
29 fesetround:
30         xor %eax,%eax
31         mov $0xc00,%ecx
32         mov 4(%esp),%edx
33         jmp 2b
34
35 .global fegetround
36 fegetround:
37         sub $28,%esp
38         fnstenv (%esp)
39         mov 4(%esp),%eax
40         add $28,%esp
41         and $0xc,%ah
42         ret
43
44 .global fegetenv
45 fegetenv:
46         mov 4(%esp),%ecx
47         xor %eax,%eax
48         fnstenv (%ecx)
49         ret
50
51 .global fesetenv
52 fesetenv:
53         mov 4(%esp),%ecx
54         xor %eax,%eax
55         test %ecx,%ecx
56         jz 1f
57         fldenv (%ecx)
58         ret
59 1:      push %eax
60         push %eax
61         push %eax
62         push %eax
63         push %eax
64         push %eax
65         pushl $0x37f
66         fldenv (%esp)
67         add $28,%esp
68         ret
69
70 .global fetestexcept
71 fetestexcept:
72         mov 4(%esp),%ecx
73         fnstsw %ax
74         and %ecx,%eax
75         ret