* config/rs6000/rs6000.c (output_cbranch): Hint differently for power4.

From-SVN: r55967
This commit is contained in:
Alan Modra 2002-08-02 02:53:24 +00:00 committed by Alan Modra
parent 77ca7b2ecb
commit f4857b9b42
2 changed files with 22 additions and 9 deletions

View file

@ -1,3 +1,7 @@
2002-08-02 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/rs6000.c (output_cbranch): Hint differently for power4.
2002-08-01 Daniel Jacobowitz <drow@mvista.com>
* Makefile.in ($(BUILD_PREFIX_1)ggc-none.o): Use $(GGC_H).

View file

@ -8438,21 +8438,30 @@ output_cbranch (op, label, reversed, insn)
/* Maybe we have a guess as to how likely the branch is.
The old mnemonics don't have a way to specify this information. */
pred = "";
note = find_reg_note (insn, REG_BR_PROB, NULL_RTX);
if (note != NULL_RTX)
{
/* PROB is the difference from 50%. */
int prob = INTVAL (XEXP (note, 0)) - REG_BR_PROB_BASE / 2;
/* For branches that are very close to 50%, assume not-taken. */
if (abs (prob) > REG_BR_PROB_BASE / 20
&& ((prob > 0) ^ need_longbranch))
pred = "+";
else
pred = "-";
bool always_hint = rs6000_cpu != PROCESSOR_POWER4;
/* Only hint for highly probable/improbable branches on newer
cpus as static prediction overrides processor dynamic
prediction. For older cpus we may as well always hint, but
assume not taken for branches that are very close to 50% as a
mispredicted taken branch is more expensive than a
mispredicted not-taken branch. */
if (always_hint
|| abs (prob) > REG_BR_PROB_BASE / 100 * 48)
{
if (abs (prob) > REG_BR_PROB_BASE / 20
&& ((prob > 0) ^ need_longbranch))
pred = "+";
else
pred = "-";
}
}
else
pred = "";
if (label == NULL)
s += sprintf (s, "{b%sr|b%slr%s} ", ccode, ccode, pred);