3 ms·
Linus once wrote a nice (typically Linus) rant on why cmov is a terrible idea in most cases: http://yarchive.net/comp/linux/cmov.html http://yarchive.net/comp/
by yongjik 12y ago
Linus once wrote a nice (typically Linus) rant on why cmov is a terrible idea in most cases:
http://yarchive.net/comp/linux/cmov.html http://yarchive.net/comp/linux/cmov.html
> In contrast, if you use a predicated instruction, ALL of it is on the critical path. Calculating the conditional is on the critical path. Calculating the value that gets used is obviously ALSO on the critical path, but so is the calculation for the value that DOESN'T get used too. So the cmov - rather than speeding things up - actually slows things down, because it makes more code be dependent on each other.
- mtdewcmu 12y agoHuh. I guess the reason it works in the article is that the value is not calculated, it's just a constant.