diff options
Diffstat (limited to 'src/fenv/x86_64')
-rw-r--r-- | src/fenv/x86_64/fenv.s | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/fenv/x86_64/fenv.s b/src/fenv/x86_64/fenv.s index c48dade3..dda6b61a 100644 --- a/src/fenv/x86_64/fenv.s +++ b/src/fenv/x86_64/fenv.s @@ -1,25 +1,21 @@ .global feclearexcept .type feclearexcept,@function feclearexcept: + # maintain exceptions in the sse mxcsr, clear x87 exceptions mov %edi,%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 |