Direct jumps are written in assembly by giving a

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: n 2.3.6 (page 63). Instruction 6 performs the AND operation and instruction 7 performs the final multiplication. Then instruction 8 moves the return value into register %eax. In the assembly code of Figure 3.7, the sequence of values in register %eax correspond to program values y, t1, t3, and t4 (as the return value). In general, compilers generate code that uses individual registers for multiple program values and that move program values among the registers. Practice Problem 3.6: In the compilation of the following loop: for (i = 0; i < n; i++) v += i; we find the following assembly code line: 3.5. ARITHMETIC AND LOGICAL OPERATIONS Instruction imull Ë mull Ë cltd idivl Ë divl Effect Ê %edx Ê Ê %edx Ê Ê %edx Ê Ê %edx Ê %eax Ê %edx Ê %eax 109 Description Signed Full Multiply Unsigned Full Multiply Convert to Quad Word Signed Divide Unsigned Divide Ë %eax %eax %eax Ê %edx Ê %edx Ê %edx Ê %edx Ë Ê Ê Ê Ê Ë¢Ê Ë¢Ê %eax %eax Ò ÜØ Ò ´Ê %eax µ %eax ÑÓ Ë ; %eax ¤ Ë %eax ÑÓ Ë ; %eax ¤ Ë Figure 3.8: Speci...
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