3 ms·
> It is crazy how simple x86 assembly language programming makes checking overflow compared to C. It's easy to write, but not so easy to optimize the performan
by bsder 8y ago
> It is crazy how simple x86 assembly language programming makes checking overflow compared to C.
It's easy to write, but not so easy to optimize the performance.
Overflow checking creates a dependency in between operations and requires the emission of instructions that didn't have to be there before.
i += 1
<branch if overflow>
i += 1
<etc>
Means that you are executing more than twice the number of instructions and are getting further behind on the dependency chain each iteration. Eventually, your branch subsystem is completely overwhelmed by a branch that is taken effectively never.
- abenedic 8y agoish, you can use cmov for some stuff.
- AstralStorm 8y agoWhere is it available in MIPS?
- snaky 8y ago> cmov's can make a difference. You can use them to avoid polluting your branch prediction tables, you can use them to make code smaller, and you can use them when they simply just fit the problem really well. It's just _not_ the case that they are "obviously better". They simply aren't. https://yarchive.net/comp/linux/cmov.html https://yarchive.net/comp/linux/cmov.html
- Mikhail_Edoshin 8y agoIf the upper bound is known, then we'll just make the check once before the loop, no?