test

Logical Compare

TEST r/m, r

ANDs operands and updates flags (result discarded).

Details

The Logical Compare instruction aNDs operands and updates flags (result discarded).

Pseudocode Operation

temp ← DEST AND SRC;
SF ← MSB(temp); ZF ← (temp = 0);
PF ← Parity(temp); CF ← 0; OF ← 0;

Example

TEST EAX, EAX ; Check if EAX is 0 TEST AL, 1 ; Check if lowest bit is set

Encoding

Binary Layout
85
+0
 
Format Legacy
Opcode 85
Extension Base

Operands

  • dest
    Register or memory operand
  • src
    General-purpose register