aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-08-08 21:06:40 +0000
committerlloyd <[email protected]>2010-08-08 21:06:40 +0000
commit2c8e172411337ec2d072f9feb08e4df96942586c (patch)
treef12ac61cefcec5b0b9be41dc028587e6bce305f5 /src
parentc334c2e542cf9952a8fd25300cd663b824b14b09 (diff)
If we can't access cpuid, but we know that we are compiling for
x86-64, then enable SSE2 anyway because we know any x86-64 processor does have SSE2, and the OS has to support it because it's part of the standard ABIs.
Diffstat (limited to 'src')
-rw-r--r--src/utils/cpuid.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp
index b76210865..40b27863e 100644
--- a/src/utils/cpuid.cpp
+++ b/src/utils/cpuid.cpp
@@ -151,6 +151,15 @@ void CPUID::initialize()
x86_processor_flags = ((u64bit)cpuid[2] << 32) | cpuid[3];
+#if defined(BOTAN_TARGET_ARCH_IS_AMD64)
+ /*
+ * If we don't have access to CPUID, we can still safely assume that
+ * any x86-64 processor has SSE2.
+ */
+ if(x86_processor_flags == 0)
+ x86_processor_flags |= (1 << CPUID_SSE2_BIT);
+#endif
+
cache_line = get_x86_cache_line_size();
altivec_capable = false;