TEST (x86 instruction)

In the x86 assembly language, the codice_1 instruction performs a bitwise AND on two operands. The flags codice_2, codice_3, codice_4 are modified while the result of the AND is discarded. The codice_5 and codice_6 flags are set to codice_7, while codice_8 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 sets the flags codice_6 and codice_5 to zero. The codice_2 is set to the most significant bit of the result of the AND. If the result is codice_7, the codice_3 is set to codice_14, otherwise set to codice_7. The parity flag is set to the bitwise XNOR of the least significant byte of the result, codice_14 if the number of ones in that byte is even, codice_7 otherwise. The value of codice_8 is undefined.
Examples.
test cl,cl ; set ZF to 1 if cl == 0
jz 0x804f430 ; jump if ZF == 1
test cl, cl ; set ZF to 1 if cl == 0
jnz 0x804f430 ; jump if ZF == 0
test eax, eax ; set SF to 1 if eax < 0 (negative)
js error ; jump if SF == 1