5 ms·
Well a branch will fetch the incorrect cache line if it mispredicts, but a conditional move will fetch both cache lines every time.
by cautious_int 11y ago
Well a branch will fetch the incorrect cache line if it mispredicts, but a conditional move will fetch both cache lines every time.
- rrrlasse 11y agoThe conditional move is the statement `low = v >= value ? low : other_low;` which either assigns `other_low` to `low` or does nothing. And other_low is a variable, and not an arbitrary element of the list (which is a big difference with respect to cache), and it can also be seen from the assembly that it's stored in register. So there there is no "both cache lines" to fetch anything from.
- cautious_int 11y agoThe conditional move still depends on both values taken from the array, via other variables.