From ac68e7f99996cf1f70884b262f9d02f0dd0519d1 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 17 Sep 2024 13:31:46 -0700 Subject: [PATCH] aarch64_cpudetect: detect SVE/SVE2 on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PF_ARM_SVE_INSTRUCTIONS_AVAILABLE and PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE are available in WinSDK 10.0.26100 and recent versions of mingw-w64. Based on a patch by Martin Storsjö on ffmpeg-devel: https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333611.html Change-Id: I34b2341a559f95aa400e84d709f3eb36da5dbb7b --- vpx_ports/aarch64_cpudetect.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vpx_ports/aarch64_cpudetect.c b/vpx_ports/aarch64_cpudetect.c index 4cc4891457d..df8e1e244d6 100644 --- a/vpx_ports/aarch64_cpudetect.c +++ b/vpx_ports/aarch64_cpudetect.c @@ -90,6 +90,23 @@ static int arm_get_cpu_caps(void) { } #endif // defined(PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE) #endif // HAVE_NEON_I8MM +#if HAVE_SVE +// Support for PF_ARM_SVE_INSTRUCTIONS_AVAILABLE was added in Windows SDK 26100. +#if defined(PF_ARM_SVE_INSTRUCTIONS_AVAILABLE) + if (IsProcessorFeaturePresent(PF_ARM_SVE_INSTRUCTIONS_AVAILABLE)) { + flags |= HAS_SVE; + } +#endif // defined(PF_ARM_SVE_INSTRUCTIONS_AVAILABLE) +#endif // HAVE_SVE +#if HAVE_SVE2 +// Support for PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE was added in Windows SDK +// 26100. +#if defined(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE) + if (IsProcessorFeaturePresent(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE)) { + flags |= HAS_SVE2; + } +#endif // defined(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE) +#endif // HAVE_SVE2 return flags; }