This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ses of integer data with both multiplication and addition as the combining operations. The compiled code for this loop with multiplication consists of four instructions. In this code, register %eax holds the pointer data, %edx holds i, %ecx holds x, and %esi holds length.
combine4: type=INT, OPER = * data in %eax, x in %ecx, i in %edx, length in %esi .L24: loop: imull (%eax,%edx,4),%ecx Multiply x by data[i] incl %edx i++ cmpl %esi,%edx Compare i:length jl .L24 If <, goto loop 1 2 3 4 5 Every time the processor executes the loop, the instruction decoder translates these four instructions into a sequence of operations for the Execution Unit. On the ﬁrst iteration, with i equal to 0, our hypothetical machine would issue the following sequence of operations: 226 CHAPTER 5. OPTIMIZING PROGRAM PERFORMANCE Assembly Instructions .L24: imull (%eax,%edx,4),%ecx incl %edx cmpl %esi,%edx jl .L24 Execution Unit Operations load (%eax, %edx.0, 4) imull t.1, %ecx.0 incl %edx.0 cmpl %esi, %edx.1 jl-take...
View Full Document
- Spring '10
- The American