2 ms·
1. When quoting the latency of an instruction, it is customary to quote the latency that the instruction itself adds to a dependency chain. CMOV itself had inde
by gpderetta 4y ago
1. When quoting the latency of an instruction, it is customary to quote the latency that the instruction itself adds to a dependency chain. CMOV itself had indeed higher latency on P4 (Although Agner only claims 6 cycles, not 10 like Linus).
Still, the advantage of conditional branches is that they do indeed break dependency chains and allow OoO execution, whether that's a win or not depend on the prediction rate of the specific branch and the length of the chain.
2. Well I only checked Agner for Ice (which BTW came out in 2019). But CMOV has had a 1 clock latency since Broadwell (2014). It had been 2 clock cycles for a few generation before. The number of generated uops has also significantly decreased.
- jabl 4y agoWrt #2, there is the additional argument that when selecting compiler optimizations for a -mtune=generic (or equivalent) target, it makes sense to be a bit "forward leaning", as it'll be a while before your work ends up in a released version, and even further time goes by until that compiler release ends up in the hands of users.