mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-19 08:35:45 +00:00
[block-freq] Add a right shift to BlockFrequency that saturates at 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197302 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -145,6 +145,18 @@ BlockFrequency::operator+(const BlockFrequency &Prob) const {
|
||||
return Freq;
|
||||
}
|
||||
|
||||
BlockFrequency &BlockFrequency::operator>>=(const unsigned count) {
|
||||
// Frequency can never be 0 by design.
|
||||
assert(Frequency != 0);
|
||||
|
||||
// Shift right by count.
|
||||
Frequency >>= count;
|
||||
|
||||
// Saturate to 1 if we are 0.
|
||||
Frequency |= Frequency == 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint32_t BlockFrequency::scale(const BranchProbability &Prob) {
|
||||
return scale(Prob.getNumerator(), Prob.getDenominator());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user