diff options
author | lloyd <[email protected]> | 2013-12-31 14:59:48 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-12-31 14:59:48 +0000 |
commit | 98991e5c9326a480b890ef7ce112ebfb1216f1ae (patch) | |
tree | 829715d1432a39824368617048e8ee63f63f34d0 /src | |
parent | abefc88850c37fe97b4a8588aa13fcdefd9f7b5e (diff) |
Add CPUID::print
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/cpuid.cpp | 26 | ||||
-rw-r--r-- | src/utils/cpuid.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp index c727471bc..75a88c6b8 100644 --- a/src/utils/cpuid.cpp +++ b/src/utils/cpuid.cpp @@ -9,6 +9,7 @@ #include <botan/types.h> #include <botan/get_byte.h> #include <botan/mem_ops.h> +#include <ostream> #if defined(BOTAN_TARGET_CPU_IS_PPC_FAMILY) @@ -153,6 +154,31 @@ bool altivec_check_pvr_emul() } +void CPUID::print(std::ostream& o) + { + o << "CPUID flags: "; + +#define CPUID_PRINT(flag) do { if(has_##flag()) o << #flag << " "; } while(0) + CPUID_PRINT(sse2); + CPUID_PRINT(ssse3); + CPUID_PRINT(sse41); + CPUID_PRINT(sse42); + CPUID_PRINT(avx2); + CPUID_PRINT(avx512f); + CPUID_PRINT(altivec); + + CPUID_PRINT(rdtsc); + CPUID_PRINT(bmi2); + CPUID_PRINT(clmul); + CPUID_PRINT(aes_ni); + CPUID_PRINT(rdrand); + CPUID_PRINT(rdseed); + CPUID_PRINT(intel_sha); + CPUID_PRINT(adx); +#undef CPUID_PRINT + o << "\n"; + } + void CPUID::initialize() { #if defined(BOTAN_TARGET_CPU_IS_PPC_FAMILY) diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h index 67657d2ee..1c4c1df0b 100644 --- a/src/utils/cpuid.h +++ b/src/utils/cpuid.h @@ -9,6 +9,7 @@ #define BOTAN_CPUID_H__ #include <botan/types.h> +#include <iosfwd> namespace Botan { @@ -116,6 +117,8 @@ class BOTAN_DLL CPUID * Check if the processor supports AltiVec/VMX */ static bool has_altivec() { return m_altivec_capable; } + + static void print(std::ostream& o); private: enum CPUID_bits { CPUID_RDTSC_BIT = 4, |