From dab371ac889c777eb445596ffd4b2a9804593c8d Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Wed, 18 Mar 2026 17:58:11 +0100 Subject: [PATCH] Add popcnt and bmi --- include/xsimd/config/xsimd_cpu_features_x86.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/xsimd/config/xsimd_cpu_features_x86.hpp b/include/xsimd/config/xsimd_cpu_features_x86.hpp index 76564d5f7..4ed361f46 100644 --- a/include/xsimd/config/xsimd_cpu_features_x86.hpp +++ b/include/xsimd/config/xsimd_cpu_features_x86.hpp @@ -120,6 +120,8 @@ namespace xsimd sse4_1 = 19, /* Streaming SIMD Extensions 4.2. */ sse4_2 = 20, + /* Population count instruction (POPCNT). */ + popcnt = 23, /* OS has enabled XSAVE/XRSTOR for extended processor state management. */ osxsave = 27, /* Advanced Vector Extensions (256-bit SIMD). */ @@ -154,8 +156,12 @@ namespace xsimd }; enum class ebx { + /* Bit Manipulation Instruction Set 1. */ + bmi1 = 3, /* Advanced Vector Extensions 2 (integer 256-bit SIMD). */ avx2 = 5, + /* Bit Manipulation Instruction Set 2. */ + bmi2 = 8, /* AVX-512 Foundation instructions. */ avx512f = 16, /* AVX-512 Doubleword and Quadword instructions. */ @@ -404,12 +410,18 @@ namespace xsimd inline bool sse4_2() const noexcept { return sse_enabled() && leaf1().all_bits_set(); } + inline bool popcnt() const noexcept { return leaf1().all_bits_set(); } + inline bool fma3() const noexcept { return sse_enabled() && leaf1().all_bits_set(); } inline bool avx() const noexcept { return avx_enabled() && leaf1().all_bits_set(); } + inline bool bmi1() const noexcept { return leaf7().all_bits_set(); } + inline bool avx2() const noexcept { return avx_enabled() && leaf7().all_bits_set(); } + inline bool bmi2() const noexcept { return leaf7().all_bits_set(); } + inline bool avx512f() const noexcept { return avx512_enabled() && leaf7().all_bits_set(); } inline bool avx512dq() const noexcept { return avx512_enabled() && leaf7().all_bits_set(); }