3 ms·
> Cmov is one of the methods to mitigate Spectre because Intel refuses to speculate loads in them. Sure, this is what makes it good for mispredictable branches
by astrange 7y ago
> Cmov is one of the methods to mitigate Spectre because Intel refuses to speculate loads in them.
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.
- fluffything 7y agoThey can't guess, which is why they all offer `__builtin_expect` to control them (which people often wrap in LIKELY/UNLIKELY macros).