From: Andre Ramnitz Date: Thu, 17 Sep 2026 18:02:20 +0000 (+0200) Subject: sys-devel/gcc: znver5 tune branch misprediction X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;p=etc_portage_patches.git sys-devel/gcc: znver5 tune branch misprediction --- diff --git a/sys-devel/gcc/patch_x86_increase_znver4_5_tune_branch_misprediction_cost.patch b/sys-devel/gcc/patch_x86_increase_znver4_5_tune_branch_misprediction_cost.patch new file mode 100644 index 0000000..fe1503e --- /dev/null +++ b/sys-devel/gcc/patch_x86_increase_znver4_5_tune_branch_misprediction_cost.patch @@ -0,0 +1,47 @@ +Increase the branch misprediction scale for znver4/5 tuning from +COSTS_N_INSNS (2) to COSTS_N_INSNS (2) + 3. + +This improves 544.nab_r by 12% (-O3 -march=native -flto) on Znver5 +and 9% on Znver4 with single-copy. + +gcc/ChangeLog: + + * config/i386/x86-tune-costs.h (znver4_cost): Increase branch + mispredict scale from COSTS_N_INSNS (2) to COSTS_N_INSNS (2) + 3. + (znver5_cost): Likewise. +--- + +Hi Maintainers, + +Bootstrapped and tested on x86_64-linux, Ok for staging? + +regards, +Venkat. + + gcc/config/i386/x86-tune-costs.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h +index bc3bb694349..8be780d73da 100644 +--- a/gcc/config/i386/x86-tune-costs.h ++++ b/gcc/config/i386/x86-tune-costs.h +@@ -2231,7 +2231,7 @@ struct processor_costs znver4_cost = { + "16", /* Func alignment. */ + 4, /* Small unroll limit. */ + 2, /* Small unroll factor. */ +- COSTS_N_INSNS (2), /* Branch mispredict scale. */ ++ COSTS_N_INSNS (2) + 3, /* Branch mispredict scale. */ + }; + + /* This table currently replicates znver4_cost table. */ +@@ -2399,7 +2399,7 @@ struct processor_costs znver5_cost = { + "16", /* Func alignment. */ + 4, /* Small unroll limit. */ + 2, /* Small unroll factor. */ +- COSTS_N_INSNS (2), /* Branch mispredict scale. */ ++ COSTS_N_INSNS (2) + 3, /* Branch mispredict scale. */ + }; + + /* skylake_cost should produce code tuned for Skylake family of CPUs. */ +-- +2.34.1