The memory hierarchy sets also more than two devices

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: edx.1,%edx.1 jne-taken cc.1 t.1 %eax.1 %edx.1 cc.1 272 CHAPTER 5. OPTIMIZING PROGRAM PERFORMANCE A. Draw a graph showing the scheduling of operations for the first three iterations of the loop, in the style of Figure 5.31. Recall that there is just one load unit. B. Our measurements for this function give a CPE of 4.00. Is this consistent with the graph you drew in part A? Homework Problem 5.15 [Category 2]: The following function is a variant on the list sum function shown in Problem 5.14: 1 2 3 4 5 6 7 8 9 10 11 12 static int list_sum2(list_ptr ls) { int sum = 0; list_ptr old; while (ls) { old = ls; ls = ls->next; sum += old->data; } return sum; } This code is written in such a way that the memory access to fetch the next list element comes before the one to retrieve the data field from the current element. The assembly code for the loop, and its translation of the first iteration into operations yields the following: Assembly Instructions .L48: movl %edx,%ecx movl (%edx),%edx addl 4(%ecx),%eax testl %edx,%edx jne .L48 Execution Unit Operations load (%edx.0) movl 4(%edx.0) addl t.1,%ea...
View Full Document

Ask a homework question - tutors are online