I am working through Kip Irvine's "Assembly Language for x86 Processors, sixth edition" and am really enjoying it.
I have just read about the NOP mnemonic in the following paragraph:
"It [NOP] is sometimes used by compilers and assemblers to align code to
even-address boundaries."
The example given is:
00000000 66 8B C3 mov ax, bx
00000003 90 nop
00000004 8B D1 mov edx, ecx
The book then states:
"x86 processors are designed to load code and data more quickly from even
doubleword addresses."
My question is: Is the reason this is so is because for the x86 processors the book refers to (32 bit), the word size of the CPU is 32 bits and therefore it can pull the instructions with the NOP in and process them in one go ? If this is the case, I am assuming that a 64 bit processor with a word size of a quadword would do this with a hypothetical 5 bytes of code plus a nop ?
Lastly, after I write my code, should I go through and correct alignment with NOP's to optimize it, or will the compiler (MASM, in my case), do this for me, as the text seems to imply ?
Thanks,
Scott