Revert "qsimd: remove support for systems without 64-bit atomics"

This reverts commit 6e1190053d.
We had to bring back qatomic_msvc.h for MSVC 2015, which does
not provide 64-bit atomics on 32-bit platforms.

Task-number: QTBUG-68719
Change-Id: Iea902cf0b01191717e0a640944771fcede7b5ff8
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Thiago Macieira 2018-06-06 20:42:32 +00:00 committed by Liang Qi
parent af4435c5f8
commit 88eda007a3
2 changed files with 17 additions and 7 deletions

View File

@ -522,7 +522,11 @@ static const int features_count = (sizeof features_indices) / (sizeof features_i
// record what CPU features were enabled by default in this Qt build
static const quint64 minFeature = qCompilerCpuFeatures;
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1] = { Q_BASIC_ATOMIC_INITIALIZER(0) };
#else
Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2] = { Q_BASIC_ATOMIC_INITIALIZER(0), Q_BASIC_ATOMIC_INITIALIZER(0) };
#endif
void qDetectCpuFeatures()
{
@ -555,6 +559,9 @@ void qDetectCpuFeatures()
}
qt_cpu_features[0].store(f | quint32(QSimdInitialized));
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
qt_cpu_features[1].store(f >> 32);
#endif
}
void qDumpCPUFeatures()

View File

@ -297,26 +297,29 @@ static const quint64 qCompilerCpuFeatures = 0
;
#endif
#ifdef QT_BOOTSTRAPPED
static inline quint64 qCpuFeatures()
{
return QSimdInitialized;
}
#else
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
extern Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1];
#else
extern Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2];
#endif
Q_CORE_EXPORT void qDetectCpuFeatures();
static inline quint64 qCpuFeatures()
{
quint64 features = qt_cpu_features[0].load();
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
features |= quint64(qt_cpu_features[1].load()) << 32;
#endif
if (Q_UNLIKELY(features == 0)) {
qDetectCpuFeatures();
features = qt_cpu_features[0].load();
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
features |= quint64(qt_cpu_features[1].load()) << 32;
#endif
Q_ASSUME(features != 0);
}
return features;
}
#endif
#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (Q_UINT64_C(1) << CpuFeature ## feature)) \
|| (qCpuFeatures() & (Q_UINT64_C(1) << CpuFeature ## feature)))