Skip to content

Commit

Permalink
qsimd: remove support for systems without 64-bit atomics
Browse files Browse the repository at this point in the history
We had that as a concession for early toolchains that failed to include
the necessary libraries. They must now be up-to-date.

Change-Id: I938b024e38bf4aac9154fffd14f7a630ef160cd5
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
thiagomacieira committed May 5, 2018
1 parent 2f9d496 commit 6e11900
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
7 changes: 0 additions & 7 deletions src/corelib/tools/qsimd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,11 +644,7 @@ 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()
{
Expand Down Expand Up @@ -681,9 +677,6 @@ 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()
Expand Down
17 changes: 7 additions & 10 deletions src/corelib/tools/qsimd_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,29 +435,26 @@ static const quint64 qCompilerCpuFeatures = 0
#endif
;

#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
extern Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1];
#ifdef QT_BOOTSTRAPPED
static inline quint64 qCpuFeatures()
{
return QSimdInitialized;
}
#else
extern Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2];
#endif
extern Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1];
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)))
Expand Down

0 comments on commit 6e11900

Please sign in to comment.