Appendix: AMD64 Instructions

Instruction Arguments Comments
Copying data src is an address, register, or literal
dst is an address or register
movb src, dst 1 byte
movl src, dst up to 4 bytes
movsbl src, dst src is 1 signed byte, dst is 4 bytes
movzbl src, dst src is 1 unsigned byte, dst is 4 bytes
movq src, dst 8 bytes
Binary operators a is an address, register, or literal
b is a register
c is a literal
addl a, b b = b + a, up to 4 bytes
addq a, b b = b + a, 8 bytes
subl a, b b = b - a, up to 4 bytes
subq a, b b = b - a, 8 bytes
imull a, b b = b × a, up to 4 bytes
imull c, a, b b = a × c, up to 4 bytes
imulq a, b b = b × a, 8 bytes
imulq c, a, b b = a × c, 8 bytes
xorl a, b b = b ^ a
Bit shifting a is an address, register, or literal
b is a register
shll a, b b = b << a
sarl a, b b = b >> a
Compare and Branch x and y are addresses, registers, or literals
z is an address or label
cmpb x, y eax = 1 if x == y, 0 otherwise, 1 byte
cmpl x, y eax = 1 if x == y, 0 otherwise, up to 4 bytes
cmpq x, y eax = 1 if x == y, 0 otherwise, 8 bytes
je z rip = z if eax == 0
jne z rip = z if eax != 0
jmp z rip = z
Calling functions a is an address or label
b is an 8 byte register
z is an address or label
leaq a, b b = address of a
callq z rip = z, new frame created