0% found this document useful (0 votes)
14K views1 page

Business Grammar

The TEST instruction in x86 assembly performs a bitwise AND operation on two operands and modifies the flags SF, ZF, PF without storing the result. It can compare values of different sizes, like 8-bit, 16-bit, 32-bit or 64-bit registers, immediate values, or register indirect values. The OF and CF flags are set to 0, while the AF flag is undefined. There are 9 opcodes depending on the operand types and sizes.

Uploaded by

tahhan3107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14K views1 page

Business Grammar

The TEST instruction in x86 assembly performs a bitwise AND operation on two operands and modifies the flags SF, ZF, PF without storing the result. It can compare values of different sizes, like 8-bit, 16-bit, 32-bit or 64-bit registers, immediate values, or register indirect values. The OF and CF flags are set to 0, while the AF flag is undefined. There are 9 opcodes depending on the operand types and sizes.

Uploaded by

tahhan3107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

TEST (x86 instruction)

From Wikipedia, the free encyclopedia


In the x86 assembly language, the TEST instruction performs a bitwise AND on two operands. The
flags SF, ZF, PF are modified while the result of the AND is discarded. The OF and CF flags are set to
0, while AF 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.[1]

TEST opcode variations[edit]


The TEST operation sets the flags CF and OF to zero. The SF is set to the MSB of the result of
the AND. If the result of the AND is 0, the ZF is set to 1, otherwise set to 0. The parity flag is set to
the bitwise XNOR of the result of the AND. The value of AF is undefined.

Examples[edit]
;ConditionalJumptestcl,cl;setZFto1ifcl==0je
0x804f430;jumpifZF==1;ortesteax,eax;setSFto1ifeax
<0(negative)jserror;jumpifSF==1

You might also like