LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What is the movzbl instruction and when does the compiler use it?

"Move zero-extend byte to long": it reads one byte and fills the rest of the 32-bit destination with zeros.

# Read 1 byte from memory, fill upper bits with zeros
movzbl (%rax), %edx

If memory at (%rax) contains 0x41 ('A'), then %edx becomes 0x00000041.

The naming pattern: mov + z(zero) or s(sign) + source size + dest size

Instruction Meaning
movzbl Zero-extend byte → long (32-bit)
movzbq Zero-extend byte → quad (64-bit)
movzwl Zero-extend word → long
movsbl Sign-extend byte → long
movslq Sign-extend long → quad

Common context: Reading a char from a string, reading a byte from a lookup table, or widening a small value before arithmetic.

Go deeper:

From Quiz: REVE1 / Assembly Patterns & GDB | Updated: Jul 14, 2026