Re:RISC-V formal spec public review
by fluffything on Friday June 21, 2019 @05:33AM
(#20241091)
They can't guess, which is why they all offer `__builtin_expect` to control them (which people often wrap in LIKELY/UNLIKELY macros).
Yes, but we need the opposite. There's no way to say a branch has no expected value.
Sure, this is what makes it good for mispredictable branches - data decompression for instance. If you can't speculate ahead, it's a waste of space in the branch prediction buffer to do it.
But I definitely wish it was a builtin function instead of the compiler generating it, because none of them can guess when to use it.