qsimd/x86: disable the F16C, FMA, and VAES features if AVX is disabled

Those three features can't be used without the VEX prefix, which
requires that the OS has enabled saving of the AVX state on context
switches (i.e., use XSAVE).

The list is automatically maintained by the updated script in
OpenDCDiag[1]. I need to update the copy in util/x86simdgen.

[1] https://github.com/opendcdiag/opendcdiag/blob/main/framework/scripts/x86simd_generate.pl

Pick-to: 6.3
Change-Id: I6fcda969a9e9427198bffffd16ce55193a6cb069
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Thiago Macieira 2022-01-27 20:34:40 -08:00
parent 671035035a
commit cdb78d7993
2 changed files with 5 additions and 5 deletions

View File

@ -194,9 +194,9 @@ int qfloat16::fpClassify() const noexcept
#if QT_COMPILER_SUPPORTS(F16C)
static inline bool hasFastF16()
{
// All processors with F16C also support AVX, but YMM registers
// might not be supported by the OS, or they might be disabled.
return qCpuHasFeature(F16C) && qCpuHasFeature(AVX);
// qsimd.cpp:detectProcessorFeatures() turns off this feature if AVX
// state-saving is not enabled by the OS
return qCpuHasFeature(F16C);
}
QT_FUNCTION_TARGET(F16C)

View File

@ -371,8 +371,8 @@ static quint64 adjustedXcr0(quint64 xcr0)
static quint64 detectProcessorFeatures()
{
static const quint64 AllAVX2 = CpuFeatureAVX2 | AllAVX512;
static const quint64 AllAVX = CpuFeatureAVX | AllAVX2;
static const quint64 AllAVX = AllAVX512 | CpuFeatureAVX | CpuFeatureAVX2 | CpuFeatureF16C
| CpuFeatureFMA | CpuFeatureVAES;
quint64 features = 0;
int cpuidLevel = maxBasicCpuidSupported();