Logo
Articles Compilers Libraries Books MiniBooklets Assembly C++ Linux CPU Others Videos
Advertisement

Article by Ayman Alheraki on January 11 2026 10:37 AM

X86 Registers, Flags,

X86 Registers, Flags, ....

 

1. x86 Register Encodings (Used in Machine Code)

Registers in x86 are not accessed directly via hex opcodes; instead, their usage is encoded in modR/M, SIB, or opcode bytes. Below is how they’re represented in 3-bit binary (and hex) within instruction fields.

RegisterBinaryHex (for internal encoding)8-bit16-bit32-bit64-bit
RAX0000x00ALAXEAXRAX
RCX0010x01CLCXECXRCX
RDX0100x02DLDXEDXRDX
RBX0110x03BLBXEBXRBX
RSP1000x04AHSPESPRSP
RBP1010x05CHBPEBPRBP
RSI1100x06DHSIESIRSI
RDI1110x07BHDIEDIRDI

 

Registers R8–R15 are encoded using REX prefixes in 64-bit mode.

 

2. EFLAGS Register (Bit Positions and Hex Masks)

The EFLAGS register is a 32-bit register, where each flag is a single bit:

BitHex MaskFlag NameAbbreviationDescription
00x00000001Carry FlagCFCarry or borrow in arithmetic
20x00000004Parity FlagPFEven parity of last result
40x00000010Auxiliary CarryAFCarry from bit 3
60x00000040Zero FlagZFResult was zero
70x00000080Sign FlagSFResult was negative
80x00000100Trap FlagTFStep-by-step mode
90x00000200Interrupt EnableIFEnable/disable interrupts
100x00000400Direction FlagDFString operations direction
110x00000800Overflow FlagOFOverflow in signed arithmetic

 

 

3. Machine Code (Hex) of AI / SIMD Instructions

These are specific hex opcodes used in AI and SIMD operations. The ModR/M byte (/r) specifies the register operands.

SSE (Streaming SIMD Extensions)

InstructionOpcode (Hex)Description
ADDPS xmm1, xmm20F 58 /rAdd packed single-precision floats
SUBPS xmm1, xmm20F 5C /rSubtract packed floats
MULPS xmm1, xmm20F 59 /rMultiply packed floats
DIVPS xmm1, xmm20F 5E /rDivide packed floats
MOVAPS xmm1, xmm20F 28 /rMove aligned packed float

 

AVX (Advanced Vector Extensions)

AVX uses a VEX prefix and works on 128/256-bit registers.

InstructionVEX Prefix + OpcodeDescription
VADDPS ymm1, ymm2, ymm3C5 F8 58 /rAdd packed single-precision floats
VMULPS ymm1, ymm2, ymm3C5 F8 59 /rMultiply packed floats
VSUBPS ymm1, ymm2, ymm3C5 F8 5C /rSubtract packed floats

 

AMX (Advanced Matrix Extensions – Intel 2023+)

Tile-based instructions for deep learning acceleration:

InstructionHex (Encoding)Description
TILELOADD0xC4...Load tile register (long encoding)
TILESTORED0xC4...Store tile register to memory
TDPBSSD0xC4...Dot-product of signed int8 with saturation

 

(Full hex depends on operands and is vendor-specific, typically long VEX-encoded.)

 

Example: Encoding ADD EAX, EBX

  • Instruction: ADD EAX, EBX

  • Opcode: 01 D8

    • 01 is the opcode for ADD r/m32, r32

    • D8 is the ModR/M byte (11 011 000) = EBX to EAX

 

Summary

  • Register references are encoded in binary (ModR/M or opcode bits), typically not standalone hex.

  • Flags in EFLAGS are set/cleared by instructions and are identified by bit and hex mask.

  • AI/SIMD instructions are encoded using specific hex opcodes (like 0F 58 /r) and VEX prefixes for AVX.

Advertisements

Responsive Counter
General Counter
1046826
Daily Counter
462