aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/helpers.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-18 20:14:40 -0700
committerChris Robinson <[email protected]>2019-03-18 20:14:40 -0700
commit2de1d17bc6b07ec4e7680f1c46e147eeaa269f05 (patch)
tree69165764c92d16727267153ba5b2acd51a69381d /Alc/helpers.cpp
parent6a0b2ed0ca2b7628771ee450567c2c62c575db36 (diff)
Use SSE intrinsics to set FTZ and DAZ
Diffstat (limited to 'Alc/helpers.cpp')
-rw-r--r--Alc/helpers.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp
index 13ba3a2a..d5bbde1d 100644
--- a/Alc/helpers.cpp
+++ b/Alc/helpers.cpp
@@ -89,6 +89,9 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
#ifdef HAVE_CPUID_H
#include <cpuid.h>
#endif
+#ifdef HAVE_SSE_INTRINSICS
+#include <xmmintrin.h>
+#endif
#ifdef HAVE_SYS_SYSCONF_H
#include <sys/sysconf.h>
#endif
@@ -261,7 +264,15 @@ void FillCPUCaps(int capfilter)
FPUCtl::FPUCtl() noexcept
{
-#if defined(__GNUC__) && defined(HAVE_SSE)
+#if defined(HAVE_SSE_INTRINSICS)
+ this->sse_state = _mm_getcsr();
+ unsigned int sseState = this->sse_state;
+ sseState |= 0x8000; /* set flush-to-zero */
+ sseState |= 0x0040; /* set denormals-are-zero */
+ _mm_setcsr(sseState);
+
+#elif defined(__GNUC__) && defined(HAVE_SSE)
+
if((CPUCapFlags&CPU_CAP_SSE))
{
__asm__ __volatile__("stmxcsr %0" : "=m" (*&this->sse_state));
@@ -290,7 +301,11 @@ void FPUCtl::leave() noexcept
{
if(!this->in_mode) return;
-#if defined(__GNUC__) && defined(HAVE_SSE)
+#if defined(HAVE_SSE_INTRINSICS)
+ _mm_setcsr(this->sse_state);
+
+#elif defined(__GNUC__) && defined(HAVE_SSE)
+
if((CPUCapFlags&CPU_CAP_SSE))
__asm__ __volatile__("ldmxcsr %0" : : "m" (*&this->sse_state));