TEST (x86 instruction)

In the x86 assembly language, the  instruction performs a bitwise AND on two operands. The flags,  ,   are modified while the result of the AND is discarded. The  and   flags are set to , while   flag is undefined. There are 9 different opcodes for the TEST instruction depending on the type and size of the operands. It can compare 8-bit, 16-bit, 32-bit or 64-bit values. It can also compare registers, immediate values and register indirect values.

TEST opcode variations
The TEST operation clears the flags  and   to zero. The  is set to the most significant bit of the result of the AND. If the result is, the   is set to  , otherwise set to. The parity flag is set to the bitwise XNOR of the least significant byte of the result,  if the number of ones in that byte is even,   otherwise. The value of  is undefined.