qsimd_p.h: move the ARM Crypto (AES) disabling on Linux
Commit 8179d7edf6 added the check in two
places. Move to a central one, disabling the bits in
qCompilerCpuFeatures.
Change-Id: I50e2158aeade4256ad1dfffd17b117afcb93c126
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
bb10
parent
6ab4623cad
commit
b911bb0d42
|
|
@ -561,11 +561,6 @@ QT_FUNCTION_TARGET_BASELINE
|
|||
uint64_t QT_MANGLE_NAMESPACE(qDetectCpuFeatures)()
|
||||
{
|
||||
auto minFeatureTest = minFeature;
|
||||
#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM_64)
|
||||
// Yocto hard-codes CRC32+AES on. Since they are unlikely to be used
|
||||
// automatically by compilers, we can just add runtime check.
|
||||
minFeatureTest &= ~(CpuFeatureAES|CpuFeatureCRC32);
|
||||
#endif
|
||||
#if defined(Q_PROCESSOR_X86_64) && defined(cpu_feature_shstk)
|
||||
// Controlflow Enforcement Technology (CET) is an OS-assisted
|
||||
// hardware-feature, meaning the CPUID bit may be disabled if the OS
|
||||
|
|
|
|||
|
|
@ -325,12 +325,19 @@ static const uint64_t qCompilerCpuFeatures = 0
|
|||
#if defined __ARM_NEON__
|
||||
| CpuFeatureNEON
|
||||
#endif
|
||||
#if !(defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM_64))
|
||||
// Yocto Project recipes enable Crypto extension for all ARMv8 configs,
|
||||
// even for targets without the Crypto extension. That's wrong, but as
|
||||
// the compiler never generates the code for them on their own, most
|
||||
// code never notices the problem. But we would. By not setting the
|
||||
// bits here, we force a runtime detection.
|
||||
#if defined __ARM_FEATURE_CRC32
|
||||
| CpuFeatureCRC32
|
||||
#endif
|
||||
#if defined __ARM_FEATURE_CRYPTO
|
||||
| CpuFeatureAES
|
||||
#endif
|
||||
#endif // Q_OS_LINUX && Q_PROCESSOR_ARM64
|
||||
#if defined __mips_dsp
|
||||
| CpuFeatureDSP
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -937,13 +937,7 @@ size_t qHashBits(const void *p, size_t size, size_t seed) noexcept
|
|||
if (seed && qCpuHasFeature(AES) && qCpuHasFeature(SSE4_2))
|
||||
return aeshash(reinterpret_cast<const uchar *>(p), size, seed, seed2);
|
||||
#elif defined(Q_PROCESSOR_ARM) && QT_COMPILER_SUPPORTS_HERE(AES) && !defined(QHASH_AES_SANITIZER_BUILD) && !defined(QT_BOOTSTRAPPED)
|
||||
# if defined(Q_OS_LINUX)
|
||||
// Do specific runtime-only check as Yocto hard enables Crypto extension for
|
||||
// all armv8 configs
|
||||
if (seed && (qCpuFeatures() & CpuFeatureAES))
|
||||
# else
|
||||
if (seed && qCpuHasFeature(AES))
|
||||
# endif
|
||||
return aeshash(reinterpret_cast<const uchar *>(p), size, seed, seed2);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue