Skip to content

Commit 49e0f48

Browse files
authored
Add -mavx2 for TARGET=HASWELL if compiler supports and requires it
1 parent 43c2b0e commit 49e0f48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmake/system.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ if (DEFINED TARGET)
4545
if (${TARGET} STREQUAL "SKYLAKEX" AND NOT NO_AVX512)
4646
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512")
4747
endif()
48+
if (${TARGET} STREQUAL "HASWELL" AND NOT NO_AVX2)
49+
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
50+
if (${GCC_VERSION} VERSION_GREATER 4.7 OR ${GCC_VERSION} VERSION_EQUAL 4.7)
51+
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mavx2")
52+
endif()
53+
endif()
4854
endif()
4955

5056
if (DEFINED TARGET)

0 commit comments

Comments
 (0)