clrbhrb
Clear Branch History Rolling Buffer
Clear Branch History Rolling Buffer. Clears all entries in the Branch History Rolling Buffer (BHRB) to zero. Used to flush branch prediction history, for example when switching execution contexts to prevent information leakage between security domains.
Details
Sets all BHRB entries to 0s.
Pseudocode Operation
for n = 0 to (number_of_BHRBEs implemented - 1)
BHRB(n) ←0
Programming Note
The clrbhrb instruction is used to clear the Branch History Rolling Buffer, resetting all its entries to zero. This can be useful for ensuring a predictable state before branch prediction analysis or when isolating performance tests. However, it should be used with caution as it affects speculative execution paths, potentially impacting performance if not necessary.