324_Book

# Observe that body statement is executed at least once

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ¼, and hence the zero ﬂag 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 overﬂow, this would be indicated by having the sign ﬂag set. When there is positive overﬂow, because a b is a large positive number, however, we will have t ¼. When there is negative overﬂow, because a b is a small negative number, we will have t ¼. In either case, the sign ﬂag will indicate the opposite of the sign of the true difference. Hence, the E XCLUSIVE -O R of the overﬂow 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 ﬂag 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