
11 Sep
2009
11 Sep
'09
4:25 p.m.
DE wrote:
on 11.09.2009 at 3:19 Cory Nelson wrote :
I'm curious, have you actually tried to look at the generated instructions? of course
Because on a 686+ this should compile this into two non-branching instructions for min(): cmp a, b cmova a, b And the same thing but with cmovb for max(). neither icc11 nor msvc80 generate such instructions msvc generates a conditional jump and icc generates code "without branches but with the sbb asm instruction" (c) Joel Falcou
I believe the conditional move introduces a dependency that is about as bad as a conditional jump. It also limits the code to the latest processor models. The compilers generally try to avoid this situation. :-) Bo Persson