News for hackers. Stuff that matters.
Re:RISC-V formal spec public review by astrange on Friday June 21, 2019 @02:53AM (#20240467)
> 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.

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).
Re:RISC-V formal spec public review by astrange on Friday June 21, 2019 @07:12AM (#20241455)
Yes, but we need the opposite. There's no way to say a branch has no expected value.
Re:RISC-V formal spec public review by dooglius on Friday June 21, 2019 @09:43AM (#20242396)
Clang does have __builtin_unpredictable, but last I checked it doesn't actually seem to have an effect.