X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ffenv%2Fi386%2Ffenv.s;fp=src%2Ffenv%2Fi386%2Ffenv.s;h=72d2ed7dbbb0057ec408dade62422dabd090f655;hb=b09b78905b09016becda8df81a43e11bebd88208;hp=0000000000000000000000000000000000000000;hpb=2afebbbcd16e8bfc5e008a40b2faf3bd8cf14e88;p=musl diff --git a/src/fenv/i386/fenv.s b/src/fenv/i386/fenv.s new file mode 100644 index 00000000..72d2ed7d --- /dev/null +++ b/src/fenv/i386/fenv.s @@ -0,0 +1,75 @@ +2: not %ecx + sub $32,%esp + fnstenv (%esp) + and %ecx,4(%esp) + or %edx,4(%esp) + fldenv (%esp) + add $32,%esp + ret + +.global feclearexcept +feclearexcept: + xor %eax,%eax + mov 4(%esp),%ecx + xor %edx,%edx + test %ecx,%ecx + jnz 2b + ret + +.global feraiseexcept +feraiseexcept: + xor %eax,%eax + mov 4(%esp),%edx + xor %ecx,%ecx + test %edx,%edx + jnz 2b + ret + +.global fesetround +fesetround: + xor %eax,%eax + mov $0xc00,%ecx + mov 4(%esp),%edx + jmp 2b + +.global fegetround +fegetround: + sub $28,%esp + fnstenv (%esp) + mov 4(%esp),%eax + add $28,%esp + and $0xc,%ah + ret + +.global fegetenv +fegetenv: + mov 4(%esp),%ecx + xor %eax,%eax + fnstenv (%ecx) + ret + +.global fesetenv +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 +fetestexcept: + mov 4(%esp),%ecx + fnstsw %ax + and %ecx,%eax + ret