aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/examples/cpuid.cpp3
-rw-r--r--src/utils/cpuid.cpp4
-rw-r--r--src/utils/cpuid.h7
3 files changed, 11 insertions, 3 deletions
diff --git a/doc/examples/cpuid.cpp b/doc/examples/cpuid.cpp
index 9ffb810a9..c231397e4 100644
--- a/doc/examples/cpuid.cpp
+++ b/doc/examples/cpuid.cpp
@@ -36,11 +36,12 @@ int main()
print_if_feature("SSE4.1", CPUID::has_sse41());
print_if_feature("SSE4.2", CPUID::has_sse42());
print_if_feature("AVX2", CPUID::has_avx2());
- print_if_feature("BMI2", CPUID::has_bmi2());
+ print_if_feature("AVX-512F", CPUID::has_avx512f());
print_if_feature("AltiVec", CPUID::has_altivec());
print_header("Other extensions");
print_if_feature("RDTSC", CPUID::has_rdtsc());
+ print_if_feature("BMI2", CPUID::has_bmi2());
print_if_feature("PCMUL", CPUID::has_pcmuludq());
print_if_feature("AES-NI", CPUID::has_aes_ni());
print_if_feature("RDRAND", CPUID::has_rdrand());
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,