From 2af4da0ea9ee0b029e89cf5ab65d378d426d1af1 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Fri, 13 Nov 2015 16:31:13 +0100 Subject: improve compile time SSE2 detection, fix broken android build Prereq. to enable runtime SSE2 detection is that the compiler supports it in the first place. MSVS and GCC use different compiler flags for this so use __LO_SSE2_AVAILABLE__ to make this build platform independent. emmintrin.h is unavailable on ARM Android so include this and compile the SSE2 specific code only when we are sure we can build SSE2 code (__LO_SSE2_AVAILABLE__ is defined). Change-Id: I212c4e0b99a314d087b9def822a81325b25f3469 --- include/tools/cpuid.hxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/tools/cpuid.hxx') diff --git a/include/tools/cpuid.hxx b/include/tools/cpuid.hxx index 244512989cb6..348724e024dd 100644 --- a/include/tools/cpuid.hxx +++ b/include/tools/cpuid.hxx @@ -14,6 +14,12 @@ #include #include +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && defined(__SSE2__) +#define __LO_SSE2_AVAILABLE__ 1 +#elif defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) +#define __LO_SSE2_AVAILABLE__ 1 +#endif + namespace tools { namespace cpuid -- cgit