4 ms·
1. Comparisons (no branch, just compare) 2. u/int add/subtract/bit operations Is there a reason you follow Andrei's lead and suggest that comparisons operation
by nkurz 13y ago
1. Comparisons (no branch, just compare) 2. u/int add/subtract/bit operations
Is there a reason you follow Andrei's lead and suggest that comparisons operations are faster than integer subtraction? At least for x64 on Intel, I think they would always be the same speed and thus should be grouped together. Are they different on the other platforms?
- mattgodbolt 13y agoThe only justification I can think of for that statement is that on modern processors (Sandy Bridge and above), micro-op fusion in the decode stage can fuse a comparison with a branch that immediately follows it, turning it into a "compare and branch" micro-op.
- spc476 13y agoOne possibility: the compare only updates one register (flags), not two (flags and the destination register).