Observe that body statement is executed at least once

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ¼, and hence the zero flag indicates equality. Similarly, consider testing a signed comparison with the setl, or “Set when less,” instruction. When a and b are in two’s complement form, then for a b we will have a b ¼ if the true difference were computed. When there is no overflow, this would be indicated by having the sign flag set. When there is positive overflow, because a b is a large positive number, however, we will have t ¼. When there is negative overflow, because a b is a small negative number, we will have t ¼. In either case, the sign flag will indicate the opposite of the sign of the true difference. Hence, the E XCLUSIVE -O R of the overflow and sign bits provides a test for whether a b. The other signed comparison tests are based on 3.6. CONTROL other combinations of SF ˆ OF and ZF. 113 For the testing of unsigned comparisons, the carry flag will be set by the cmpl instruction when the integer difference a b of the unsigned arguments a and b would be negative, that is, when (unsigned) a < (unsigned) b. Thus, the...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online