9 #ifdef HAVE_SSE_INTRINSICS
10 #include <xmmintrin.h>
16 void FPUCtl::enter() noexcept
18 if(this->in_mode
) return;
20 #if defined(HAVE_SSE_INTRINSICS)
21 this->sse_state
= _mm_getcsr();
22 unsigned int sseState
{this->sse_state
};
23 sseState
|= 0x8000; /* set flush-to-zero */
24 sseState
|= 0x0040; /* set denormals-are-zero */
27 #elif defined(__GNUC__) && defined(HAVE_SSE)
29 if((CPUCapFlags
&CPU_CAP_SSE
))
31 __asm__
__volatile__("stmxcsr %0" : "=m" (*&this->sse_state
));
32 unsigned int sseState
{this->sse_state
};
33 sseState
|= 0x8000; /* set flush-to-zero */
34 if((CPUCapFlags
&CPU_CAP_SSE2
))
35 sseState
|= 0x0040; /* set denormals-are-zero */
36 __asm__
__volatile__("ldmxcsr %0" : : "m" (*&sseState
));
43 void FPUCtl::leave() noexcept
45 if(!this->in_mode
) return;
47 #if defined(HAVE_SSE_INTRINSICS)
48 _mm_setcsr(this->sse_state
);
50 #elif defined(__GNUC__) && defined(HAVE_SSE)
52 if((CPUCapFlags
&CPU_CAP_SSE
))
53 __asm__
__volatile__("ldmxcsr %0" : : "m" (*&this->sse_state
));
55 this->in_mode
= false;