We have found that a certain amount of trial and

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: rd is transferred to an integer register with the fnstsw instruction. The operand for this instruction is one of the 16-bit register identifiers shown in Figure 3.2, for example, %ax. The bits in the status word encoding the comparison results are in bit positions 0, 2, and 6 of the high-order byte of the status word. For example, if we use instruction fnstw %ax to transfer the status word, then the relevant bits will be in %ah. A typical code sequence to select these bits is then: 1 fnstsw %ax Store floating point status word in %ax 186 2 CHAPTER 3. MACHINE-LEVEL REPRESENTATION OF C PROGRAMS andb $69,%ah Mask all but bits 0, 2, and 6 Note that ½¼ has bit representation ¼¼½¼¼½¼½ , that is, it has 1s in the three relevant bit positions. Figure 3.35 shows the possible values of byte %ah that would result from this code sequence. Observe that there are only four possible outcomes for comparing operands ÇÔ ½ and ÇÔ ¾ : the first is either greater, less, equal, or incomparable to the second,...
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