Skip to content

Commit

Permalink
CMake: add x86-64 feature levels
Browse files Browse the repository at this point in the history
Add x86-64 feature levels from https://gitlab.com/x86-psABIs/x86-64-ABI
See also https://www.phoronix.com/scan.php?page=news_item&px=GCC-11-x86-64-Feature-Levels

Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
  • Loading branch information
stephanlachnit authored and amadio committed Apr 8, 2022
1 parent d03fa55 commit 644f41c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion cmake/OptimizeForArchitecture.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Other supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Cor
\"haswell\", \"broadwell\", \"skylake\", \"skylake-xeon\", \"kaby-lake\", \"cannonlake\", \"icelake\", \"silvermont\", \
\"goldmont\", \"knl\" (Knights Landing), \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \
\"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\", \
\"AMD 14h\", \"AMD 16h\", \"zen\", \"zen3\".")
\"AMD 14h\", \"AMD 16h\", \"zen\", \"zen3\", \"x86-64\", \"x86-64-v2\", \"x86-64-v3\", \"x86-64-v4\".")
set(_force)
if(NOT _last_target_arch STREQUAL "${TARGET_ARCHITECTURE}")
message(STATUS "target changed from \"${_last_target_arch}\" to \"${TARGET_ARCHITECTURE}\"")
Expand Down Expand Up @@ -308,6 +308,25 @@ Other supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Cor
list(APPEND _march_flag_list "goldmont")
_silvermont()
endmacro()
macro(_x86_64)
list(APPEND _march_flag_list "x86-64")
list(APPEND _march_flag_list "sse" "sse2")
endmacro()
macro(_x86_64_v2)
list(APPEND _march_flag_list "x86-64-v2")
_x86_64()
list(APPEND _march_flag_list "sse3" "sse4.1" "sse4.2" "ssse3")
endmacro()
macro(_x86_64_v3)
list(APPEND _march_flag_list "x86-64-v3")
_x86_64_v2()
list(APPEND _march_flag_list "avx" "avx2" "bmi" "bmi2" "f16c" "fma")
endmacro()
macro(_x86_64_v4)
list(APPEND _march_flag_list "x86-64-v4")
_x86_64_v3()
list(APPEND _march_flag_list "avx512f" "avx512bw" "avx512cd" "avx512dq" "avx512vl")
endmacro()

if(TARGET_ARCHITECTURE STREQUAL "core")
list(APPEND _march_flag_list "core2")
Expand Down Expand Up @@ -412,6 +431,14 @@ Other supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Cor
list(APPEND _march_flag_list "barcelona")
list(APPEND _march_flag_list "core2")
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a")
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64")
_x86_64()
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64-v2")
_x86_64_v2()
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64-v3")
_x86_64_v3()
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64-v4")
_x86_64_v4()
elseif(TARGET_ARCHITECTURE STREQUAL "generic")
list(APPEND _march_flag_list "generic")
elseif(TARGET_ARCHITECTURE STREQUAL "none")
Expand Down

0 comments on commit 644f41c

Please sign in to comment.