brushwud,
On x86, you can operate on signed 8-bit immediate (or literal) data and produce an 8-, 16-, or 32-bit result. Or you can use 16- or 32-bit immediates. On x86-64, you can also produce 64-bit results...
On x86 or x86-64, 8- or 16-bit operations only modify that much of a register, but on x86-64, 32-bit results are zero-extended into a 64-bit register.
I am still not clear. Suppose I load number 1 (literal) to register A. Do I have to specify if one is an 8, 16, 32 or 64 bit number? Are there different instructions for loading each one of the data widths?
Let me present a follow up question based on possible answers.
1) Yes, you need to specify that you are loading 8 bit literal and there are different load instructions for each width.
Subquestion 1a) Ok, I specify I am loading only low 8 bits to the register (or the Assembler does it for me). Low 8 bits get loaded, and next, I add this number to another register that has a 64 bit value, expecting 64 bit results. What was in high 56 bits of the register to which I originally loaded low 8 bits?
2) Yes, you need to specify that you are loading this literal to the register as a 64 bit number or no, you don't need to specify anything, the literal will get loaded as 64 bit number.
In this case, the literal number 1 has to be stored in the code as a 64 bit number, using 8 bytes doesn't it? Isn't this exactly what the presentation said: Code size is up about 5% - Mostly due to 64-bit literals
Joe |