Timeline for Countdown program in x86 NASM
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 1, 2015 at 10:39 | comment | added | Voo | @Jeff Do modern Intel architectures actually understand that the mov with zero breaks dependencies? If not that'd be an important difference. | |
Dec 31, 2014 at 20:46 | comment | added | gyc | @SirPython the code generated by xor eax,eax is "33 C0", for mov eax,0 it is "B800000000" | |
Dec 31, 2014 at 20:40 | comment | added | Jeff Mercado |
@SirPython: Using xor to clear a register resulted in a smaller instruction. It only requires a single byte to represent in machine code. Explicitly moving a value of 0 in on the other hand results in a larger instruction (I want to say 3 or 4 bytes). Nowadays it's no longer an issue but critical when you wanted to leave a small memory footprint back then when we had only a few MiB or KiB to work with. These days, it is still a useful instruction to use (I would even say, idiomatic).
|
|
Dec 31, 2014 at 20:26 | comment | added | gyc | @mbomb007 that's why I said "reducing the size of your code" :) (think about payload size for buffer overflows) But that test was conducted in 2004 on a P4, I wouldn't take it for granted. | |
Dec 31, 2014 at 19:33 | comment | added | mbomb007 | @gyc One of the optimizations you suggested is not a good one. See mark.masmcode.com . Add/sub are both faster than inc/dec. | |
Dec 31, 2014 at 19:28 | comment | added | SirPython |
I've actually been meaning to ask this: why is xor eax, eax preferred over mov eax, 0 ?
|
|
Dec 31, 2014 at 18:59 | history | edited | Jamal | CC BY-SA 3.0 |
deleted 63 characters in body
|
Dec 31, 2014 at 18:57 | review | First posts | |||
Dec 31, 2014 at 19:21 | |||||
Dec 31, 2014 at 18:54 | history | answered | gyc | CC BY-SA 3.0 |