From 6d1859ca8f747059042fef5434f4a365d289437c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 26 Dec 2018 17:41:13 +0100 Subject: compat/arch: simplify microarchitecture detection --- gui/init.cpp | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'gui') 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 #include @@ -30,39 +31,26 @@ using namespace options; #include -#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 -# else -# define OTR_DENORM_DAZ -# include -# endif -# include - -# ifdef __APPLE__ -# include -# 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() { -- cgit v1.2.3