Files
LibretroAdmin 064450ef90 features_cpu: gate AVX2/AVX-512 on OS register state, define AVX-512 as x86-64-v4
AVX2 was reported from the CPUID bit alone. AVX2 runs on YMM
registers, so on an OS or VM that does not save YMM state (no
OSXSAVE, or XCR0 without the AVX bit) code dispatched on
RETRO_SIMD_AVX2 would fault. Require the same ymm_state check AVX
and FMA3 already use.

The AVX-512 check called xgetbv without first proving OSXSAVE is
set. xgetbv is an invalid instruction until the OS enables XSAVE, so
a CPU with AVX-512F under such an OS crashed during feature
detection. Test ymm_state first.

RETRO_SIMD_AVX512 now means the x86-64-v4 baseline: F, CD, BW, DQ
and VL. Code dispatched on it can use byte/word ops and 128/256-bit
masked forms, which is what pixel conversion, rewind diffing and
audio work need; F alone is useless for those. Every AVX-512 CPU
except Xeon Phi has all five. The Darwin path checks the matching
hw.optional keys, since macOS enables ZMM state lazily and xgetbv
cannot decide it there.
2026-10-27 19:24:45 +01:00
..