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:
parent
af4435c5f8
commit
88eda007a3
@ -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
|
// record what CPU features were enabled by default in this Qt build
|
||||||
static const quint64 minFeature = qCompilerCpuFeatures;
|
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) };
|
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()
|
void qDetectCpuFeatures()
|
||||||
{
|
{
|
||||||
@ -555,6 +559,9 @@ void qDetectCpuFeatures()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qt_cpu_features[0].store(f | quint32(QSimdInitialized));
|
qt_cpu_features[0].store(f | quint32(QSimdInitialized));
|
||||||
|
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
|
||||||
|
qt_cpu_features[1].store(f >> 32);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDumpCPUFeatures()
|
void qDumpCPUFeatures()
|
||||||
|
@ -297,26 +297,29 @@ static const quint64 qCompilerCpuFeatures = 0
|
|||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QT_BOOTSTRAPPED
|
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
|
||||||
static inline quint64 qCpuFeatures()
|
|
||||||
{
|
|
||||||
return QSimdInitialized;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1];
|
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();
|
Q_CORE_EXPORT void qDetectCpuFeatures();
|
||||||
|
|
||||||
static inline quint64 qCpuFeatures()
|
static inline quint64 qCpuFeatures()
|
||||||
{
|
{
|
||||||
quint64 features = qt_cpu_features[0].load();
|
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)) {
|
if (Q_UNLIKELY(features == 0)) {
|
||||||
qDetectCpuFeatures();
|
qDetectCpuFeatures();
|
||||||
features = qt_cpu_features[0].load();
|
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);
|
Q_ASSUME(features != 0);
|
||||||
}
|
}
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (Q_UINT64_C(1) << CpuFeature ## feature)) \
|
#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (Q_UINT64_C(1) << CpuFeature ## feature)) \
|
||||||
|| (qCpuFeatures() & (Q_UINT64_C(1) << CpuFeature ## feature)))
|
|| (qCpuFeatures() & (Q_UINT64_C(1) << CpuFeature ## feature)))
|
||||||
|
Loading…
Reference in New Issue
Block a user