X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ffenv%2Fx86_64%2Ffenv.s;h=6aaf25eb1efdf7c355d0d2200b096783ffe3e34d;hb=a6b0170a7f51fdea9beec57ae794221290af232b;hp=c48dade394c2e001f14ccf35c3b5ed8b9e8bd6d4;hpb=ebc10fa17634a6ddb87a3aedd71b7d9617d12c19;p=musl diff --git a/src/fenv/x86_64/fenv.s b/src/fenv/x86_64/fenv.s index c48dade3..6aaf25eb 100644 --- a/src/fenv/x86_64/fenv.s +++ b/src/fenv/x86_64/fenv.s @@ -1,39 +1,37 @@ .global feclearexcept .type feclearexcept,@function feclearexcept: + # maintain exceptions in the sse mxcsr, clear x87 exceptions mov %edi,%ecx + and $0x3f,%ecx + fnstsw %ax + test %eax,%ecx + jz 1f + fnclex +1: stmxcsr -8(%rsp) + and $0x3f,%eax + or %eax,-8(%rsp) + test %ecx,-8(%rsp) + jz 1f not %ecx - stmxcsr -8(%rsp) and %ecx,-8(%rsp) ldmxcsr -8(%rsp) - test $0x3f,%ecx - jnz 2f -1: fnclex - xor %eax,%eax - ret -2: fnstsw %ax - and %ecx,%eax - jz 1b - sub $32,%rsp - fnstenv (%rsp) - mov %al,4(%rsp) - fldenv (%rsp) - add $32,%rsp - xor %eax,%eax +1: xor %eax,%eax ret .global feraiseexcept .type feraiseexcept,@function -feraiseexcept: +feraiseexcept: + and $0x3f,%edi stmxcsr -8(%rsp) or %edi,-8(%rsp) ldmxcsr -8(%rsp) xor %eax,%eax ret -.global fesetround -.type fesetround,@function -fesetround: +.global __fesetround +.type __fesetround,@function +__fesetround: push %rax xor %eax,%eax mov %edi,%ecx @@ -89,6 +87,7 @@ fesetenv: .global fetestexcept .type fetestexcept,@function fetestexcept: + and $0x3f,%edi push %rax stmxcsr (%rsp) pop %rsi