1.0 Register

8 Bytes (64 Bit) 4 Bytes (32 Bit) 2 Bytes (16 Bit) 1 Byte (8 Bit) Description
RAX EAX AX AL 1st temporary register
RBX EBX BX BL callee-saved-register
RCX ECX CX CL 4th argument register
RDX EDX DX DL 3rd argument register
RSI ESI SI SIL 2nd argument register
RDI EDI DI DL 1st argument register
RBP EDP BP BPL callee-saved register, frame-pointer
RSP ESP SP SPL stack-pointer
RIP EIP - - instruction-pointer
R8 R8D R8W R8B 5th argument register
R9 R9D R9W R9B 6th argument register
R10 R10D R10W R10B temporary register
R11 R11D R11W R11B temporary register
R12-R15 R12D-R15D R12W-R15W R12B-R15B callee-safe register

2.0 Instructions

2.1 Data Movement

[!NOTE] Parameter S = Source D = Destination

Instruction Parameter Description
mov S, D Move Source to Destination
push S Push Source onto Stack
pop D Pop top of Stack into Destination
cwtl   Convert word in %ax to doubleword in %eax
cltq   Convert doubleword in %eax to quadword in %rax
cqto   Convert quadword in %rax to octoword in %rdx:%rax

2.2 Arithmetic Operations

2.2.1 Unary Operations

Instruction Parameter Description  
inc D Increment by 1  
dec D Decrement by 1  
neg D Arithmetic negotion  
not D Bitwise complement  

2.2.2 Binary Operations

Instruction Parameter Description
leaq S, D Load effective address of source into destination
add S, D Add source to destination
sub S, D Subtract source from destination
imul S, D Multiply destination by source
xor S, D Bitwise XOR destination by source
or S, D Bitwise OR destination by source
and S, D Bitwise AND destination by source
     

2.2.3 Shift Operations

Instruction Parameter Description
shl k, D Left shift destination by k bits
shr k, D Logical right shift destination by k bits
sal k, D Left shift destination by k bits
sar k, D Arithmetic right shift destination by k bits

2.2.4 Special Arithmetic Operations

Instruction Parameter Description
imulq S Signed full multiply of rax by source, result stored in rdx:rax
mulq S Unsigned full multiply of rax by S, result stored in rdx:rax
idivq S Signed divide rdx:rax by S, quotient stored in rax, remainder stored in rdx
divq S Unsigned divide rdx:rax, quotient stored in rax, remainder stored in rdx

2.3 Comparisons and Test Instructions

Instruction Parameter Description  
cmp $S_2$ , $S_1$ Set condition codes according to $S_1$ - $S_2$  
test $S_2$ , $S_1$ Set condition codes according to $S_1$ - $S_2$  

2.4 Accessing Condition Codes

2.4.1 Conditional Set Instructions

Instruction Parameter Description Condition Code
sete / setz D Set if equal/zero ZF
setne / setnz D Set if not equal/nonzero ~ZF
sets D Set if negative SF
setns D Set if nonnegatove ~SF
setg / setnle D Set if greater ~(SF^0f)&~ZF
setge / setnl D Set if greater or equal ~(SF^0F)
setl / setnge D Set if less SF^0F
setle / setng D Set if less or equal (SF^0F)\|ZF
seta / setnbe D Set if above ~CF&~ZF
setae / setnb D Set if above or equal ~CF
setb / setnae D Set if below CF
setbe / setna D Set if below or equal CF\|ZF

2.4.2 Conditional Jump Instructions

Instruction Parameter Description Condition Code
jmp Label / *Operand Jump to Label / specified location  
je / jz Label Jump if equal/zero ZF
jne / jnz Label Jump if not equal/nonzero ~ZF
js Label Jump if negative SF
jns Label Jump if notnegative ~SF
jg / jnle Label Jump if greater ~(SF^0f)&~ZF
jge / jnl Label Jump if greater or equal ~(SF^0F)
jl / jnge Label Jump if less SF^0F
jle / jng Label Jump if less or equal (SF^0F)\|ZF
ja / jnbe Label Jump if above ~CF&~ZF
jae / jnb Label Jump if above or equal ~CF
jb / jnae Label Jump if below CF
jbe / jna Label Jump if below or equal CF\|ZF

2.4.3 Conditional Move Instructions

Instruction Parameter Description Condition Code
cmove / cmovz S, D Move if equal/zero ZF
cmovne / cmovnz S, D Move if not equal/nonzero ~ZF
cmovs S, D Move if negative SF
cmovns S, D Move if nonnegatove ~SF
cmovg / cmovnle S, D Move if greater ~(SF^0f)&~ZF
cmovge / cmovnl S, D Move if greater or equal ~(SF^0F)
cmovl / cmovnge S, D Move if less SF^0F
cmovle / cmovng S, D Move if less or equal (SF^0F)\|ZF
cmova / cmovnbe S, D Move if above ~CF&~ZF
cmovae / cmovnb S, D Move if above or equal ~CF
cmovb / cmovnae S, D Move if below CF
cmovbe / cmovna S, D Move if below or equal CF\|ZF

2.5 Procedure Call Instruction

Instruction Parameter Description
call Label / *Operand Push return address and jump to label / specified location
leave   Set rsp to rbp, then pop top of stack into rbp
ret   Pop return address from stack and jump there

References

#Label/CheatSheet