This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Make PROB_VERY_LIKELY more likely.
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Anton Blanchard <anton at samba dot org>
- Date: Mon, 7 Feb 2005 14:28:10 +1030
- Subject: Make PROB_VERY_LIKELY more likely.
Currently, PROB_VERY_UNLIKELY and PROB_VERY_LIKELY are given values that
correspond to slightly less than 10% and slightly more than 90%. I'd
like to change that to 1% and 99%, because builtin_expect uses
PROB_VERY_LIKELY. 90% isn't high enough to suit power4 branch hints,
where we only want to give static prediction hints on branches if the
calculated probability is greater than the hit-rate of the processor
dynamic branch prediction unit. rs6000.c:output_cbranch uses a level of
98% (which is possibly a little optimistic), so for builtin_expect to
cause branch hints we need better than 98%. REG_BR_PROB_BASE is 10000,
so 1% is still a reasonable number to work with, ie. it's
distinguishable from 0.
PR 19803
* predict.c (PROB_VERY_UNLIKELY): Use 1% instead of 10%.
Bootstrap, regression test on powerpc64-linux in progress. OK for
mainline and 3.4?
Index: gcc/predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.137
diff -u -p -r1.137 predict.c
--- gcc/predict.c 20 Jan 2005 12:45:12 -0000 1.137
+++ gcc/predict.c 7 Feb 2005 03:51:14 -0000
@@ -67,7 +67,7 @@ static sreal real_zero, real_one, real_a
real_inv_br_prob_base, real_one_half, real_bb_freq_max;
/* Random guesstimation given names. */
-#define PROB_VERY_UNLIKELY (REG_BR_PROB_BASE / 10 - 1)
+#define PROB_VERY_UNLIKELY (REG_BR_PROB_BASE / 100 - 1)
#define PROB_EVEN (REG_BR_PROB_BASE / 2)
#define PROB_VERY_LIKELY (REG_BR_PROB_BASE - PROB_VERY_UNLIKELY)
#define PROB_ALWAYS (REG_BR_PROB_BASE)
--
Alan Modra
IBM OzLabs - Linux Technology Centre