X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ffenv%2Fi386%2Ffenv.s;h=e365b8f418bd19ff2e00d35b0ff6e848065d4dce;hb=HEAD;hp=8148a30d384286588f82df36927ea4fc8c8ad2e9;hpb=e41182796014b0e2b52c7b3e6ee69ad7d0c3e723;p=musl diff --git a/src/fenv/i386/fenv.s b/src/fenv/i386/fenv.s index 8148a30d..e365b8f4 100644 --- a/src/fenv/i386/fenv.s +++ b/src/fenv/i386/fenv.s @@ -1,53 +1,56 @@ -2: not %ecx +.global feclearexcept +.type feclearexcept,@function +feclearexcept: + mov 4(%esp),%ecx + not %ecx + test $0x3f,%ecx + jnz 2f +1: fnclex + xor %eax,%eax + ret +2: fnstsw %ax + and %ecx,%eax + jz 1b sub $32,%esp fnstenv (%esp) - and %ecx,4(%esp) - or %edx,4(%esp) + mov %al,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: + mov 4(%esp),%eax + sub $32,%esp + fnstenv (%esp) + or %al,4(%esp) + fldenv (%esp) + add $32,%esp 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 + push %eax xor %eax,%eax - sub $32,%esp - fnstenv (%esp) + fnstcw (%esp) andb $0xf3,1(%esp) - or %ecx,(%esp) - fldenv (%esp) - add $32,%esp + or %ch,1(%esp) + fldcw (%esp) + pop %ecx ret .global fegetround .type fegetround,@function fegetround: - sub $28,%esp - fnstenv (%esp) - mov 4(%esp),%eax - add $28,%esp - and $0xc,%ah + push %eax + fnstcw (%esp) + pop %eax + and $0xc00,%eax ret .global fegetenv