From 9a53cc13950800cabce289e27a7deccdeeb1bedf Mon Sep 17 00:00:00 2001 From: janwas Date: Wed, 24 Aug 2011 09:23:44 +0000 Subject: [PATCH] __SSE[2]__ didn't work on MSVC/ICC after all; introduce HAVE_SSE[2] instead This was SVN commit r10089. --- source/lib/pointer_typedefs.h | 14 ++++++++------ source/lib/sysdep/compiler.h | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/source/lib/pointer_typedefs.h b/source/lib/pointer_typedefs.h index f0d5cabc53..0862ee5846 100644 --- a/source/lib/pointer_typedefs.h +++ b/source/lib/pointer_typedefs.h @@ -1,10 +1,12 @@ #ifndef INCLUDED_POINTER_TYPEDEFS #define INCLUDED_POINTER_TYPEDEFS -#ifdef __SSE__ +#include "lib/sysdep/compiler.h" // HAVE_SSE + +#if HAVE_SSE # include // __m64, __m128 #endif -#ifdef __SSE2__ +#if HAVE_SSE2 # include // __m128i, __m128d #endif @@ -152,7 +154,7 @@ typedef const double* const cpcDouble; typedef const double* __restrict rpcDouble; typedef const double* const __restrict crpcDouble; -#ifdef __SSE__ +#if HAVE_SSE typedef __m64* pM64; typedef __m64* const cpM64; typedef __m64* __restrict rpM64; @@ -170,9 +172,9 @@ typedef const __m128* pcM128; typedef const __m128* const cpcM128; typedef const __m128* __restrict rpcM128; typedef const __m128* const __restrict crpcM128; -#endif // __SSE__ +#endif // #if HAVE_SSE -#ifdef __SSE2__ +#if HAVE_SSE2 typedef __m128i* pM128I; typedef __m128i* const cpM128I; typedef __m128i* __restrict rpM128I; @@ -190,6 +192,6 @@ typedef const __m128d* pcM128D; typedef const __m128d* const cpcM128D; typedef const __m128d* __restrict rpcM128D; typedef const __m128d* const __restrict crpcM128D; -#endif // __SSE2__ +#endif // #if HAVE_SSE2 #endif // #ifndef INCLUDED_POINTER_TYPEDEFS diff --git a/source/lib/sysdep/compiler.h b/source/lib/sysdep/compiler.h index 9d2a946bba..b1b4d32c8c 100644 --- a/source/lib/sysdep/compiler.h +++ b/source/lib/sysdep/compiler.h @@ -98,4 +98,28 @@ # endif #endif + +// Streaming SIMD Extensions (not supported by all GCC) +// this only ascertains compiler support; use x86_x64_cap to +// check whether the instructions are supported by the CPU. +#ifndef HAVE_SSE +# if GCC_VERSION && defined(__SSE__) +# define HAVE_SSE 1 +# elif MSC_VERSION // also includes ICC +# define HAVE_SSE 1 +# else +# define HAVE_SSE 0 +# endif +#endif + +#ifndef HAVE_SSE2 +# if GCC_VERSION && defined(__SSE2__) +# define HAVE_SSE2 1 +# elif MSC_VERSION // also includes ICC +# define HAVE_SSE2 1 +# else +# define HAVE_SSE2 0 +# endif +#endif + #endif // #ifndef INCLUDED_COMPILER