This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ription Compare bytes Test byte Compare words Test word Compare double words Test double word The cmpb, cmpw, and cmpl instructions set the condition codes according to the difference of their two operands. With GAS format, the operands are listed in reverse order, making the code difﬁcult to read. These instructions set the zero ﬂag if the two operands are equal. The other ﬂags can be used to determine ordering relations between the two operands. The testb, testw, and testl instructions set the zero and negative ﬂags based on the AND of their two operands. Typically, the same operand is repeated (e.g., testl %eax,%eax to see whether %eax is negative, zero, or positive), or one of the operands is a mask indicating which bits should be tested. 3.6.2 Accessing the Condition Codes
Rather than reading the condition codes directly, the two most common methods of accessing them are to set an integer register or to perform a conditional branch based on some combination of condition codes. The different set instructions described in Figure 3.9 set...
View Full Document