diff options
Diffstat (limited to 'src/corelib/plugin/qlibrary_unix.cpp')
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 23b9ad6434..7ffd1369b9 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 Intel Corporation ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -43,6 +44,7 @@ #include "qlibrary_p.h" #include <qcoreapplication.h> #include <private/qfilesystementry_p.h> +#include <private/qsimd_p.h> #include <dlfcn.h> @@ -178,6 +180,27 @@ bool QLibraryPrivate::load_sys() prefixes.append(QString()); } +#if defined(Q_PROCESSOR_X86) && !defined(Q_OS_DARWIN) + if (qCpuHasFeature(ArchHaswell)) { + auto transform = [](QStringList &list, QString (*f)(QString)) { + QStringList tmp; + qSwap(tmp, list); + list.reserve(tmp.size() * 2); + for (const QString &s : qAsConst(tmp)) { + list.append(f(s)); + list.append(s); + } + }; + if (pluginState == IsAPlugin) { + // add ".avx2" to each suffix in the list + transform(suffixes, [](QString s) { return s.append(QLatin1String(".avx2")); }); + } else { + // prepend "haswell/" to each prefix in the list + transform(prefixes, [](QString s) { return s.prepend(QLatin1String("haswell/")); }); + } + } +#endif + bool retry = true; for(int prefix = 0; retry && !pHnd && prefix < prefixes.size(); prefix++) { for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) { |