diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-08 15:48:29 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-08 15:49:18 +0100 |
commit | dd756011da13b95fdb630a1bbb90234f1e60f415 (patch) | |
tree | a6259b1e9b6463108796ce912e3d1752e301505f /src/corelib/tools | |
parent | 0c50edbe84914469973a3b10e0170023ccdd66fe (diff) | |
parent | b6bf2a33f4c33a212da7b58a049b3b5b20b3f327 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
configure.json
mkspecs/win32-icc/qmake.conf
Change-Id: Ibf40546b024d644c7d9ed490bee15b82597f4d3f
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qalgorithms.h | 13 | ||||
-rw-r--r-- | src/corelib/tools/qcollator_icu.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser_p.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 51 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qstringlist.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qstringmatcher.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qunicodetools.cpp | 2 |
9 files changed, 57 insertions, 31 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index fb7031ce71..c0f7709fec 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -638,6 +638,17 @@ Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW { return qt_builtin_clz(v) - 16U; } + +// Neither MSVC nor the Intel compiler define a macro for the POPCNT processor +// feature, so we're using either the SSE4.2 or the AVX macro as a proxy (Clang +// does define the macro). It's incorrect for two reasons: +// 1. It's a separate bit in CPUID, so a processor could implement SSE4.2 and +// not POPCNT, but that's unlikely to happen. +// 2. There are processors that support POPCNT but not AVX (Intel Nehalem +// architecture), but unlike the other compilers, MSVC has no option +// to generate code for those processors. +// So it's an acceptable compromise. +#if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__) #define QALGORITHMS_USE_BUILTIN_POPCOUNT Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW { @@ -658,6 +669,8 @@ Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW return __popcnt64(v); } #endif // MSVC 64bit +#endif // __AVX__ || __SSE4_2__ || __POPCNT__ + #endif // MSVC #endif // QT_HAS_CONSTEXPR_BUILTINS diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp index 98bed1fbca..26e2121092 100644 --- a/src/corelib/tools/qcollator_icu.cpp +++ b/src/corelib/tools/qcollator_icu.cpp @@ -111,7 +111,7 @@ int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) con if (d->collator) return ucol_strcoll(d->collator, (const UChar *)s1, len1, (const UChar *)s2, len2); - return QString::compare(QString(s1, len1), QString(s2, len2), d->caseSensitivity); + return QString::compare_helper(s1, len1, s2, len2, d->caseSensitivity); } int QCollator::compare(const QString &s1, const QString &s2) const diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 65016933a0..d66416207b 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -60,6 +60,10 @@ QT_BEGIN_NAMESPACE #ifndef QT_BOOTSTRAPPED +QDateTimeParser::~QDateTimeParser() +{ +} + /*! \internal Gets the digit from a datetime. E.g. diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index bc088a5f4c..b50c88b4c1 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -103,7 +103,7 @@ public: none.count = -1; none.zeroesAdded = 0; } - virtual ~QDateTimeParser() {} + virtual ~QDateTimeParser(); enum Section { NoSection = 0x00000, diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 3b6c85ca8a..be53c51c48 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -156,6 +156,15 @@ # if !defined(__ARM_FEATURE_NEON) && defined(__ARM_NEON__) # define __ARM_FEATURE_NEON // also support QT_COMPILER_SUPPORTS_HERE(NEON) # endif +#elif defined(Q_PROCESSOR_MIPS) +# define QT_COMPILER_SUPPORTS_HERE(x) (__ ## x ## __) +# define QT_FUNCTION_TARGET(x) +# if !defined(__MIPS_DSP__) && defined(__mips_dsp) && defined(Q_PROCESSOR_MIPS_32) +# define __MIPS_DSP__ +# endif +# if !defined(__MIPS_DSPR2__) && defined(__mips_dspr2) && defined(Q_PROCESSOR_MIPS_32) +# define __MIPS_DSPR2__ +# endif #elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \ || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \ && !defined(QT_BOOTSTRAPPED) @@ -172,8 +181,21 @@ # define QT_FUNCTION_TARGET(x) #endif +#if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__)) +// Visual Studio defines __AVX__ when /arch:AVX is passed, but not the earlier macros +// See: https://msdn.microsoft.com/en-us/library/b0084kay.aspx +// SSE2 is handled by _M_IX86_FP below +# define __SSE3__ 1 +# define __SSSE3__ 1 +// no Intel CPU supports SSE4a, so don't define it +# define __SSE4_1__ 1 +# define __SSE4_2__ 1 +# ifndef __AVX__ +# define __AVX__ 1 +# endif +#endif + // SSE intrinsics -#define QT_FUNCTION_TARGET_STRING_SSE2 "sse2" #if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) #if defined(QT_LINUXBASE) /// this is an evil hack - the posix_memalign declaration in LSB @@ -191,51 +213,38 @@ #endif // SSE3 intrinsics -#define QT_FUNCTION_TARGET_STRING_SSE3 "sse3" #if defined(__SSE3__) || (defined(QT_COMPILER_SUPPORTS_SSE3) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) #include <pmmintrin.h> #endif // SSSE3 intrinsics -#define QT_FUNCTION_TARGET_STRING_SSSE3 "ssse3" #if defined(__SSSE3__) || (defined(QT_COMPILER_SUPPORTS_SSSE3) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) #include <tmmintrin.h> #endif // SSE4.1 intrinsics -#define QT_FUNCTION_TARGET_STRING_SSE4_1 "sse4.1" #if defined(__SSE4_1__) || (defined(QT_COMPILER_SUPPORTS_SSE4_1) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) #include <smmintrin.h> #endif // SSE4.2 intrinsics -#define QT_FUNCTION_TARGET_STRING_SSE4_2 "sse4.2" #if defined(__SSE4_2__) || (defined(QT_COMPILER_SUPPORTS_SSE4_2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) #include <nmmintrin.h> #endif // AVX intrinsics -#define QT_FUNCTION_TARGET_STRING_AVX "avx" -#define QT_FUNCTION_TARGET_STRING_AVX2 "avx2" #if defined(__AVX__) || (defined(QT_COMPILER_SUPPORTS_AVX) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) // immintrin.h is the ultimate header, we don't need anything else after this #include <immintrin.h> - -# if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__)) -// MS Visual Studio 2010 has no macro pre-defined to identify the use of /arch:AVX -// MS Visual Studio 2013 adds it: __AVX__ -// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32 -# define __SSE3__ 1 -# define __SSSE3__ 1 -// no Intel CPU supports SSE4a, so don't define it -# define __SSE4_1__ 1 -# define __SSE4_2__ 1 -# ifndef __AVX__ -# define __AVX__ 1 -# endif -# endif #endif +#define QT_FUNCTION_TARGET_STRING_SSE2 "sse2" +#define QT_FUNCTION_TARGET_STRING_SSE3 "sse3" +#define QT_FUNCTION_TARGET_STRING_SSSE3 "ssse3" +#define QT_FUNCTION_TARGET_STRING_SSE4_1 "sse4.1" +#define QT_FUNCTION_TARGET_STRING_SSE4_2 "sse4.2" +#define QT_FUNCTION_TARGET_STRING_AVX "avx" +#define QT_FUNCTION_TARGET_STRING_AVX2 "avx2" #define QT_FUNCTION_TARGET_STRING_AVX512F "avx512f" #define QT_FUNCTION_TARGET_STRING_AVX512CD "avx512cd" #define QT_FUNCTION_TARGET_STRING_AVX512ER "avx512er" diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 66ce29c859..606893996c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1869,7 +1869,7 @@ QString &QString::operator=(const QString &other) Q_DECL_NOTHROW */ QString &QString::operator=(QLatin1String other) { - if (isDetached() && other.size() <= capacity()) { // assumes d->alloc == 0 → !isDetached() (sharedNull) + if (isDetached() && other.size() <= capacity()) { // assumes d->alloc == 0 -> !isDetached() (sharedNull) d->size = other.size(); d->data()[other.size()] = 0; qt_from_latin1(d->data(), other.latin1(), other.size()); @@ -1928,7 +1928,7 @@ QString &QString::operator=(QLatin1String other) */ QString &QString::operator=(QChar ch) { - if (isDetached() && capacity() >= 1) { // assumes d->alloc == 0 → !isDetached() (sharedNull) + if (isDetached() && capacity() >= 1) { // assumes d->alloc == 0 -> !isDetached() (sharedNull) // re-use existing capacity: ushort *dat = d->data(); dat[0] = ch.unicode(); @@ -8372,7 +8372,7 @@ QString &QString::setRawData(const QChar *unicode, int size) Returns the character at position \a pos in this object. \note This function performs no error checking. - The behavior is undefined when \a pos < 0 or \a pos ≥ size(). + The behavior is undefined when \a pos < 0 or \a pos >= size(). \sa operator[]() */ @@ -8383,7 +8383,7 @@ QString &QString::setRawData(const QChar *unicode, int size) Returns the character at position \a pos in this object. \note This function performs no error checking. - The behavior is undefined when \a pos < 0 or \a pos ≥ size(). + The behavior is undefined when \a pos < 0 or \a pos >= size(). \sa at() */ @@ -10174,7 +10174,7 @@ bool QStringRef::endsWith(const QStringRef &str, Qt::CaseSensitivity cs) const */ /*! \fn bool QStringRef::contains(QLatin1String str, Qt::CaseSensitivity cs) const - \since 4,8 + \since 4.8 \overload contains() Returns \c true if this string reference contains an occurrence of diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 88ceae20b9..75ff934f15 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -716,7 +716,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx /*! \fn int QStringList::removeDuplicates() - \since 4.5 + \since 4.5 This function removes duplicate entries from a list. The entries do not have to be sorted. They will retain their diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp index 67e7ad3825..67d3f0ebc8 100644 --- a/src/corelib/tools/qstringmatcher.cpp +++ b/src/corelib/tools/qstringmatcher.cpp @@ -252,7 +252,7 @@ void QStringMatcher::setCaseSensitivity(Qt::CaseSensitivity cs) { if (cs == q_cs) return; - bm_init_skiptable((const ushort *)q_pattern.unicode(), q_pattern.size(), p.q_skiptable, cs); + bm_init_skiptable((const ushort *)p.uc, p.len, p.q_skiptable, cs); q_cs = cs; } diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp index be1d88e260..ac19d6b6d1 100644 --- a/src/corelib/tools/qunicodetools.cpp +++ b/src/corelib/tools/qunicodetools.cpp @@ -714,7 +714,7 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) } // Never break between a combining mark (gc= Mc, Mn or Me) and its base character. - // Thus, a combining mark — whatever its script property value is — should inherit + // Thus, a combining mark - whatever its script property value is - should inherit // the script property value of its base character. static const int test = (FLAG(QChar::Mark_NonSpacing) | FLAG(QChar::Mark_SpacingCombining) | FLAG(QChar::Mark_Enclosing)); if (Q_UNLIKELY(FLAG(prop->category) & test)) |