[host] cmake: use -march=x86-64-v2 when it becomes available

GCC 11 will support x86_64 micro-architecture feature levels.
What we really want to support is nehalem or newer, which is x86-64-v2,
and specifying this instead of nehalem means that we are not tuning for
nehalem specifically.
This commit is contained in:
Quantum 2021-07-19 20:55:20 -04:00 committed by Geoffrey McRae
parent f5ad14b109
commit 0525515bee

View File

@ -17,10 +17,15 @@ if(OPTIMIZE_FOR_NATIVE)
add_compile_options("-march=native") add_compile_options("-march=native")
endif() endif()
else() else()
CHECK_C_COMPILER_FLAG("-march=x86-64-v2" COMPILER_SUPPORTS_MARCH_X86_64_V2)
if(COMPILER_SUPPORTS_MARCH_X86_64_V2)
add_compile_options("-march=x86-64-v2")
else()
CHECK_C_COMPILER_FLAG("-march=nehalem" COMPILER_SUPPORTS_MARCH_NEHALEM) CHECK_C_COMPILER_FLAG("-march=nehalem" COMPILER_SUPPORTS_MARCH_NEHALEM)
if(COMPILER_SUPPORTS_MARCH_NEHALEM) if(COMPILER_SUPPORTS_MARCH_NEHALEM)
add_compile_options("-march=nehalem") add_compile_options("-march=nehalem")
endif() endif()
endif()
endif() endif()
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON) option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)