4 ms·
Can someone clarify something for me in that second assembly dump: It does: xor %eax %eax (2 bytes) mov $0x0,%edi (5 bytes) Why does it decide to use 2 di
by hyperman1 6y ago
Can someone clarify something for me in that second assembly dump: It does:
xor %eax %eax (2 bytes)
mov $0x0,%edi (5 bytes)
Why does it decide to use 2 different ways to zero a register, the second one less efficient than the first? Or will the second one be patched while linking, i.e. the 0 is a placeholder for some other address?
- langarto 6y agoExactly, the 0 is a placeholder for the address of the format string (first argument for printf).
- hyperman1 6y agoUpdate: Looking further, there seems to be a lot of space wasted in the disas factorial example: It is 32+1=33 bytes long, or even 48 if the next function will be aligned on a 16 bytes boundary. There are 2 nop's in there, consuming 6 and 4 bytes. So at least 10/33=about 30% of the memory is traded for aligning jumps on 8 (or 16?) byte boundaries. This seems a big waste of L1I cache. Is this a normal ratio? Does -Os much better?