fix i386 fegetround and make fesetround faster
[musl] / src / fenv / i386 / fenv.s
index 34101d5..ee2eae6 100644 (file)
@@ -8,6 +8,7 @@
        ret
 
 .global feclearexcept
+.type feclearexcept,@function
 feclearexcept: 
        xor %eax,%eax
        mov 4(%esp),%ecx
@@ -17,6 +18,7 @@ feclearexcept:
        ret
 
 .global feraiseexcept
+.type feraiseexcept,@function
 feraiseexcept: 
        xor %eax,%eax
        mov 4(%esp),%edx
@@ -26,27 +28,30 @@ feraiseexcept:
        ret
 
 .global fesetround
+.type fesetround,@function
 fesetround:
        mov 4(%esp),%ecx
        xor %eax,%eax
-       sub $32,%esp
-       fnstenv (%esp)
+       sub $4,%esp
+       fnstcw (%esp)
        andb $0xf3,1(%esp)
-       or %ecx,(%esp)
-       fldenv (%esp)
-       add $32,%esp
+       or %cx,(%esp)
+       fldcw (%esp)
+       add $4,%esp
        ret
 
 .global fegetround
+.type fegetround,@function
 fegetround:
-       sub $28,%esp
-       fnstenv (%esp)
-       mov 4(%esp),%eax
-       add $28,%esp
-       and $0xc,%ah
+       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
@@ -54,6 +59,7 @@ fegetenv:
        ret
 
 .global fesetenv
+.type fesetenv,@function
 fesetenv:
        mov 4(%esp),%ecx
        xor %eax,%eax
@@ -73,6 +79,7 @@ fesetenv:
        ret
 
 .global fetestexcept
+.type fetestexcept,@function
 fetestexcept:
        mov 4(%esp),%ecx
        fnstsw %ax