diff options
author | lloyd <[email protected]> | 2013-12-25 07:16:42 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-12-25 07:16:42 +0000 |
commit | 4df481d89ddbfe7bc4b29875762ec200e6986dfd (patch) | |
tree | e152b081a4a76a5fd4180a5163716f8568e0bdab /src | |
parent | 2d08403fba517571ee1959c39664ffa63357b8f3 (diff) |
Add CPUID check for AVX-512
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/cpuid.cpp | 4 | ||||
-rw-r--r-- | src/utils/cpuid.h | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp index d903b7d41..c727471bc 100644 --- a/src/utils/cpuid.cpp +++ b/src/utils/cpuid.cpp @@ -200,10 +200,10 @@ void CPUID::initialize() #if defined(BOTAN_TARGET_ARCH_IS_X86_64) /* * If we don't have access to CPUID, we can still safely assume that - * any x86-64 processor has SSE2. + * any x86-64 processor has SSE2 and RDTSC */ if(m_x86_processor_flags[0] == 0) - m_x86_processor_flags[0] = (1 << CPUID_SSE2_BIT); + m_x86_processor_flags[0] = (1 << CPUID_SSE2_BIT) | (1 << CPUID_RDTSC_BIT); #endif } diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h index eaf1c1330..008605e0c 100644 --- a/src/utils/cpuid.h +++ b/src/utils/cpuid.h @@ -65,6 +65,12 @@ class BOTAN_DLL CPUID { return x86_processor_flags_has(CPUID_AVX2_BIT); } /** + * Check if the processor supports AVX-512F + */ + static bool has_avx512f() + { return x86_processor_flags_has(CPUID_AVX512F_BIT); } + + /** * Check if the processor supports BMI2 */ static bool has_bmi2() @@ -123,6 +129,7 @@ class BOTAN_DLL CPUID CPUID_AVX2_BIT = 64+5, CPUID_BMI2_BIT = 64+8, + CPUID_AVX512F_BIT = 64+16, CPUID_RDSEED_BIT = 64+18, CPUID_ADX_BIT = 64+19, CPUID_SHA_BIT = 64+29, |