TEST Test Flags: O D I T S Z A P C 0 - - - * * ? * 0 TEST destination,source
Logic (AND destination,source) ; Set flags only
TEST performs a logical AND operation on its two operands and updates the flags. None of the operands are changed.
Example: test eax, eax jz ahead ; Skip if eax = 0
Example: test al, 00100100b ; Test for bits 2 and 5 jz two_five_off ; If result is zero, both were off one_or_both_set: jpe two_five_set ; Can use parity flag in a byte result two_or_five_set: ; Bit 2 or bit 5 was set ; ... two_five_set: ; Both bits were set ; ... two_five_off: ; Both bits were clear
Opcode Format 84 /r TEST r/m8,r8 85 /r TEST r/m16,r16 85 /r TEST r/m32,r32 A8 ib TEST AL,imm8 A9 iw TEST AX,imm16 A9 id TEST EAX,imm32 F6 /0 ib TEST r/m8,imm8 F7 /0 iw TEST r/m16,imm16 F7 /0 id TEST r/m32,imm32