Linux Assemblycollection of fast libraries

Central Processing Unit (CPU) instructions set

The general-purpose instructions perform basic data movement, arithmetic, logic, program flow, and string operations which programmers commonly use to write application and system software to run on Intel 64 and IA-32 processors. They operate on data contained in memory, in the general-purpose registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP) and in the EFLAGS register. They also operate on address information contained in memory, the general-purpose registers, and the segment registers (CS, DS, SS, ES, FS, and GS).

Contents

Tip: For detailed information about each instruction please read: Intel Architectures Software Developer’s Manual Volume 2: Instruction Set Reference, A-Z

Data Transfer Instructions

The data transfer instructions move data between memory and the general-purpose and segment registers. They also perform specific operations such as conditional moves, stack access, and data conversion.

InstructionMeaning
MOVMove data between general-purpose registers, segment registers, memory, and from immediate to general-purpose registers
MOVZXMove and zero extend
MOVSXMove and sign extend
MOVSXDMove and sign extend
Conditional Moves
CMOVEConditional move if equal
CMOVAConditional move if above
CMOVAEConditional move if above or equal
CMOVBConditional move if below
CMOVBEConditional move if below or equal
CMOVGConditional move if greater
CMOVGEConditional move if greater or equal
CMOVLConditional move if less
CMOVLEConditional move if less or equal
CMOVZConditional move if zero
CMOVCConditional move if carry
CMOVOConditional move if overflow
CMOVSConditional move if sign (negative)
CMOVPConditional move if parity
CMOVNEConditional move if not equal
CMOVNAConditional move if not above
CMOVNAEConditional move if not above or equal
CMOVNBConditional move if not below
CMOVNBEConditional move if not below or equal
CMOVNGConditional move if not greater
CMOVNGEConditional move if not greater or equal
CMOVNLConditional move if not less
CMOVNLEConditional move if not less or equal
CMOVNZConditional move if not zero
CMOVNCConditional move if not carry
CMOVNOConditional move if not overflow
CMOVNSConditional move if not sign (non-negative)
CMOVNPConditional move if not parity
CMOVPEConditional move if parity even
CMOVPOConditional move if parity odd
Stack Operations
PUSHPush onto the stack
PUSHAPush general-purpose registers: AX, CX, DX, BX, SP, BP, SI, DI onto stack
PUSHADPush general-purpose registers: EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI onto stack
POPPop off the stack
POPAPop general-purpose registers: DI, SI, BP, BX, DX, CX, AX from stack
POPADPop general-purpose registers: EDI, ESI, EBP, EBX, EDX, ECX, EAX from stack
Exchange Operations
XCHGExchange
XADDExchange and add
Compare-Exchange Operations
CMPXCHGCompare and exchange
CMPXCHG8BCompare and exchange 8 bytes
CMPXCHG16BCompare and exchange 16 bytes
Compare-Add Operations
CMPBXADDCompare the in-memory value with the second value. If the second value is below, then add the third value to the in-memory value
CMPBEXADDCompare the in-memory value with the second value. If the second value is below or equal, then add the third value to the in-memory value
CMPLXADDCompare the in-memory value with the second value. If the second value is less, then add the third value to the in-memory value
CMPLEXADDCompare the in-memory value with the second value. If the second value is less or equal, then add the third value to the in-memory value
CMPZXADDCompare the in-memory value with the second value. If the second value is zero, then add the third value to the in-memory value
CMPOXADDCompare the in-memory value with the second value. If the second value is overflow, then add the third value to the in-memory value
CMPSXADDCompare the in-memory value with the second value. If the second value is sign, then add the third value to the in-memory value
CMPPXADDCompare the in-memory value with the second value. If the second value is parity, then add the third value to the in-memory value
CMPNBXADDCompare the in-memory value with the second value. If the second value is not below, then add the third value to the in-memory value
CMPNBEXADDCompare the in-memory value with the second value. If the second value is not below or equal, then add the third value to the in-memory value
CMPNLXADDCompare the in-memory value with the second value. If the second value is not less, then add the third value to the in-memory value
CMPNLEXADDCompare the in-memory value with the second value. If the second value is not less or equal, then add the third value to the in-memory value
CMPNZXADDCompare the in-memory value with the second value. If the second value is not zero, then add the third value to the in-memory value
CMPNOXADDCompare the in-memory value with the second value. If the second value is not overflow, then add the third value to the in-memory value
CMPNSXADDCompare the in-memory value with the second value. If the second value is not sign, then add the third value to the in-memory value
CMPNPXADDCompare the in-memory value with the second value. If the second value is not parity, then add the third value to the in-memory value
Misc Operations
BSWAPByte swap
MOVBEMove data after swapping data bytes
XLATBTable lookup translation

Data Conversion Instructions

Convert integer values from/two different integer types.

InstructionMeaning
CBWConvert byte to word (sign-extend of AL to AX)
CWDConvert word to double word (sign-extend of AX to DX:AX)
CDQConvert double word to quad word (sign-extend of EAX to EDX:EAX)
CQOConvert quad word to octal word (sign-extend of RAX to RDX:RAX)
CWDEConvert word to double word (sign-extend of AX to EAX)
CDQEConvert double word to quad word (sign-extend of EAX to RAX)

Binary Arithmetic Instructions

The binary arithmetic instructions perform basic binary integer computations on integers located in memory and/or the general purpose registers.

InstructionMeaning
Addition
INCIncrement
ADDAdd
ADCAdd with carry
ADCXUnsigned integer add with carry
ADOXUnsigned integer add with overflow
Subtraction
DECDecrement
SUBSubtract
SBBSubtract with borrow
Multiplication
MULUnsigned multiply
IMULSigned multiply
Division
DIVUnsigned divide
IDIVSigned divide
Negation
NEGNegate
Comparison
CMPCompare

Decimal Arithmetic Instructions

The decimal arithmetic instructions perform decimal arithmetic on Binary Coded Decimal (BCD) data.

InstructionMeaning
Packed BCD
DAADecimal adjust after addition
DASDecimal adjust after subtraction
Unpacked BCD
AAAASCII adjust after addition
AASASCII adjust after subtraction
AAMASCII adjust after multiplication
AADASCII adjust before division

Logical Instructions

The logical instructions perform basic AND, OR, XOR, and NOT logical operations on byte, word, and doubleword values.

InstructionMeaning
ANDPerform bitwise logical AND
ORPerform bitwise logical OR
XORPerform bitwise logical exclusive OR
NOTPerform bitwise logical NOT

Shift and Rotate Instructions

The shift and rotate instructions shift and rotate the bits in word and doubleword operands.

InstructionMeaning
Shift
SHLShift logical left
SHLDShift left double
SHRShift logical right
SHRDShift right double
SALShift arithmetic left
SARShift arithmetic right
Rotation
ROLRotate left
RORRotate right
RCLRotate through carry left
RCRRotate through carry right

Bit and Byte Instructions

Bit instructions test and modify individual bits in word and doubleword operands. Byte instructions set the value of a byte operand to indicate the status of flags in the EFLAGS register.

InstructionMeaning
POPCNTCompute the number of bits set to 1
TESTLogical compare
Bit Test
BTBit test
BTSBit test and set
BTRBit test and reset
BTCBit test and complement
Bit Scan
BSFBit scan forward
BSRBit scan reverse
Set Byte on Condition
SETESet byte if equal
SETASet byte if above
SETAESet byte if above or equal
SETBSet byte if below
SETBESet byte if below or equal
SETGSet byte if greater
SETGESet byte if greater or equal
SETLSet byte if less
SETLESet byte if less or equal
SETZSet byte if zero
SETCSet byte if carry
SETOSet byte if overflow
SETSSet byte if sign (negative)
SETPSet byte if parity
SETNESet byte if not equal
SETNASet byte if not above
SETNAESet byte if not above or equal
SETNBSet byte if not below
SETNBESet byte if not below or equal
SETNGSet byte if not greater
SETNGESet byte if not greater or equal
SETNLSet byte if not less
SETNLESet byte if not less or equal
SETNZSet byte if not zero
SETNCSet byte if not carry
SETNOSet byte if not overflow
SETNSSet byte if not sign (non-negative)
SETNPSet byte if not parity
SETPESet byte if parity even
SETPOSet byte if parity odd

Bit manipulation instructions

A collection of instructions to manipulate integer data at bit-granularity. Most of the bit-manipulation instructions employ VEX-prefix encoding to support three-operand syntax with non-destructive source operands.

InstructionMeaning
ANDNBitwise AND of first source with inverted second source operands
Bit Counting
LZCNTCount the number leading zero bits
TZCNTCount the number trailing zero bits
Bit Shuffling
PEXTParallel extraction of bits using a mask
PDEPParallel deposit of bits using a mask
BEXTRContiguous bitwise extract
BZHIZero high bits starting from specified bit position
LSB Operations
BLSIExtract lowest set bit
BLSRReset lowest set bit
BLSMSKSet all lower bits below first set bit to 1
Performance Improvement
MULXUnsigned multiply without affecting flags
SHLXShift logic left without affecting flags
SHRXShift logic right without affecting flags
SARXShift arithmetic right without affecting flags
RORXRotate right without affecting flags

String Instructions

The string instructions operate on strings of bytes, allowing them to be moved to and from memory.

InstructionMeaning
Load From Memory
LODSBLoad byte string
LODSWLoad word string
LODSDLoad double word string
LODSQLoad quad word string
Store To Memory
STOSBStore byte string
STOSWStore word string
STOSDStore double word string
STOSQStore quad word string
Move Memory Blocks
MOVSBMove byte string
MOVSWMove word string
MOVSDMove double word string
MOVSQMove quad word string
Compare Memory Blocks
CMPSBCompare byte string
CMPSWCompare word string
CMPSDCompare double word string
CMPSQCompare quad word string
Find In Memory Block
SCASBScan byte string
SCASWScan word string
SCASDScan double word string
SCASQScan quad word string
Repeat String Operation
REPRepeat while ECX not zero
REPERepeat while equal
REPZRepeat while zero
REPNERepeat while not equal
REPNZRepeat while not zero

I/O Instructions

These instructions move data between the processor’s I/O ports and a register or memory.

InstructionMeaning
Input
INRead from a port
INSBInput byte string from port
INSWInput word string from port
INSDInput double word string from port
Output
OUTWrite to a port
OUTSBOutput byte string to port
OUTSWOutput word string to port
OUTSDOutput double word string to port

Enqueue Store Instructions

These instructions enable the CPU to send commands directly to input/output (I/O) devices, bypassing typical memory hierarchy steps like caches. This improves efficiency for asynchronous I/O operations.

InstructionMeaning
ENQCMDEnqueue command
ENQCMDSEnqueue command supervisor

Control Transfer Instructions

The control transfer instructions provide jump, conditional jump, loop, and call and return operations to control program flow.

InstructionMeaning
JMPJump
Conditional Jumps
JEJump if equal
JAJump if above
JAEJump if above or equal
JBJump if below
JBEJump if below or equal
JGJump if greater
JGEJump if greater or equal
JLJump if less
JLEJump if less or equal
JZJump if zero
JCJump if carry
JOJump if overflow
JSJump if sign (negative)
JPJump if parity
JNEJump if not equal
JNAJump if not above
JNAEJump if not above or equal
JNBJump if not below
JNBEJump if not below or equal
JNGJump if not greater
JNGEJump if not greater or equal
JNLJump if not less
JNLEJump if not less or equal
JNZJump if not zero
JNCJump if not carry
JNOJump if not overflow
JNSJump if not sign (non-negative)
JNPJump if not parity
JPEJump if parity even
JPOJump if parity odd
JCXZJump register CX zero
JECXZJump register ECX zero
JRCXZJump register RCX zero
Loops
LOOPLoop with ECX counter
LOOPELoop with ECX and equal
LOOPZLoop with ECX and zero
LOOPNELoop with ECX and not equal
LOOPNZLoop with ECX and not zero
Procedure Calls
CALLCall procedure
RETReturn
Interrupts
INTSoftware interrupt with a vector specified by immediate byte
INTOInterrupt on overflow
INT1Interrupt for hardware debug
INT3Interrupt for software breakpoints
IRETReturn from interrupt
BOUNDDetect value out of range

Control Transfer Terminating Instructions

Intel Control-flow Enforcement Technology (CET) is a hardware-assisted security feature designed to protect against control-flow hijacking attacks, uses specific instructions related to terminating indirect branches. The "terminating" instructions in this context signal the end of an indirect branch at the target location.

InstructionMeaning
ENDBR32Terminate an indirect branch in 32-bit and compatibility mode
ENDBR64Terminate an indirect branch in 64-bit mode

High Level Procedure Instructions

These instructions provide machine-language support for procedure calls in block-structured languages.

InstructionMeaning
ENTERHigh-level procedure entry
LEAVEHigh-level procedure exit

Shadow Stack Management Instructions

Shadow stack management instructions allow the program and run-time to perform operations like recovering from control protection faults, shadow stack switching, etc.

InstructionMeaning
Busy Bit
SETSSBSYSet busy bit in a supervisor shadow stack token
CLRSSBSYClear busy bit in a supervisor shadow stack token
Shadow Stack Pointer (SSP)
INCSSPIncrement the Shadow Stack Pointer (SSP)
RDSSPRead Shadow Stack Point (SSP)
RSTORSSPRestore a Shadow Stack Pointer (SSP)
SAVEPREVSSPSave previous Shadow Stack Pointer (SSP)
Writes
WRSSWrite to a shadow stack
WRUSSWrite to a user mode shadow stack

Flag Control Instructions

The flag control instructions operate on the flags in the EFLAGS register.

InstructionMeaning
Set Flags
STISet interrupt flag
STDSet direction flag
STCSet carry flag
STACSet AC flag in EFLAGS register
Clear Flags
CLIClear the interrupt flag
CLDClear the direction flag
CLCClear the carry flag
CLACClear AC flag in EFLAGS register
Complement Flags
CMCComplement the carry flag
Load Flags
LAHFLoad flags into AH register
POPFPop lower 16 bits of EFLAGS from stack
POPFDPop EFLAGS from stack
POPFQPop RFLAGS from stack
Store Flags
SAHFStore AH register into flags
PUSHFPush lower 16 bits of EFLAGS onto stack
PUSHFDPush EFLAGS onto stack
PUSHFQPush RFLAGS onto stack

User Interrupt (UINTR) Instructions

User Interrupts (Uintr) is a hardware technology that enables delivering interrupts directly to user space.

InstructionMeaning
STUISet user interrupt flag
CLUIClear user interrupt flag
TESTUIDetermine user interrupt flag
SENDUIPISend user interprocessor interrupt
UIRETUser-interrupt return

User Level Monitor (ULM) Instructions

InstructionMeaning
UMONITORUser level set up monitor address
UMWAITUser level monitor wait

Miscellaneous Instructions

The miscellaneous instructions provide such functions as loading an effective address, executing a "no-operation," and retrieving processor identification information.

InstructionMeaning
LEALoad effective address
NOPNo operation
UDUndefined instruction
RDPIDRead processor ID
CPUIDProcessor identification
CRC32Provides hardware acceleration to calculate cyclic redundancy checks for fast and efficient implementation of data integrity protocols
PTWRITEWrite data to a processor trace packet

Random Number Generator Instructions

The instructions for generating random numbers to comply with NIST SP800-90A, SP800-90B, and SP800-90C standards.

InstructionMeaning
RDRANDRetrieves a random number generated from hardware
RDSEEDRead random SEED

Segment Register Instructions

The segment register instructions allow far pointers (segment addresses) to be loaded into the segment registers.

InstructionMeaning
LDSLoad far pointer using DS
LESLoad far pointer using ES
LFSLoad far pointer using FS
LGSLoad far pointer using GS
LSSLoad far pointer using SS

System Instructions

The following system instructions are used to control those functions of the processor that are provided to support for operating systems and executives.

InstructionMeaning
Descriptor Table Management
LLDTLoad local descriptor table (LDT) register
SLDTStore local descriptor table (LDT) register
LGDTLoad global descriptor table (GDT) register
SGDTStore global descriptor table (GDT) register
LIDTLoad interrupt descriptor table (IDT) register
SIDTStore interrupt descriptor table (IDT) register
Segmentation
RDFSBASEReads from FS base address at any privilege level
WRFSBASEWrites to FS base address at any privilege level
RDGSBASEReads from GS base address at any privilege level
WRGSBASEWrites to GS base address at any privilege level
SWAPGSExchanges current GS base register value with value in MSR address 0xC0000102
Privilege Leveling
VERRVerify segment for reading
VERWVerify segment for writing
LARLoad access rights
LSLLoad segment limit
ARPLAdjust requested privilege level
Memory Protection/Synchronization
RDPKRURead protection key rights for user pages
WRPKRUWrite data to user page key register
LOCKLock bus (prefix)
Task Management
LTRLoad task register
STRStore task register
CLTSClear the task-switched flag
State Registers
XSAVESave processor extended states to memory
XSAVESSave processor extended states supervisor
XSAVECSave processor extended states with compaction
XSAVEOPTSave processor extended states to memory, optimized
XRSTORRestore processor extended states from memory
XRSTORSRestore processor extended states supervisor
Control Registers
XGETBVReads the state of an extended control register
XSETBVWrites the state of an extended control register
LMSWLoad machine status word
SMSWStore machine status word
Model-Specific Registers
RDMSRRead model-specific register
WRMSRWrite model-specific register
RDMSRLISTRead list of model-specific registers
WRMSRLISTWrite list of model-specific registers
Performance Registers
RDPMCRead performance monitoring counter
RDTSCRead time stamp counter
RDTSCPRead time stamp counter and processor ID
System Management
RSMReturn from system management mode (SMM)
HRESETRequests the processor to selectively reset selected components of hardware history maintained by the current logical processor
PCONFIGAllows software to configure certain platform features
Processor Control
HLTHalt processor
Cache and TLB Management
INVDInvalidate cache, no write back
WBINVDWrite back and invalidate cache
WBNOINVDWrite back and do not invalidate cache
INVLPGInvalidate TLB entry
INVPCIDInvalidate process-context identifier
System Calls
SYSENTERFast system call, transfers to a flat protected mode kernel at CPL = 0
SYSEXITFast system call, transfers to a flat protected mode kernel at CPL = 3
SYSCALLFast call to privilege level 0 system procedures
SYSRETReturn from fast system call
Copyright 2012-2026 Jack Black. All rights reserved.