Article by Ayman Alheraki on January 11 2026 10:37 AM
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.
| Register | Binary | Hex (for internal encoding) | 8-bit | 16-bit | 32-bit | 64-bit |
|---|---|---|---|---|---|---|
| RAX | 000 | 0x00 | AL | AX | EAX | RAX |
| RCX | 001 | 0x01 | CL | CX | ECX | RCX |
| RDX | 010 | 0x02 | DL | DX | EDX | RDX |
| RBX | 011 | 0x03 | BL | BX | EBX | RBX |
| RSP | 100 | 0x04 | AH | SP | ESP | RSP |
| RBP | 101 | 0x05 | CH | BP | EBP | RBP |
| RSI | 110 | 0x06 | DH | SI | ESI | RSI |
| RDI | 111 | 0x07 | BH | DI | EDI | RDI |
Registers R8–R15 are encoded using REX prefixes in 64-bit mode.
The EFLAGS register is a 32-bit register, where each flag is a single bit:
| Bit | Hex Mask | Flag Name | Abbreviation | Description |
|---|---|---|---|---|
| 0 | 0x00000001 | Carry Flag | CF | Carry or borrow in arithmetic |
| 2 | 0x00000004 | Parity Flag | PF | Even parity of last result |
| 4 | 0x00000010 | Auxiliary Carry | AF | Carry from bit 3 |
| 6 | 0x00000040 | Zero Flag | ZF | Result was zero |
| 7 | 0x00000080 | Sign Flag | SF | Result was negative |
| 8 | 0x00000100 | Trap Flag | TF | Step-by-step mode |
| 9 | 0x00000200 | Interrupt Enable | IF | Enable/disable interrupts |
| 10 | 0x00000400 | Direction Flag | DF | String operations direction |
| 11 | 0x00000800 | Overflow Flag | OF | Overflow in signed arithmetic |
These are specific hex opcodes used in AI and SIMD operations. The ModR/M byte (/r) specifies the register operands.
| Instruction | Opcode (Hex) | Description |
|---|---|---|
ADDPS xmm1, xmm2 | 0F 58 /r | Add packed single-precision floats |
SUBPS xmm1, xmm2 | 0F 5C /r | Subtract packed floats |
MULPS xmm1, xmm2 | 0F 59 /r | Multiply packed floats |
DIVPS xmm1, xmm2 | 0F 5E /r | Divide packed floats |
MOVAPS xmm1, xmm2 | 0F 28 /r | Move aligned packed float |
AVX uses a VEX prefix and works on 128/256-bit registers.
| Instruction | VEX Prefix + Opcode | Description |
|---|---|---|
VADDPS ymm1, ymm2, ymm3 | C5 F8 58 /r | Add packed single-precision floats |
VMULPS ymm1, ymm2, ymm3 | C5 F8 59 /r | Multiply packed floats |
VSUBPS ymm1, ymm2, ymm3 | C5 F8 5C /r | Subtract packed floats |
Tile-based instructions for deep learning acceleration:
| Instruction | Hex (Encoding) | Description |
|---|---|---|
TILELOADD | 0xC4... | Load tile register (long encoding) |
TILESTORED | 0xC4... | Store tile register to memory |
TDPBSSD | 0xC4... | Dot-product of signed int8 with saturation |
(Full hex depends on operands and is vendor-specific, typically long VEX-encoded.)
ADD EAX, EBXInstruction: 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
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.