diff options
Diffstat (limited to 'core/fpu_ctrl.cpp')
-rw-r--r-- | core/fpu_ctrl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/fpu_ctrl.cpp b/core/fpu_ctrl.cpp index 24021c7d..b12f2c96 100644 --- a/core/fpu_ctrl.cpp +++ b/core/fpu_ctrl.cpp @@ -13,11 +13,13 @@ #include "cpu_caps.h" -FPUCtl::FPUCtl() +void FPUCtl::enter() noexcept { + if(this->in_mode) return; + #if defined(HAVE_SSE_INTRINSICS) this->sse_state = _mm_getcsr(); - unsigned int sseState = this->sse_state; + unsigned int sseState{this->sse_state}; sseState |= 0x8000; /* set flush-to-zero */ sseState |= 0x0040; /* set denormals-are-zero */ _mm_setcsr(sseState); @@ -27,7 +29,7 @@ FPUCtl::FPUCtl() if((CPUCapFlags&CPU_CAP_SSE)) { __asm__ __volatile__("stmxcsr %0" : "=m" (*&this->sse_state)); - unsigned int sseState = this->sse_state; + unsigned int sseState{this->sse_state}; sseState |= 0x8000; /* set flush-to-zero */ if((CPUCapFlags&CPU_CAP_SSE2)) sseState |= 0x0040; /* set denormals-are-zero */ @@ -38,7 +40,7 @@ FPUCtl::FPUCtl() this->in_mode = true; } -void FPUCtl::leave() +void FPUCtl::leave() noexcept { if(!this->in_mode) return; |