mirror of
https://github.com/sockspls/badfish
synced 2025-07-13 20:49:15 +00:00
Simplify the code to get the native flags
closes https://github.com/official-stockfish/Stockfish/pull/4908 No functional change
This commit is contained in:
parent
53ad6d23b0
commit
8724503d9c
1 changed files with 3 additions and 4 deletions
|
@ -14,10 +14,9 @@ check_flags() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set the CPU flags list
|
# Set the CPU flags list
|
||||||
|
# remove underscores and points from flags, e.g. gcc uses avx512vnni, while some cpuinfo can have avx512_vnni, some systems use sse4_1 others sse4.1
|
||||||
get_flags() {
|
get_flags() {
|
||||||
flags="$(awk '/^flags[ \t]*:/{gsub(/^flags[ \t]*:[ \t]*/, ""); line=$0} END{print line}' /proc/cpuinfo) $(awk '/^Features[ \t]*:/{gsub(/^Features[ \t]*:[ \t]*/, ""); line=$0} END{print line}' /proc/cpuinfo)"
|
flags=$(awk '/^flags[ \t]*:|^Features[ \t]*:/{gsub(/^flags[ \t]*:[ \t]*|^Features[ \t]*:[ \t]*|[_.]/, ""); line=$0} END{print line}' /proc/cpuinfo)
|
||||||
# remove underscores and points from flags, e.g. gcc uses avx512vnni, while some cpuinfo can have avx512_vnni, some systems use sse4_1 others sse4.1
|
|
||||||
flags=$(printf '%s' "$flags" | sed "s/[_.]//g")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for gcc march "znver1" or "znver2" https://en.wikichip.org/wiki/amd/cpuid
|
# Check for gcc march "znver1" or "znver2" https://en.wikichip.org/wiki/amd/cpuid
|
||||||
|
@ -55,7 +54,7 @@ case $uname_s in
|
||||||
file_arch='x86-64-sse41-popcnt' # Supported by Rosetta 2
|
file_arch='x86-64-sse41-popcnt' # Supported by Rosetta 2
|
||||||
;;
|
;;
|
||||||
'x86_64')
|
'x86_64')
|
||||||
flags=$(sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | tr '\n' ' ' | tr '[:upper:]' '[:lower:]' | sed "s/[_.]//g")
|
flags=$(sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | tr '\n' ' ' | tr '[:upper:]' '[:lower:]' | tr -d '_.')
|
||||||
set_arch_x86_64
|
set_arch_x86_64
|
||||||
if [ "$true_arch" = 'x86-64-vnni256' ] || [ "$true_arch" = 'x86-64-avx512' ]; then
|
if [ "$true_arch" = 'x86-64-vnni256' ] || [ "$true_arch" = 'x86-64-avx512' ]; then
|
||||||
file_arch='x86-64-bmi2'
|
file_arch='x86-64-bmi2'
|
||||||
|
|
Loading…
Add table
Reference in a new issue