Skip to content

Commit

Permalink
Fix checking of label suffix (#2248)
Browse files Browse the repository at this point in the history
* Update X86_64_PATTERN and X86_64_ADX_PATTERN

- Add missing patterns in X86_64_PATTERN from X86_64_ADX_PATTERN

- Add zen5 in X86_64_ADX_PATTERN

* Add Zen 5 recognition in config.(guess|sub)

* Check presence of install-sh instead of config.guess

During bootstrapping, config.guess is always present.

* Conditionally check for LABEL_SUFFIX

As it is only used for x86_64 and ARM64 in longlong_asm_gnu.h, only
check the suffix when host is either of these architectures.

* Set CFLAGS and temporary param_path for Zen 5
  • Loading branch information
albinahlback authored Mar 6, 2025
1 parent 3806e5e commit 277980c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ define(X86_PATTERN,
[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])

define(X86_64_PATTERN,
[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | tremont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | cometlake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-* | alderlake*-*-* | raptorlake*-*-* | meteorlake*-*-* | x86_64v[1234]-*-*]])
[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | tremont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | x86_64v[1234]-*-* | nano-*-* | nehalem-*-* | westmere-*-* | sandybridge-*-* | ivybridge-*-* | haswell-*-* | zen[12345]-*-* | broadwell-*-* | skylake-*-* | skylake_server-*-* | cannonlake-*-* | kabylake-*-* | cometlake-*-* | icelake-*-* | icelake_server-*-* | rocketlake-*-* | tigerlake-*-* | alderlake-*-* | raptorlake-*-* | meteorlake-*-* | knightslanding-*-* | sapphirerapids-*-*]])

define(X86_64_ADX_PATTERN,
[[zen[1234]-*-* | coreibwl-*-* | broadwell-*-* | skylake-*-* | skylake_server-*-* | cannonlake-*-* | kabylake-*-* | cometlake-*-* | icelake-*-* | icelake_server-*-* | rocketlake-*-* | tigerlake-*-* | alderlake-*-* | raptorlake-*-* | meteorlake-*-* | knightslanding-*-* | sapphirerapids-*-*]])
[[zen[12345]-*-* | broadwell-*-* | skylake-*-* | skylake_server-*-* | cannonlake-*-* | kabylake-*-* | cometlake-*-* | icelake-*-* | icelake_server-*-* | rocketlake-*-* | tigerlake-*-* | alderlake-*-* | raptorlake-*-* | meteorlake-*-* | knightslanding-*-* | sapphirerapids-*-*]])

define(ARM64_PATTERN,
[[armcortexa53-*-* | armcortexa53neon-*-* | armcortexa55-*-* | armcortexa55neon-*-* | armcortexa57-*-* | armcortexa57neon-*-* | armcortexa7[2-9]-*-* | armcortexa7[2-9]neon-*-* | armexynosm1-*-* | armthunderx-*-* | armxgene1-*-* | aarch64*-*-* | applem[1-9]*-*-* | armv8*-*-*]])
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -rf autom4te.cache
autoreconf -i -v -Wall

# The following lines are from Semigroups/Semigroups, written by Max Horn.
if ! test -x config/config.guess -a -x config/config.sub ;
if ! test -x config/install-sh ;
then
automake -acf 2> /dev/null || :
fi
Expand Down
4 changes: 4 additions & 0 deletions config/config.guess
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,10 @@ main ()
modelstr = "zen4";
break;
}
break;
case 26: /* Zen 5 */
cpu_64bit = 1, cpu_avx = 1, modelstr = "zen5";
break;
}
}
else if (strcmp (vendor_string, "HygonGenuine") == 0)
Expand Down
2 changes: 1 addition & 1 deletion config/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ itanium | itanium2)
test_cpu=ia64 ;;
pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
test_cpu=i386 ;;
athlon64 | atom | silvermont | goldmont | tremont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen[1234] | nano | nehalem | westmere | sandybridge | ivybridge | haswell | broadwell | skylake | skylake_server | cannonlake | kabylake | icelake | icelake_server | rocketlake | tigerlake | alderlake | raptorlake | meteorlake | knightslanding | sapphirerapids | cometlake | x86_64v[1234])
athlon64 | k8 | k10 | bobcat | jaguar | bulldozer | piledriver | steamroller | excavator | pentium4 | atom | silvermont | goldmont | tremont | core2 | corei* | x86_64 | x86_64v[1234] | nano | nehalem | westmere | sandybridge | ivybridge | haswell | zen[12345] | broadwell | skylake | skylake_server | cannonlake | kabylake | cometlake | icelake | icelake_server | rocketlake | tigerlake | alderlake | raptorlake | meteorlake | knightslanding | sapphirerapids)
test_cpu=x86_64 ;;
power[2-9] | power1[0-9] | power2sc)
test_cpu=power ;;
Expand Down
23 changes: 16 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,12 @@ Please report at <https://github.com/flintlib/flint/issues/>])
param_path="x86_64/zen4"
have_avx512="yes"
;;
coreibwl | broadwell)
zen5)
gcc_cflags_arch="-march=znver5 -march=znver4"
param_path="x86_64/zen4" # fallback, to be refined
have_avx512="yes"
;;
broadwell)
gcc_cflags_arch="-march=broadwell"
param_path="x86_64/broadwell"
;;
Expand Down Expand Up @@ -1396,12 +1401,16 @@ then

GMP_FINISH
else
# NOTE: LSYM_PREFIX is needed for longlong_asm_gnu.h
GMP_INIT(tmpconf)
GMP_ASM_TEXT
GMP_ASM_LABEL_SUFFIX
GMP_ASM_LSYM_PREFIX
rm -f $gmp_tmpconfigm4 $gmp_tmpconfigm4i $gmp_tmpconfigm4p
# LSYM_PREFIX is still needed for x86-64 and ARM64 in longlong_asm_gnu.h
case $host in
ARM64_PATTERN | X86_64_PATTERN)
GMP_INIT(tmpconf)
GMP_ASM_TEXT
GMP_ASM_LABEL_SUFFIX
GMP_ASM_LSYM_PREFIX
rm -f $gmp_tmpconfigm4 $gmp_tmpconfigm4i $gmp_tmpconfigm4p
;;
esac
fi

if test "$enable_assembly" = "yes";
Expand Down

0 comments on commit 277980c

Please sign in to comment.