Commit bd7f13c4ea for ffmpeg
commit bd7f13c4ea868208d8fbbe46d3dbbe8775f1097a
Author: Tymur Boiko <tboiko@nvidia.com>
Date: Fri Oct 9 15:15:10 2026 +0200
checkasm: bundle AVXSLOW with AVX so the C pass strips it
AVXSLOW is set for AMD family 15h/16h (Bulldozer/Jaguar). Unlike
SSE2SLOW and SSE3SLOW it was missing from checkasm's x86 cpuflags
table, so the C-pass leftover still contained AVXSLOW.
That leftover was not plain C. av_force_cpu_flags() implies MMX from
AVXSLOW, so MMX put_ ran under the _c name. Checkasm still treated the
pass as C and used checked_call instead of checked_call_emms, so it
did not restore x87 after MMX. fstenv then saw tag 0xaaaa and reported
missing emms.
Put AVXSLOW on the AVX row, the same way SSE2SLOW sits on SSE2, so the
C pass strips it. OR it into the detected cpu mask as well. Listing
still requires every bit of the row, and this keeps AVX reported on
hosts that have AVX but not the hint. Save the actual host flags and
intersect the requested flags with them in set_cpu_flags(), so the
synthetic reporting hint does not disable AVX_FAST, AVX2_FAST or
FMA3_FAST implementations on CPUs without AVXSLOW. The imported
libcheckasm sources are unchanged.
Reproduced with fate-checkasm-vc1dsp on an AVXSLOW CPU (an x64 emulator
whose CPUID is AuthenticAMD 00600F01, family 15h). The same leftover
applies to any family 15h/16h CPU.
Signed-off-by: Tymur Boiko <tboiko@nvidia.com>
Assisted-by: Fairy
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index b79195adf0..e50d2885a3 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -381,7 +381,7 @@ static const CheckasmCpuInfo cpuflags[] = {
{ "SSE4.2", "sse42", AV_CPU_FLAG_SSE42 },
{ "AES-NI", "aesni", AV_CPU_FLAG_AESNI },
{ "CLMUL", "clmul", AV_CPU_FLAG_CLMUL },
- { "AVX", "avx", AV_CPU_FLAG_AVX },
+ { "AVX", "avx", AV_CPU_FLAG_AVX|AV_CPU_FLAG_AVXSLOW },
{ "XOP", "xop", AV_CPU_FLAG_XOP },
{ "FMA3", "fma3", AV_CPU_FLAG_FMA3 },
{ "FMA4", "fma4", AV_CPU_FLAG_FMA4 },
@@ -397,18 +397,31 @@ static const CheckasmCpuInfo cpuflags[] = {
{ NULL }
};
+static int host_cpu_flags;
+
static void set_cpu_flags(uint64_t flags)
{
- av_force_cpu_flags((int) flags);
+ av_force_cpu_flags((int) flags & host_cpu_flags);
}
int main(int argc, const char *argv[])
{
+ /* Include optional hints for reporting; set_cpu_flags() masks out hints
+ * absent from the host before DSP dispatch. AV_CPU_FLAG_AVXSLOW may alias
+ * a flag on another architecture, so keep it x86-only. */
+#if ARCH_X86
+ const int extra_flags = AV_CPU_FLAG_AVXSLOW;
+#else
+ const int extra_flags = 0;
+#endif
+
+ host_cpu_flags = av_get_cpu_flags();
+
CheckasmConfig cfg = {
.cpu_flags = cpuflags,
.tests = tests,
.set_cpu_flags = set_cpu_flags,
- .cpu = av_get_cpu_flags(),
+ .cpu = host_cpu_flags | extra_flags,
};
return checkasm_main(&cfg, argc, argv);