summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-10-05 16:28:34 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-10-05 14:35:44 +0000
commit388e797a8e70ea93d08b20b522c4029f8741fa34 (patch)
treec38ef3494c2a7bc6d47bb27d2b7fc346eb163d1a /gui
parent9c82bd86dfbc0b003c51c07d4c54b97f1df4b3c2 (diff)
gui/init: handle -msse2 -mno-sse3
Diffstat (limited to 'gui')
-rw-r--r--gui/init.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/gui/init.cpp b/gui/init.cpp
index 758919c4..09b0e909 100644
--- a/gui/init.cpp
+++ b/gui/init.cpp
@@ -35,20 +35,37 @@ using namespace options;
#include <QDebug>
#if /* denormal control */ \
- /* GNU */ defined __x86_64__ || defined __SSE2__ || \
+ /* GNU */ defined __x86_64__ || defined __SSE3__ || \
/* MSVC */ defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
-# include <xmmintrin.h>
-# include <pmmintrin.h>
+
+# 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>
-#define OTR_HAS_DENORM_CONTROL
+# ifdef __APPLE__
+# include <fenv.h>
+# endif
+
static void set_fp_mask()
{
- //_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
+#ifdef OTR_DENORM_DAZ
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
- _MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);
+#endif
+ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
+ //_MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);
_MM_SET_EXCEPTION_MASK(_MM_MASK_MASK);
+
+#ifdef __APPLE__
+ fesetenv(FE_DFL_DISABLE_SSE_DENORMS_ENV);
+#endif
}
+#else
+static inline void set_fp_mask() {}
#endif
static void set_qt_style()
@@ -185,9 +202,7 @@ static int run_window(std::unique_ptr<QWidget> main_window)
int otr_main(int argc, char** argv, std::function<QWidget*()> const& make_main_window)
{
-#if defined OTR_HAS_DENORM_CONTROL
set_fp_mask();
-#endif
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_X11InitThreads, true);