[4/5] powerpc/perf: Change name & type of 'pred' in power_pmu_bhrb_read
mpe at ellerman.id.au
Wed Jul 29 13:25:55 AEST 2015
On Tue, 2015-30-06 at 08:20:30 UTC, Anshuman Khandual wrote:
> Branch record attributes 'mispred' and 'predicted' are single bit
> fields as defined in the perf ABI. Hence the data type of the field
> 'pred' used during BHRB processing should be changed from integer
> to bool. This patch also changes the name of the variable from 'pred'
> to 'mispred' making the logical inversion process more meaningful
> and readable.
This whole function is a mess.
There's no good reason why we're doing the assignment to pred/mispred in two
places to begin with, so if that was eliminated we wouldn't need a local for
mispred to begin with.
Then there's the type juggling, all of which probably works but is fishy and
You take a u64, bitwise and it with a mask, assign that to a boolean, then take
the boolean, *bitwise* negate that and assign the result to a single bit
> + bool mispred;
> + mispred = val & BHRB_PREDICTION;
> + cpuhw->bhrb_entries[u_index].predicted = ~mispred;
More information about the Linuxppc-dev