cmp

Compare Two Operands

CMP r/m, r

Subtracts src from dest and updates flags (dest not modified).

Details

The Compare Two Operands instruction subtracts src from dest and updates flags (dest not modified).

Pseudocode Operation

// Flags <- DEST - SRC (result discarded)
// Flags affected: OF, SF, ZF, AF, CF, PF

Example

CMP EAX, 10 ; Compare EAX with 10 JE label ; Jump if Equal

Encoding

Binary Layout
39
+0
 
Format Legacy
Opcode 39
Extension Base

Operands

  • dest
    Register/Memory
  • src
    Register