From 2a09a425b2fb8cf08bd1aef93c46b1f7651fcbaa Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Mon, 23 Mar 2026 16:30:32 +0100 Subject: [PATCH] Fix subleaf in Intel CPUID --- include/xsimd/config/xsimd_cpu_features_x86.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/xsimd/config/xsimd_cpu_features_x86.hpp b/include/xsimd/config/xsimd_cpu_features_x86.hpp index 4ed361f46..70894717d 100644 --- a/include/xsimd/config/xsimd_cpu_features_x86.hpp +++ b/include/xsimd/config/xsimd_cpu_features_x86.hpp @@ -528,12 +528,12 @@ namespace xsimd __cpuidex(buf, leaf, subleaf); std::memcpy(reg.data(), buf, sizeof(buf)); -#elif defined(__INTEL_COMPILER) - int buf[4]; - __cpuid(buf, leaf); - std::memcpy(reg.data(), buf, sizeof(buf)); - -#elif defined(__GNUC__) || defined(__clang__) +// Intel compiler has long had support for `__cpuid`, but only recently for `__cpuidex`. +// Modern Clang and GCC also now support `__cpuidex`. +// It was decided to keep the inline ASM version for maximum compatibility, as the difference +// in ASM is negligible compared to the cost of CPUID. +// https://github.com/xtensor-stack/xsimd/pull/1278 +#elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER) #if defined(__i386__) && defined(__PIC__) // %ebx may be the PIC register