diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-26 17:41:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-26 17:45:02 +0100 |
commit | 6d1859ca8f747059042fef5434f4a365d289437c (patch) | |
tree | 3aeefb010129e8346109eb6a594727eb6a45c271 /gui | |
parent | 165ed6f945613e180fdbecc99328bd7ecbdc08ae (diff) |
compat/arch: simplify microarchitecture detection
Diffstat (limited to 'gui')
-rw-r--r-- | gui/init.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/gui/init.cpp b/gui/init.cpp index d2b0c27d..b1018e39 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -11,6 +11,7 @@ #include "options/options.hpp" using namespace options; #include "compat/library-path.hpp" +#include "compat/arch.hpp" #include <memory> #include <cstdlib> @@ -30,39 +31,26 @@ using namespace options; #include <QDebug> -#if /* denormal control */ \ - /* GNU */ defined __x86_64__ || defined __SSE3__ || \ - /* MSVC */ defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP >= 2) - -# if defined __GNUG__ && defined __SSE2__ && !defined __SSE3__ && !defined __x86_64__ -# undef OTR_DENORM_DAZ -# include <emmintrin.h> -# else -# define OTR_DENORM_DAZ -# include <pmmintrin.h> -# endif -# include <cfloat> - -# ifdef __APPLE__ -# include <fenv.h> -# endif - static void set_fp_mask() { -#ifdef OTR_DENORM_DAZ +#if defined OTR_ARCH_DENORM_DAZ _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); -#endif +#elif defined OTR_ARCH_DENORM_FTZ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); - //_MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST); +#endif + +#ifdef OTR_ARCH_FPU_MASK _MM_SET_EXCEPTION_MASK(_MM_MASK_MASK); +#endif #ifdef __APPLE__ fesetenv(FE_DFL_DISABLE_SSE_DENORMS_ENV); #endif -} -#else -static inline void set_fp_mask() {} + +#ifdef _WIN32 + _controlfp(_DN_FLUSH, _MCW_DN); #endif +} static void set_qt_style() { |