Skip to content

Commit a356f00

Browse files
authored
Merge pull request #1273 from AntoinePrv/x86-more
Add popcnt and bmi to x86 cpu features
2 parents 741e58c + dab371a commit a356f00

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/xsimd/config/xsimd_cpu_features_x86.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ namespace xsimd
120120
sse4_1 = 19,
121121
/* Streaming SIMD Extensions 4.2. */
122122
sse4_2 = 20,
123+
/* Population count instruction (POPCNT). */
124+
popcnt = 23,
123125
/* OS has enabled XSAVE/XRSTOR for extended processor state management. */
124126
osxsave = 27,
125127
/* Advanced Vector Extensions (256-bit SIMD). */
@@ -154,8 +156,12 @@ namespace xsimd
154156
};
155157
enum class ebx
156158
{
159+
/* Bit Manipulation Instruction Set 1. */
160+
bmi1 = 3,
157161
/* Advanced Vector Extensions 2 (integer 256-bit SIMD). */
158162
avx2 = 5,
163+
/* Bit Manipulation Instruction Set 2. */
164+
bmi2 = 8,
159165
/* AVX-512 Foundation instructions. */
160166
avx512f = 16,
161167
/* AVX-512 Doubleword and Quadword instructions. */
@@ -404,12 +410,18 @@ namespace xsimd
404410

405411
inline bool sse4_2() const noexcept { return sse_enabled() && leaf1().all_bits_set<x86_cpuid_leaf1::ecx::sse4_2>(); }
406412

413+
inline bool popcnt() const noexcept { return leaf1().all_bits_set<x86_cpuid_leaf1::ecx::popcnt>(); }
414+
407415
inline bool fma3() const noexcept { return sse_enabled() && leaf1().all_bits_set<x86_cpuid_leaf1::ecx::fma3>(); }
408416

409417
inline bool avx() const noexcept { return avx_enabled() && leaf1().all_bits_set<x86_cpuid_leaf1::ecx::avx>(); }
410418

419+
inline bool bmi1() const noexcept { return leaf7().all_bits_set<x86_cpuid_leaf7::ebx::bmi1>(); }
420+
411421
inline bool avx2() const noexcept { return avx_enabled() && leaf7().all_bits_set<x86_cpuid_leaf7::ebx::avx2>(); }
412422

423+
inline bool bmi2() const noexcept { return leaf7().all_bits_set<x86_cpuid_leaf7::ebx::bmi2>(); }
424+
413425
inline bool avx512f() const noexcept { return avx512_enabled() && leaf7().all_bits_set<x86_cpuid_leaf7::ebx::avx512f>(); }
414426

415427
inline bool avx512dq() const noexcept { return avx512_enabled() && leaf7().all_bits_set<x86_cpuid_leaf7::ebx::avx512dq>(); }

0 commit comments

Comments
 (0)