@@ -56,7 +56,7 @@ namespace xsimd
5656 constexpr static x86_xcr0 safe_default () noexcept
5757 {
5858 reg_t low = {};
59- low = utils::set_bit<sse_bit >(low);
59+ low = utils::set_bit<static_cast < reg_t >(bit::sse) >(low);
6060 return x86_xcr0 (low);
6161 }
6262
@@ -71,28 +71,52 @@ namespace xsimd
7171
7272 constexpr bool sse_enabled () const noexcept
7373 {
74- return utils:: bit_is_set<sse_bit >(m_low);
74+ return bit_is_set<bit::sse >(m_low);
7575 }
7676
7777 constexpr bool avx_enabled () const noexcept
7878 {
7979 // Check both SSE and AVX bits even though AVX must imply SSE
80- return utils:: bit_is_set<sse_bit, avx_bit >(m_low);
80+ return bit_is_set<bit::sse, bit::avx >(m_low);
8181 }
8282
8383 constexpr bool avx512_enabled () const noexcept
8484 {
8585 // Check all SSE, AVX, and AVX512 bits even though AVX512 must
8686 // imply AVX and SSE
87- return utils:: bit_is_set<sse_bit, avx_bit, avx512_bit >(m_low);
87+ return bit_is_set<bit::sse, bit::avx, bit::zmm_hi256 >(m_low);
8888 }
8989
9090 private:
9191 using reg_t = detail::xcr0_reg_t ;
9292
93- static constexpr reg_t sse_bit = 1 ;
94- static constexpr reg_t avx_bit = 2 ;
95- static constexpr reg_t avx512_bit = 6 ;
93+ enum class bit : reg_t
94+ {
95+ /* * x87 FPU/MMX support (must be 1). */
96+ x87 = 0 ,
97+ /* * XSAVE support for MXCSR and XMM registers. */
98+ sse = 1 ,
99+ /* * AVX enabled and XSAVE support for upper halves of YMM registers. */
100+ avx = 2 ,
101+ /* * MPX enabled and XSAVE support for BND0-BND3 registers. */
102+ bndreg = 3 ,
103+ /* * MPX enabled and XSAVE support for BNDCFGU and BNDSTATUS registers. */
104+ bndcsr = 4 ,
105+ /* * AVX-512 enabled and XSAVE support for opmask registers k0-k7. */
106+ opmask = 5 ,
107+ /* * AVX-512 enabled and XSAVE support for upper halves of lower ZMM registers. */
108+ zmm_hi256 = 6 ,
109+ /* * AVX-512 enabled and XSAVE support for upper ZMM registers. */
110+ hi16_zmm = 7 ,
111+ /* * XSAVE support for PKRU register. */
112+ pkru = 9 ,
113+ };
114+
115+ template <bit... Bits>
116+ static constexpr bool bit_is_set (reg_t value) noexcept
117+ {
118+ return utils::bit_is_set<static_cast <reg_t >(Bits)...>(value);
119+ }
96120
97121 /* * Parse a XCR0 value into individual components. */
98122 constexpr explicit x86_xcr0 (reg_t low) noexcept
0 commit comments