You might nd it helpful to rst annotate the assembly

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: ents (Figure 3.2) or a memory location where the single byte is to be stored. To generate a 32-bit result, we must also clear the high-order 24 bits. A typical instruction sequence for a C predicate such as a<b is therefore as follows Note: a is in %edx, b is in %eax Compare a:b Set low order byte of %eax to 0 or 1 Set remaining bytes of %eax to 0 1 2 3 cmpl %eax,%edx setl %al movzbl %al,%eax using the movzbl instruction to clear the high-order three bytes. For some of the underlying machine instructions, there are multiple possible names, which we list as “synonyms.” For example both “setg” (for “SET-Greater”) and “setnle” (for “SET-Not-Less-or-Equal”) refer to the same machine instruction. Compilers and disassemblers make arbitrary choices of which names to use. Although all arithmetic operations set the condition codes, the descriptions of the different set commands apply to the case where a comparison instruction has been executed, setting the condition codes according to the computation t=a-b. For example, consider the sete, or “Set when equal” instruction. When a b, we will have t...
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