From f7c66423a174060175a0206161ffecb50eb7c2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 9 Jul 2024 15:33:16 +0200 Subject: [PATCH 1/2] Enable use of only one flag in configure Example: Suppose FLAG1 is preferred over FLAG2, and they are not compatible with each other. Then, if compiler accepts FLAG1, it should only choose FLAG1. However, if compiler does not accept FLAG1, but FLAG2 is accepted, it should choose FLAG2. --- configure.ac | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 76b90392ae..862e17ecb4 100644 --- a/configure.ac +++ b/configure.ac @@ -1225,11 +1225,22 @@ then for opt in $gcc_cflags_optlist; do eval tmp=\"\$gcc_cflags_${opt}\" # " Just to fix highlighting + # found_single is for checking if we have found a flag that should be + # alone in its type. Example: On Skylake, -march=skylake should not be + # accompanied by -march=broadwell; instead, if we find that + # -march=skylake is accepted, we do not want to check -march=broadwell. + found_single="no" for flag in $tmp; do - if test opt = "arch"; + if test "$found_single" = "yes"; then - AX_CHECK_COMPILE_FLAG([$flag],[save_CFLAGS="$flag $save_CFLAGS"], + found_single="no" + break + elif test "$opt" = "arch"; + then + AX_CHECK_COMPILE_FLAG([$flag], + [save_CFLAGS="$flag $save_CFLAGS" + found_single="yes"], [unset flint_cv_have_fft_small_x86_i unset flint_cv_have_fft_small_arm_i]) else From a63191e0957ce9657e0ba5ebf7f2f4156d92199e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Tue, 9 Jul 2024 15:37:34 +0200 Subject: [PATCH 2/2] Add -march=znver3 as backup for Zen 4 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 862e17ecb4..b9cfcc2c6c 100644 --- a/configure.ac +++ b/configure.ac @@ -306,7 +306,7 @@ Please report at ]) param_path="x86_64/zen3" ;; zen4) - gcc_cflags_arch="-march=znver4" + gcc_cflags_arch="-march=znver4 -march=znver3" param_path="x86_64/zen3" have_avx512="yes" ;;