Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: add x86-64 feature levels #326

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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