3 ms·
Read a little further down to WiSaGaN's answer. There's an excellent discussion of the optimizations afforded by the cmovge instruction that is typically genera
by localhost 9y ago
Read a little further down to WiSaGaN's answer. There's an excellent discussion of the optimizations afforded by the cmovge instruction that is typically generated for the C ternary operator and how its implementation in the CPU pipeline allows it to avoid the branch misprediction penalty.
He references a textbook as well "Computer Systems: A Programmer's Perspective (2nd Edition)". Just bought a copy.
- xigency 9y agoSee this also for a case against CMOV predicates: http://yarchive.net/comp/linux/cmov.html http://yarchive.net/comp/linux/cmov.html