From 4b4469d6c2308ea93a4e02a69b1cd34e4174b9bd Mon Sep 17 00:00:00 2001 From: Vesa Date: Sun, 16 Nov 2014 15:19:54 +0200 Subject: [PATCH] Add denormals stripping to the main thread as well as workerthreads Conflicts: src/core/main.cpp --- include/MixerWorkerThread.h | 4 ++-- src/core/main.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/MixerWorkerThread.h b/include/MixerWorkerThread.h index d1ebc73eb..51da6a91e 100644 --- a/include/MixerWorkerThread.h +++ b/include/MixerWorkerThread.h @@ -22,8 +22,8 @@ * */ -#ifndef _MIXER_WORKER_THREAD_H -#define _MIXER_WORKER_THREAD_H +#ifndef MIXER_WORKER_THREAD_H +#define MIXER_WORKER_THREAD_H #include #include diff --git a/src/core/main.cpp b/src/core/main.cpp index f65ca98c8..1249c57b6 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -27,6 +27,14 @@ #include "lmmsversion.h" #include "versioninfo.h" +// denormals stripping +#ifdef __SSE__ +#include +#endif +#ifdef __SSE3__ +#include +#endif + #include #include #include @@ -92,6 +100,16 @@ int main( int argc, char * * argv ) // intialize RNG srand( getpid() + time( 0 ) ); + // set denormal protection for this thread + #ifdef __SSE3__ + /* DAZ flag */ + _MM_SET_DENORMALS_ZERO_MODE( _MM_DENORMALS_ZERO_ON ); + #endif + #ifdef __SSE__ + /* FTZ flag */ + _MM_SET_FLUSH_ZERO_MODE( _MM_FLUSH_ZERO_ON ); + #endif + bool core_only = false; bool fullscreen = true; bool exit_after_import = false;