build: set -mtune=generic

Nach explained that this is the safest and best option.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-10-16 18:37:03 +00:00
parent d23b374fbf
commit c249115b7a
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 1 additions and 29 deletions

View File

@ -623,35 +623,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT MSVC
# Optimize for Core2 and tune for Rocketlake on macOS and Zen3 for the rest
# on X86_64.
if(X86_64)
set(MY_C_FLAGS ${MY_C_FLAGS} -march=core2)
if(APPLE)
set(MY_C_FLAGS ${MY_C_FLAGS} -mtune=rocketlake)
else()
check_cxx_compiler_flag("-mtune=znver3" ZEN3_TUNE_FLAG)
if(ZEN3_TUNE_FLAG)
set(MY_C_FLAGS ${MY_C_FLAGS} -mtune=znver3)
else()
check_cxx_compiler_flag("-mtune=znver2" ZEN2_TUNE_FLAG)
if(ZEN2_TUNE_FLAG)
set(MY_C_FLAGS ${MY_C_FLAGS} -mtune=znver2)
else()
check_cxx_compiler_flag("-mtune=znver1" ZEN1_TUNE_FLAG)
if(ZEN1_TUNE_FLAG)
set(MY_C_FLAGS ${MY_C_FLAGS} -mtune=znver1)
else()
check_cxx_compiler_flag("-mtune=skylake-avx512" SKYLAKE_AVX512_TUNE_FLAG)
if(SKYLAKE_AVX512_TUNE_FLAG)
set(MY_C_FLAGS ${MY_C_FLAGS} -mtune=skylake-avx512)
else()
check_cxx_compiler_flag("-mtune=skylake" SKYLAKE_TUNE_FLAG)
if(SKYLAKE_TUNE_FLAG)
set(MY_C_FLAGS ${MY_C_FLAGS} -mtune=skylake)
endif()
endif()
endif()
endif()
endif()
endif()
set(MY_C_FLAGS ${MY_C_FLAGS} -march=core2 -mtune=generic)
# Optimize for pentium-mmx and tune for Core2 on X86_32.
elseif(X86_32)
set(MY_C_FLAGS ${MY_C_FLAGS} -march=pentium-mmx -mtune=core2)