Skip to content

Commit d365d29

Browse files
junparserserge-sans-paille
authored andcommitted
Initial support for avx512vbmi
1 parent a44a9f5 commit d365d29

File tree

7 files changed

+91
-2
lines changed

7 files changed

+91
-2
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/***************************************************************************
2+
* Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3+
* Martin Renou *
4+
* Copyright (c) QuantStack *
5+
* Copyright (c) Serge Guelton *
6+
* *
7+
* Distributed under the terms of the BSD 3-Clause License. *
8+
* *
9+
* The full license is in the file LICENSE, distributed with this software. *
10+
****************************************************************************/
11+
12+
#ifndef XSIMD_AVX512VBMI2_HPP
13+
#define XSIMD_AVX512VBMI2_HPP
14+
15+
#include <array>
16+
#include <type_traits>
17+
18+
#include "../types/xsimd_avx512vbmi2_register.hpp"
19+
20+
#endif

include/xsimd/arch/xsimd_isa.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
#include "./xsimd_avx512vbmi.hpp"
9393
#endif
9494

95+
#if XSIMD_WITH_AVX512VBMI2
96+
#include "./xsimd_avx512vbmi2.hpp"
97+
#endif
98+
9599
#if XSIMD_WITH_AVX512VNNI_AVX512BW
96100
#include "./xsimd_avx512vnni_avx512bw.hpp"
97101
#endif

include/xsimd/config/xsimd_arch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ namespace xsimd
162162
} // namespace detail
163163

164164
using all_x86_architectures = arch_list<
165-
avx512vnni<avx512vbmi>, avx512vbmi, avx512ifma, avx512pf, avx512vnni<avx512bw>, avx512bw, avx512er, avx512dq, avx512cd, avx512f,
165+
avx512vnni<avx512vbmi>, avx512vbmi2, avx512vbmi, avx512ifma, avx512pf, avx512vnni<avx512bw>, avx512bw, avx512er, avx512dq, avx512cd, avx512f,
166166
avxvnni, fma3<avx2>, avx2, fma3<avx>, avx, fma4, fma3<sse4_2>,
167167
sse4_2, sse4_1, /*sse4a,*/ ssse3, sse3, sse2>;
168168

include/xsimd/config/xsimd_config.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,17 @@
299299
#define XSIMD_WITH_AVX512VBMI 0
300300
#endif
301301

302+
/**
303+
* @ingroup xsimd_config_macro
304+
*
305+
* Set to 1 if AVX512VBMI2 is available at compile-time, to 0 otherwise.
306+
*/
307+
#ifdef __AVX512VBMI2__
308+
#define XSIMD_WITH_AVX512VBMI2 XSIMD_WITH_AVX512F
309+
#else
310+
#define XSIMD_WITH_AVX512VBMI2 0
311+
#endif
312+
302313
/**
303314
* @ingroup xsimd_config_macro
304315
*
@@ -455,7 +466,7 @@
455466

456467
#endif
457468

458-
#if !XSIMD_WITH_SSE2 && !XSIMD_WITH_SSE3 && !XSIMD_WITH_SSSE3 && !XSIMD_WITH_SSE4_1 && !XSIMD_WITH_SSE4_2 && !XSIMD_WITH_AVX && !XSIMD_WITH_AVX2 && !XSIMD_WITH_AVXVNNI && !XSIMD_WITH_FMA3_SSE && !XSIMD_WITH_FMA4 && !XSIMD_WITH_FMA3_AVX && !XSIMD_WITH_FMA3_AVX2 && !XSIMD_WITH_AVX512F && !XSIMD_WITH_AVX512CD && !XSIMD_WITH_AVX512DQ && !XSIMD_WITH_AVX512BW && !XSIMD_WITH_AVX512ER && !XSIMD_WITH_AVX512PF && !XSIMD_WITH_AVX512IFMA && !XSIMD_WITH_AVX512VBMI && !XSIMD_WITH_NEON && !XSIMD_WITH_NEON64 && !XSIMD_WITH_SVE && !XSIMD_WITH_RVV && !XSIMD_WITH_WASM
469+
#if !XSIMD_WITH_SSE2 && !XSIMD_WITH_SSE3 && !XSIMD_WITH_SSSE3 && !XSIMD_WITH_SSE4_1 && !XSIMD_WITH_SSE4_2 && !XSIMD_WITH_AVX && !XSIMD_WITH_AVX2 && !XSIMD_WITH_AVXVNNI && !XSIMD_WITH_FMA3_SSE && !XSIMD_WITH_FMA4 && !XSIMD_WITH_FMA3_AVX && !XSIMD_WITH_FMA3_AVX2 && !XSIMD_WITH_AVX512F && !XSIMD_WITH_AVX512CD && !XSIMD_WITH_AVX512DQ && !XSIMD_WITH_AVX512BW && !XSIMD_WITH_AVX512ER && !XSIMD_WITH_AVX512PF && !XSIMD_WITH_AVX512IFMA && !XSIMD_WITH_AVX512VBMI && !XSIMD_WITH_AVX512VBMI2 && !XSIMD_WITH_NEON && !XSIMD_WITH_NEON64 && !XSIMD_WITH_SVE && !XSIMD_WITH_RVV && !XSIMD_WITH_WASM
459470
#define XSIMD_NO_SUPPORTED_ARCHITECTURE
460471
#endif
461472

include/xsimd/config/xsimd_cpuid.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ namespace xsimd
7171
ARCH_FIELD(avx512pf)
7272
ARCH_FIELD(avx512ifma)
7373
ARCH_FIELD(avx512vbmi)
74+
ARCH_FIELD(avx512vbmi2)
7475
ARCH_FIELD_EX(avx512vnni<::xsimd::avx512bw>, avx512vnni_bw)
7576
ARCH_FIELD_EX(avx512vnni<::xsimd::avx512vbmi>, avx512vnni_vbmi)
7677
ARCH_FIELD(neon)
@@ -245,6 +246,7 @@ namespace xsimd
245246
avx512pf = regs7[1] >> 26 & avx512_state_os_enabled;
246247
avx512ifma = regs7[1] >> 21 & avx512_state_os_enabled;
247248
avx512vbmi = regs7[2] >> 1 & avx512_state_os_enabled;
249+
avx512vbmi2 = regs7[2] >> 6 & avx512_state_os_enabled;
248250
avx512vnni_bw = regs7[2] >> 11 & avx512_state_os_enabled;
249251
avx512vnni_vbmi = avx512vbmi && avx512vnni_bw;
250252
#endif

include/xsimd/types/xsimd_all_registers.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "xsimd_avx512vnni_avx512vbmi_register.hpp"
2727

2828
#include "xsimd_avx512ifma_register.hpp"
29+
#include "xsimd_avx512vbmi2_register.hpp"
2930
#include "xsimd_avx512vbmi_register.hpp"
3031

3132
#include "xsimd_avx512er_register.hpp"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/***************************************************************************
2+
* Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3+
* Martin Renou *
4+
* Copyright (c) QuantStack *
5+
* Copyright (c) Serge Guelton *
6+
* *
7+
* Distributed under the terms of the BSD 3-Clause License. *
8+
* *
9+
* The full license is in the file LICENSE, distributed with this software. *
10+
****************************************************************************/
11+
12+
#ifndef XSIMD_AVX512VBMI2_REGISTER_HPP
13+
#define XSIMD_AVX512VBMI2_REGISTER_HPP
14+
15+
#include "./xsimd_avx512vbmi_register.hpp"
16+
17+
namespace xsimd
18+
{
19+
20+
/**
21+
* @ingroup architectures
22+
*
23+
* AVX512VBMI instructions
24+
*/
25+
struct avx512vbmi2 : avx512vbmi
26+
{
27+
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VBMI2; }
28+
static constexpr bool available() noexcept { return true; }
29+
static constexpr char const* name() noexcept { return "avx512vbmi2"; }
30+
};
31+
32+
#if XSIMD_WITH_AVX512VBMI2
33+
34+
#if !XSIMD_WITH_AVX512VBMI
35+
#error "architecture inconsistency: avx512vbmi2 requires avx512vbmi"
36+
#endif
37+
38+
namespace types
39+
{
40+
template <class T>
41+
struct get_bool_simd_register<T, avx512vbmi2>
42+
{
43+
using type = simd_avx512_bool_register<T>;
44+
};
45+
46+
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(avx512vbmi2, avx512vbmi);
47+
48+
}
49+
#endif
50+
}
51+
#endif

0 commit comments

Comments
 (0)