On Fri, May 9, 2014 at 2:50 PM, Ben Noordhuis <[email protected]> wrote:
> [...] Jokes aside, a while ago I did some non-scientific benchmarks on cmov > vs. cmp + a conditional jump (trying to speed up polymorphic functions > in OCaml) and cmov was always slower on an i7. Maybe it performs > better on older CPUs, I didn't test that. > I'm not sure that CMOV is really a win, either. Perhaps we should try to kick out CMOV completely and have a look at the performance numbers. Unless there is a clear win on some platform we care about, I strongly propose to kick CMOV out completely, it would nicely simplify things further. > I'm not 100% sure why that is but Linus Torvalds puts forth some > hypotheses here[1] that sound plausible: the branch predictor > speculates that the branch last taken will be taken again. Most > branches are not perfectly equally distributed so branch prediction is > a win on average. Whereas cmov always has a data dependency and > therefore isn't amenable to that kind of speculative execution. > > [1] http://yarchive.net/comp/linux/cmov.html I know that article, but it's 7 years old and from the weird performance characteristics of modern processors I've seen so far I am highly reluctant to predict anything (although I have a gut feeling that CMOV is a bad idea nowadays). :-) Separate instructions on the assembler level get merged into single microcode operations and vice versa, OOO execution, register renaming, pipelines, varying number of shifting units, branch prediction, ... make things basically unpredictable if you just look at the machine code. So let's measure... -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
