Skip to content

Commit

Permalink
Also check AVX512BW bit
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Sep 19, 2024
1 parent b0ede82 commit 35e1a1c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions crypto/fipsmodule/cpucap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,13 @@ OPENSSL_INLINE int CRYPTO_is_VPCLMULQDQ_capable(void) {
return (OPENSSL_ia32cap_get()[3] & (1u << (42 - 32))) != 0;
}

// AVX512VL | AVX512_IFMA | AVX512DQ | AVX512F
// 1u << 31 | 1u << 21 | 1u << 17 | 1u << 16
// 1000_0000_0010_0011_0000_0000_0000_0000
#define CPU_CAP_AVX512IFMA_BITFLAGS 0x80230000
// AVX512VL | AVX512BW | AVX512_IFMA | AVX512DQ | AVX512F
// 1u << 31 | 1u << 30 | 1u << 21 | 1u << 17 | 1u << 16
// 1100_0000_0010_0011_0000_0000_0000_0000
#define CPU_CAP_AVX512IFMA_BITFLAGS 0xC0230000
OPENSSL_INLINE int CRYPTO_is_AVX512IFMA_capable(void) {
#ifdef _MSC_VER
return 0;
#else
return (OPENSSL_ia32cap_get()[2] & CPU_CAP_AVX512IFMA_BITFLAGS) ==
CPU_CAP_AVX512IFMA_BITFLAGS;
#endif
}

OPENSSL_INLINE int CRYPTO_is_VBMI2_capable(void) {
Expand Down

0 comments on commit 35e1a1c

Please sign in to comment.