aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/examples/cpuid.cpp1
-rw-r--r--src/utils/cpuid.h9
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/examples/cpuid.cpp b/doc/examples/cpuid.cpp
index 62b565edf..f4d441ba2 100644
--- a/doc/examples/cpuid.cpp
+++ b/doc/examples/cpuid.cpp
@@ -30,6 +30,7 @@ int main()
print_if_feature("SSSE3", CPUID::has_ssse3());
print_if_feature("SSE4.1", CPUID::has_sse41());
print_if_feature("SSE4.2", CPUID::has_sse42());
+ print_if_feature("AVX", CPUID::has_avx());
print_if_feature("AES-NI", CPUID::has_aes_intel());
diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h
index dbac89455..e0ccee515 100644
--- a/src/utils/cpuid.h
+++ b/src/utils/cpuid.h
@@ -54,6 +54,12 @@ class BOTAN_DLL CPUID
{ return ((x86_processor_flags() >> CPUID_SSE42_BIT) & 1); }
/**
+ * Check if the processor supports extended AVX vector instructions
+ */
+ static bool has_avx()
+ { return ((x86_processor_flags() >> CPUID_AVX_BIT) & 1); }
+
+ /**
* Check if the processor supports Intel's AES instructions
*/
static bool has_aes_intel()
@@ -70,7 +76,8 @@ class BOTAN_DLL CPUID
CPUID_SSSE3_BIT = 41,
CPUID_SSE41_BIT = 51,
CPUID_SSE42_BIT = 52,
- CPUID_INTEL_AES_BIT = 57
+ CPUID_INTEL_AES_BIT = 57,
+ CPUID_AVX_BIT = 60
};
static u64bit x86_processor_flags();