←back to thread

386 points ingve | 3 comments | | HN request time: 0s | source
Show context
pizza234 ◴[] No.35738299[source]
Some information on the CMOV can be found on the Intel Optimization Reference Manual (https://cdrdv2-public.intel.com/671488/248966-046A-software-...).

Torvalds was famously critical of it (https://yarchive.net/comp/linux/cmov.html); part of the criticism is now moot though, due to low latencies on modern processors (it seems 1 cycle or less, although the instruction consumes internal flags).

His idea seems to be still applicable and consistent with Intel's recommendation: make branches predictable, and only after, use CMOV for the remaining ones. His fundametnal assumption is that "even if you were to know that something is unpredictable, it's going to be very rare.".

replies(3): >>35738345 #>>35741256 #>>35742105 #
1. zulu-inuoe ◴[] No.35741256[source]
404 on that Torvalds link
replies(2): >>35741714 #>>35742100 #
2. pizza234 ◴[] No.35741714[source]
The HN renderer is rendering the closing round bracket and semicolon as part of the HTML link, which is unfortunate for this case, but good to know :)
3. msla ◴[] No.35742100[source]
https://yarchive.net/comp/linux/cmov.html