From 23d5871f4a0084a62cbeb4a289bacccc5e914b69 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Sat, 24 Oct 2020 13:20:57 +0200 Subject: [PATCH] archs: MSVC 2013 and greater don't have a SSE flag But still they support SSE built-in. Add FORCE_ARCH macro to enable SIMD architecture for compilers which don't have a compiler flag to check for them. --- gen/archs.xml | 3 --- lib/CMakeLists.txt | 15 +++++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gen/archs.xml b/gen/archs.xml index 56689f1ac..cd6905f12 100644 --- a/gen/archs.xml +++ b/gen/archs.xml @@ -66,7 +66,6 @@ -mmmx -mmmx - /arch:SSE 8 @@ -82,7 +81,6 @@ -msse -msse - /arch:SSE _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); xmmintrin.h 16 @@ -92,7 +90,6 @@ -msse2 -msse2 - /arch:SSE2 16 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 37aaed5e5..74585300c 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -138,6 +138,11 @@ macro(OVERRULE_ARCH arch reason) list(REMOVE_ITEM available_archs ${arch}) endmacro(OVERRULE_ARCH) +macro(FORCE_ARCH arch reason) + message(STATUS "${reason}, Forced arch ${arch}") + list(APPEND available_archs ${arch}) +endmacro(FORCE_ARCH) + ######################################################################## # eliminate AVX on if not on x86, or if the compiler does not accept # the xgetbv instruction, or {if not cross-compiling and the xgetbv @@ -257,13 +262,15 @@ if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86) endif() #MSVC 64 bit does not have MMX, overrule it - if (${SIZEOF_CPU} EQUAL 64 AND MSVC) + if (MSVC) + if (${SIZEOF_CPU} EQUAL 64) OVERRULE_ARCH(mmx "No MMX for Win64") - if (MSVC_VERSION GREATER 1700) - OVERRULE_ARCH(sse "No SSE for Win64 Visual Studio 2013") - endif() + endif() + FORCE_ARCH(sse "Built-in for MSVC > 2013") + FORCE_ARCH(sse2 "Built-in for MSVC > 2013") endif() + endif() ########################################################################