This preview shows page 1. Sign up to view the full content.
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