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.

Instruction📄Meaning
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
CMPBXADDℹ️Compare the in-memory value with the second value. If the second value is below, then add the third value to the in-memory value
CMPBEXADDℹ️Compare 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
CMPLXADDℹ️Compare the in-memory value with the second value. If the second value is less, then add the third value to the in-memory value
CMPLEXADDℹ️Compare 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
CMPZXADDℹ️Compare the in-memory value with the second value. If the second value is zero, then add the third value to the in-memory value
CMPOXADDℹ️Compare the in-memory value with the second value. If the second value is overflow, then add the third value to the in-memory value
CMPSXADDℹ️Compare the in-memory value with the second value. If the second value is sign, then add the third value to the in-memory value
CMPPXADDℹ️Compare the in-memory value with the second value. If the second value is parity, then add the third value to the in-memory value
CMPNBXADDℹ️Compare 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
CMPNBEXADDℹ️Compare 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
CMPNLXADDℹ️Compare 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
CMPNLEXADDℹ️Compare 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
CMPNZXADDℹ️Compare 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
CMPNOXADDℹ️Compare 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
CMPNSXADDℹ️Compare 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
CMPNPXADDℹ️Compare 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
BSWAPℹ️Byte swap
MOVBEℹ️Move data after swapping data bytes
XLATBTable lookup translation

Data Conversion Instructions

Convert integer values from/two different integer types.

Instruction📄Meaning
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.

Instruction📄Meaning
Addition
INCIncrement
ADDAdd
ADCℹ️Add with carry
ADCXℹ️Unsigned integer add with carry
ADOXℹ️Unsigned integer add with overflow
Subtraction
DECDecrement
SUBSubtract
SBBℹ️Subtract 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.

Instruction📄Meaning
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.

Instruction📄Meaning
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.

Instruction📄Meaning
Shift
SHLShift logical left
SHLDShift left double
SHRShift logical right
SHRDShift right double
SALShift arithmetic left
SARShift arithmetic right
Rotation
ROLℹ️Rotate left
RORℹ️Rotate 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.

Instruction📄Meaning
POPCNTℹ️Compute the number of bits set to 1
TESTLogical compare
Bit Test
BTℹ️Bit test
BTSℹ️Bit test and set
BTRℹ️Bit test and reset
BTCℹ️Bit test and complement
Bit Scan
BSFℹ️Bit scan forward
BSRℹ️Bit 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.

Instruction📄Meaning
ANDNℹ️Bitwise AND of first source with inverted second source operands
Bit Counting
LZCNTℹ️Count the number leading zero bits
TZCNTℹ️Count the number trailing zero bits
Bit Shuffling
PEXTℹ️Parallel extraction of bits using a mask
PDEPℹ️Parallel deposit of bits using a mask
BEXTRℹ️Contiguous bitwise extract
BZHIℹ️Zero high bits starting from specified bit position
LSB Operations
BLSIℹ️Extract lowest set bit
BLSRℹ️Reset lowest set bit
BLSMSKℹ️Set all lower bits below first set bit to 1
Performance Improvement
MULXℹ️Unsigned 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.

Instruction📄Meaning
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.

Instruction📄Meaning
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.

Instruction📄Meaning
ENQCMDℹ️Enqueue command
ENQCMDSℹ️Enqueue command supervisor

Control Transfer Instructions

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

Instruction📄Meaning
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.

Instruction📄Meaning
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.

Instruction📄Meaning
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.

Instruction📄Meaning
Busy Bit
SETSSBSYℹ️Set busy bit in a supervisor shadow stack token
CLRSSBSYℹ️Clear busy bit in a supervisor shadow stack token
Shadow Stack Pointer (SSP)
INCSSPℹ️Increment the Shadow Stack Pointer (SSP)
RDSSPℹ️Read Shadow Stack Point (SSP)
RSTORSSPℹ️Restore a Shadow Stack Pointer (SSP)
SAVEPREVSSPℹ️Save previous Shadow Stack Pointer (SSP)
Writes
WRSSℹ️Write to a shadow stack
WRUSSℹ️Write to a user mode shadow stack

Flag Control Instructions

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

Instruction📄Meaning
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.

Instruction📄Meaning
STUIℹ️Set user interrupt flag
CLUIℹ️Clear user interrupt flag
TESTUIℹ️Determine user interrupt flag
SENDUIPIℹ️Send user interprocessor interrupt
UIRETUser-interrupt return

User Level Monitor (ULM) Instructions

Instruction📄Meaning
UMONITORℹ️User level set up monitor address
UMWAITℹ️User 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.

Instruction📄Meaning
LEALoad effective address
NOPNo operation
UDUndefined instruction
RDPIDℹ️Read processor ID
CPUIDProcessor identification
CRC32ℹ️Provides hardware acceleration to calculate cyclic redundancy checks for fast and efficient implementation of data integrity protocols
PTWRITEℹ️Write 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.

Instruction📄Meaning
RDRANDℹ️Retrieves a random number generated from hardware
RDSEEDℹ️Read random SEED

Segment Register Instructions

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

Instruction📄Meaning
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.

Instruction📄Meaning
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
RDFSBASEℹ️Reads from FS base address at any privilege level
WRFSBASEℹ️Writes to FS base address at any privilege level
RDGSBASEℹ️Reads from GS base address at any privilege level
WRGSBASEℹ️Writes 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
XSAVEℹ️Save processor extended states to memory
XSAVESℹ️Save processor extended states supervisor
XSAVECℹ️Save processor extended states with compaction
XSAVEOPTℹ️Save processor extended states to memory, optimized
XRSTORℹ️Restore processor extended states from memory
XRSTORSℹ️Restore processor extended states supervisor
Control Registers
XGETBVℹ️Reads the state of an extended control register
XSETBVℹ️Writes 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
RDPMCℹ️Read performance monitoring counter
RDTSCℹ️Read time stamp counter
RDTSCPℹ️Read time stamp counter and processor ID
System Management
RSMReturn from system management mode (SMM)
HRESETℹ️Requests the processor to selectively reset selected components of hardware history maintained by the current logical processor
PCONFIGℹ️Allows software to configure certain platform features
Processor Control
HLTHalt processor
Cache and TLB Management
INVDInvalidate cache, no write back
WBINVDℹ️Write back and invalidate cache
WBNOINVDℹ️Write back and do not invalidate cache
INVLPGInvalidate TLB entry
INVPCIDℹ️Invalidate 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 Eugene Zamlinsky. All rights reserved.