What does the MOVZBL instruction do in IA-32 AT&T syntax?

user663896 picture user663896 · Feb 16, 2012 · Viewed 69.1k times · Source

What exactly does this instruction do?

movzbl  0x01(%eax,%ecx), %eax

Answer

Igor Skochinsky picture Igor Skochinsky · Feb 16, 2012

AT&T syntax splits the movzx Intel instruction mnemonic into different mnemonics for different source sizes (movzb vs. movzw). In Intel syntax, it's:

movzx eax, byte ptr [eax+ecx+1]

i.e. load a byte from memory at eax+ecx+1 and zero-extend to full register.

BTW, most GNU tools now have a switch or a config option to prefer Intel syntax. (Such as objdump -Mintel or gcc -S -masm=intel, although the latter affects the syntax used when compiling inline-asm). I would certainly recommend to look into it, if you don't do AT&T assembly for living. See also the tag wiki for more docs and guides.