2 ms·
There are no ways to hint the branch predictor on some common CPUs. I think Intel says it's fully dynamic and has no static predictions. If you want to cause a
by astrange 4y ago
There are no ways to hint the branch predictor on some common CPUs. I think Intel says it's fully dynamic and has no static predictions.
If you want to cause a pipeline stall, there's usually serializing instructions like cpuid/eieio.
- vgatherps 4y agoI believe intel used to always predict forward branches not taken and backward branches always taken if it didn’t have any history. Regardless, you can at least lay out code in a way that heavily favors one branch over the other, and potentially optimize for one branch (I.e. give one branch very expensive prelude/exit to make another branch very cheap). The last thing I’ve seen compilers greatly struggle with though…