mirror of git://git.musl-libc.org/musl
optimize x86 feclearexcept
if all exception flags will be cleared, we can avoid the expensive store/reload of the environment and just use the fnclex instruction.
This commit is contained in:
parent
9cb6878e74
commit
316e024f63
|
@ -1,30 +1,34 @@
|
||||||
2: not %ecx
|
|
||||||
sub $32,%esp
|
|
||||||
fnstenv (%esp)
|
|
||||||
and %ecx,4(%esp)
|
|
||||||
or %edx,4(%esp)
|
|
||||||
fldenv (%esp)
|
|
||||||
add $32,%esp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.global feclearexcept
|
.global feclearexcept
|
||||||
.type feclearexcept,@function
|
.type feclearexcept,@function
|
||||||
feclearexcept:
|
feclearexcept:
|
||||||
xor %eax,%eax
|
|
||||||
mov 4(%esp),%ecx
|
mov 4(%esp),%ecx
|
||||||
xor %edx,%edx
|
not %ecx
|
||||||
test %ecx,%ecx
|
test $0x3f,%ecx
|
||||||
jnz 2b
|
jnz 2f
|
||||||
|
1: fnclex
|
||||||
|
xor %eax,%eax
|
||||||
|
ret
|
||||||
|
2: fnstsw %ax
|
||||||
|
and %ecx,%eax
|
||||||
|
jz 1b
|
||||||
|
sub $32,%esp
|
||||||
|
fnstenv (%esp)
|
||||||
|
mov %al,4(%esp)
|
||||||
|
fldenv (%esp)
|
||||||
|
add $32,%esp
|
||||||
|
xor %eax,%eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.global feraiseexcept
|
.global feraiseexcept
|
||||||
.type feraiseexcept,@function
|
.type feraiseexcept,@function
|
||||||
feraiseexcept:
|
feraiseexcept:
|
||||||
|
mov 4(%esp),%eax
|
||||||
|
sub $32,%esp
|
||||||
|
fnstenv (%esp)
|
||||||
|
or %al,4(%esp)
|
||||||
|
fldenv (%esp)
|
||||||
|
add $32,%esp
|
||||||
xor %eax,%eax
|
xor %eax,%eax
|
||||||
mov 4(%esp),%edx
|
|
||||||
xor %ecx,%ecx
|
|
||||||
test %edx,%edx
|
|
||||||
jnz 2b
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.global fesetround
|
.global fesetround
|
||||||
|
|
Loading…
Reference in New Issue