2 solution pg 490 since each virtual page is bytes

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: sembly to determine how the address references are computed: 1 2 3 4 5 6 7 8 9 movl movl leal leal subl addl sall movl addl 8(%ebp),%ecx 12(%ebp),%eax 0(,%eax,4),%ebx 0(,%ecx,8),%edx %ecx,%edx %ebx,%eax $2,%eax mat2(%eax,%ecx,4),%eax mat1(%ebx,%edx,4),%eax Get i Get j 4*j 8*i 7*i 5*j 20*j mat2[(20*j + 4*i)/4] + mat1[(4*j + 28*i)/4] From this we can see that the reference to matrix mat1 is at byte offset ´ · µ, while the reference to matrix mat2 is at byte offset ´ · µ. From this we can determine that mat1 has 7 columns, while mat2 has 5, giving Å and Æ . B.3. MACHINE LEVEL REPRESENTATION OF C PROGRAMS Problem 3.20 Solution: [Pg. 150] 709 This exercise requires you to study assembly code to understand how it has been optimized. This is an important skill for improving program performance. By adjusting your source code, you can have an effect on the efficiency of the generated machine code. Here is an optimized version of the C code: 1 2 3 4 5 6 7 8 9 10 11 /* Set all diagonal elements to val */ void fix_set_diag_opt(fix_matrix A,...
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