From 0159cbb1a29f7a1fd6569948def3fdf42b3e3798 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 27 Jan 2017 11:07:14 -0800 Subject: Move the declaration of SSE3 & newer macros above their use Change-Id: I445bb15619f6401494e8fffd149db66da3405b48 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/tools/qsimd_p.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/corelib/tools/qsimd_p.h') diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index f9c4d0d5ce..ab9f383803 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -181,6 +181,20 @@ # define QT_FUNCTION_TARGET(x) #endif +#if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__)) +// Visual Studio defines __AVX__ when /arch:AVX is passed, but not the earlier macros +// See: https://msdn.microsoft.com/en-us/library/b0084kay.aspx +// SSE2 is handled by _M_IX86_FP below +# define __SSE3__ 1 +# define __SSSE3__ 1 +// no Intel CPU supports SSE4a, so don't define it +# define __SSE4_1__ 1 +# define __SSE4_2__ 1 +# ifndef __AVX__ +# define __AVX__ 1 +# endif +#endif + // SSE intrinsics #define QT_FUNCTION_TARGET_STRING_SSE2 "sse2" #if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) @@ -229,20 +243,6 @@ #if defined(__AVX__) || (defined(QT_COMPILER_SUPPORTS_AVX) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) // immintrin.h is the ultimate header, we don't need anything else after this #include - -# if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__)) -// MS Visual Studio 2010 has no macro pre-defined to identify the use of /arch:AVX -// MS Visual Studio 2013 adds it: __AVX__ -// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32 -# define __SSE3__ 1 -# define __SSSE3__ 1 -// no Intel CPU supports SSE4a, so don't define it -# define __SSE4_1__ 1 -# define __SSE4_2__ 1 -# ifndef __AVX__ -# define __AVX__ 1 -# endif -# endif #endif #define QT_FUNCTION_TARGET_STRING_AVX512F "avx512f" -- cgit v1.2.3