1.0 Register

8 Bytes (64 Bit)4 Bytes (32 Bit)2 Bytes (16 Bit)1 Byte (8 Bit)Description
RAXEAXAXAL1st temporary register
RBXEBXBXBLcallee-saved-register
RCXECXCXCL4th argument register
RDXEDXDXDL3rd argument register
RSIESISISIL2nd argument register
RDIEDIDIDL1st argument register
RBPEDPBPBPLcallee-saved register, frame-pointer
RSPESPSPSPLstack-pointer
RIPEIP--instruction-pointer
R8R8DR8WR8B5th argument register
R9R9DR9WR9B6th argument register
R10R10DR10WR10Btemporary register
R11R11DR11WR11Btemporary register
R12-R15R12D-R15DR12W-R15WR12B-R15Bcallee-safe register

2.0 Instructions

2.1 Data Movement

Parameter

S = Source D = Destination

InstructionParameterDescription
movS, DMove Source to Destination
pushSPush Source onto Stack
popDPop top of Stack into Destination
cwtlConvert word in %ax to doubleword in %eax
cltqConvert doubleword in %eax to quadword in %rax
cqtoConvert quadword in %rax to octoword in %rdx:%rax

2.2 Arithmetic Operations

2.2.1 Unary Operations

InstructionParameterDescription
incDIncrement by 1
decDDecrement by 1
negDArithmetic negotion
notDBitwise complement

2.2.2 Binary Operations

InstructionParameterDescription
leaqS, DLoad effective address of source into destination
addS, DAdd source to destination
subS, DSubtract source from destination
imulS, DMultiply destination by source
xorS, DBitwise XOR destination by source
orS, DBitwise OR destination by source
andS, DBitwise AND destination by source

2.2.3 Shift Operations

InstructionParameterDescription
shlk, DLeft shift destination by k bits
shrk, DLogical right shift destination by k bits
salk, DLeft shift destination by k bits
sark, DArithmetic right shift destination by k bits

2.2.4 Special Arithmetic Operations

InstructionParameterDescription
imulqSSigned full multiply of rax by source, result stored in rdx:rax
mulqSUnsigned full multiply of rax by S, result stored in rdx:rax
idivqSSigned divide rdx:rax by S, quotient stored in rax, remainder stored in rdx
divqSUnsigned divide rdx:rax, quotient stored in rax, remainder stored in rdx

2.3 Comparisons and Test Instructions

InstructionParameterDescription
cmp , Set condition codes according to -
test , Set condition codes according to -

2.4 Accessing Condition Codes

2.4.1 Conditional Set Instructions

InstructionParameterDescriptionCondition Code
sete / setzDSet if equal/zeroZF
setne / setnzDSet if not equal/nonzero~ZF
setsDSet if negativeSF
setnsDSet if nonnegatove~SF
setg / setnleDSet if greater~(SF^0f)&~ZF
setge / setnlDSet if greater or equal~(SF^0F)
setl / setngeDSet if lessSF^0F
setle / setngDSet if less or equal(SF^0F)|ZF
seta / setnbeDSet if above~CF&~ZF
setae / setnbDSet if above or equal~CF
setb / setnaeDSet if belowCF
setbe / setnaDSet if below or equalCF|ZF

2.4.2 Conditional Jump Instructions

InstructionParameterDescriptionCondition Code
jmpLabel / *OperandJump to Label / specified location
je / jzLabelJump if equal/zeroZF
jne / jnzLabelJump if not equal/nonzero~ZF
jsLabelJump if negativeSF
jnsLabelJump if notnegative~SF
jg / jnleLabelJump if greater~(SF^0f)&~ZF
jge / jnlLabelJump if greater or equal~(SF^0F)
jl / jngeLabelJump if lessSF^0F
jle / jngLabelJump if less or equal(SF^0F)|ZF
ja / jnbeLabelJump if above~CF&~ZF
jae / jnbLabelJump if above or equal~CF
jb / jnaeLabelJump if belowCF
jbe / jnaLabelJump if below or equalCF|ZF

2.4.3 Conditional Move Instructions

InstructionParameterDescriptionCondition Code
cmove / cmovzS, DMove if equal/zeroZF
cmovne / cmovnzS, DMove if not equal/nonzero~ZF
cmovsS, DMove if negativeSF
cmovnsS, DMove if nonnegatove~SF
cmovg / cmovnleS, DMove if greater~(SF^0f)&~ZF
cmovge / cmovnlS, DMove if greater or equal~(SF^0F)
cmovl / cmovngeS, DMove if lessSF^0F
cmovle / cmovngS, DMove if less or equal(SF^0F)|ZF
cmova / cmovnbeS, DMove if above~CF&~ZF
cmovae / cmovnbS, DMove if above or equal~CF
cmovb / cmovnaeS, DMove if belowCF
cmovbe / cmovnaS, DMove if below or equalCF|ZF

2.5 Procedure Call Instruction

InstructionParameterDescription
callLabel / *OperandPush return address and jump to label / specified location
leaveSet rsp to rbp, then pop top of stack into rbp
retPop return address from stack and jump there

References

CheatSheet