Merge pull request #11403 from alalek:cmake_fix_cpu_baseline

pull/11410/head
Alexander Alekhin 7 years ago
commit 79d41aad64
  1. 8
      cmake/OpenCVCompilerOptimizations.cmake
  2. 2
      cmake/checks/cpu_fp16.cpp

@ -234,6 +234,7 @@ if(X86 OR X86_64)
elseif(MSVC)
ocv_update(CPU_AVX2_FLAGS_ON "/arch:AVX2")
ocv_update(CPU_AVX_FLAGS_ON "/arch:AVX")
ocv_update(CPU_FP16_FLAGS_ON "/arch:AVX")
if(NOT MSVC64)
# 64-bit MSVC compiler uses SSE/SSE2 by default
ocv_update(CPU_SSE_FLAGS_ON "/arch:SSE")
@ -422,6 +423,9 @@ foreach(OPT ${CPU_KNOWN_OPTIMIZATIONS})
if(__is_disabled)
set(__is_from_baseline 0)
else()
if(CPU_${OPT}_SUPPORTED AND CPU_BASELINE_DETECT)
list(APPEND CPU_BASELINE_FINAL ${OPT})
endif()
ocv_is_optimization_in_list(__is_from_baseline ${OPT} ${CPU_BASELINE_REQUIRE})
if(NOT __is_from_baseline)
ocv_is_optimization_in_list(__is_from_baseline ${OPT} ${CPU_BASELINE})
@ -441,7 +445,9 @@ foreach(OPT ${CPU_KNOWN_OPTIMIZATIONS})
if(";${CPU_DISPATCH};" MATCHES ";${OPT};" AND NOT __is_from_baseline)
list(APPEND CPU_DISPATCH_FINAL ${OPT})
elseif(__is_from_baseline)
list(APPEND CPU_BASELINE_FINAL ${OPT})
if(NOT ";${CPU_BASELINE_FINAL};" MATCHES ";${OPT};")
list(APPEND CPU_BASELINE_FINAL ${OPT})
endif()
ocv_append_optimization_flag(CPU_BASELINE_FLAGS ${OPT})
endif()
endif()

@ -1,6 +1,6 @@
#include <stdio.h>
#if defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700) || (defined __INTEL_COMPILER && defined __AVX__)
#if defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700 && defined __AVX__) || (defined __INTEL_COMPILER && defined __AVX__)
#include <immintrin.h>
int test()
{

Loading…
Cancel
Save