Hi,
This patch increases the branch misprediction scale for generic tuning to
better reflect the cost on modern CPUs with deeper pipelines.
Bootstrapped and regression tested on x86_64-pc-linux-gnu. OK for trunk?
Thanks,
Lili.
Increase the branch misprediction scale for generic tuning from
COSTS_N_INSNS (2) to COSTS_N_INSNS (2) + 3.
Modern CPUs have deeper pipelines, making branch mispredictions more
expensive. Increasing this cost encourages if-conversion, avoiding
pipeline stalls from mispredicted branches.
This improves 544.nab_r (-O2) by 12.7% on GNR and 12.1% on Znver5 with
single-copy.
gcc/ChangeLog:
* config/i386/x86-tune-costs.h (generic_cost): Increase branch
mispredict scale from COSTS_N_INSNS (2) to COSTS_N_INSNS (2) + 3.
---
gcc/config/i386/x86-tune-costs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h
index 7819fdf7c02..0c687a11a74 100644
--- a/gcc/config/i386/x86-tune-costs.h
+++ b/gcc/config/i386/x86-tune-costs.h
@@ -4274,7 +4274,7 @@ struct processor_costs generic_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. */
};
/* core_cost should produce code tuned for Core familly of CPUs. */
--
2.34.1