SIMD optimizations: do not use AVX2 flag globally

pull/27/head
f4exb 2016-11-08 00:38:57 +01:00
rodzic 57b50f47a9
commit a40f31ed4a
1 zmienionych plików z 11 dodań i 11 usunięć

Wyświetl plik

@ -416,17 +416,17 @@ message( STATUS "Architecture: ${ARCHITECTURE}" )
if (${ARCHITECTURE} MATCHES "x86_64|AMD64|x86")
EXECUTE_PROCESS( COMMAND grep flags /proc/cpuinfo OUTPUT_VARIABLE CPU_FLAGS )
if (${CPU_FLAGS} MATCHES "avx2")
set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" )
message(STATUS "Use AVX2 SIMD instructions")
add_definitions(-DUSE_AVX2)
else()
set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled")
endif()
endif()
# if (${CPU_FLAGS} MATCHES "avx2")
# set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
# if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
# set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" )
# set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" )
# message(STATUS "Use AVX2 SIMD instructions")
# add_definitions(-DUSE_AVX2)
# else()
# set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled")
# endif()
# endif()
if (${CPU_FLAGS} MATCHES "sse4_1")
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)