Even when there are discontinuities they do not

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: Three-Way Unrolled Integer Addition. With this degree of loop unrolling we can combine three array elements using six integer/branch operations. In general, the vector length will not be a multiple of 3. We want our code to work correctly for arbitrary vector lengths. We account for this requirement in two ways. First, we make sure the first loop does not overrun the array bounds. For a vector of length Ò, we set the loop limit to be Ò ¾. We are then assured that the loop will only be executed when the loop index satisfies Ò ¾, and hence the maximum array index · ¾ will satisfy · ¾ ´Ò ¾µ · ¾ Ò. In general, if the loop is unrolled by , we set the upper limit to be Ò · ½. The maximum loop index · ½ will then be less than Ò. In addition to this, we add a second loop to step through the final few elements of the vector one at a time. The body of this loop will be executed between 0 and 2 times. To better understand the performance of code with loop unrolling, let us look at th...
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