> Added heuristics to convert CMOV into branches when it may be profitable
Does anyone know why this is the case? I thought CMOVs are a straight win over branches but I guess modern CPUs might be more complicated than that.
Does anyone know why this is the case? I thought CMOVs are a straight win over branches but I guess modern CPUs might be more complicated than that.
- Branch is well predicted
- Condition operand is expensive, compared to True-value and the False-value operands"
https://reviews.llvm.org/D34769
"We have seen periodically performance problems with cmov where one operand comes from memory. On modern x86 processors with strong branch predictors and speculative execution, this tends to be much better done with a branch than cmov. We routinely see cmov stalling while the load is completed rather than continuing, and if there are subsequent branches, they cannot be speculated in turn."