cmake: try baseline optimization feature check without extra flags first

pull/25930/head
Alexander Alekhin 4 months ago
parent 78195bc3df
commit 938b9e4bb7
  1. 4
      cmake/OpenCVCompilerOptimizations.cmake
  2. 16
      cmake/checks/cpu_sse2.cpp

@ -171,7 +171,7 @@ elseif(" ${CMAKE_CXX_FLAGS} " MATCHES " -march=native | -xHost | /QxHost ")
endif()
if(X86 OR X86_64)
ocv_update(CPU_KNOWN_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;POPCNT;SSE4_2;FP16;FMA3;AVX;AVX2;AVX_512F;AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CLX;AVX512_ICL")
ocv_update(CPU_KNOWN_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;POPCNT;SSE4_2;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CLX;AVX512_ICL")
ocv_update(CPU_AVX512_COMMON_GROUP "AVX_512F;AVX_512CD")
ocv_update(CPU_AVX512_KNL_GROUP "AVX512_COMMON;AVX512_KNL_EXTRA")
@ -445,7 +445,7 @@ macro(ocv_check_compiler_optimization OPT)
set(_varname "")
if(CPU_${OPT}_TEST_FILE)
set(__available 0)
if(CPU_BASELINE_DETECT)
if(__is_from_baseline OR CPU_BASELINE_DETECT)
set(_varname "HAVE_CPU_${OPT}_SUPPORT")
ocv_check_compiler_flag(CXX "${CPU_BASELINE_FLAGS}" "${_varname}" "${CPU_${OPT}_TEST_FILE}")
if(${_varname})

@ -1,2 +1,16 @@
#include <emmintrin.h>
int main() { return 0; }
inline __m128i _v128_comgt_epu32(const __m128i& a, const __m128i& b)
{
const __m128i delta = _mm_set1_epi32((int)0x80000000);
return _mm_cmpgt_epi32(_mm_xor_si128(a, delta), _mm_xor_si128(b, delta));
}
int main()
{
__m128i a, b, c;
a = _mm_set1_epi32(0x00000000);
b = _mm_set1_epi32(0x0000ffff);
c = _v128_comgt_epu32(a, b);
return 0;
}

Loading…
Cancel
Save