| CPC G06F 8/452 (2013.01) | 26 Claims |

|
1. A method for vectorizing a loop, comprising:
receiving, by a compiler operating on a computing system, input code that comprises a loop that operates on a first array of elements and a second array of elements, wherein during an iteration of the loop a first operation is performed on an element of the first array of elements, or a second operation is performed on an element of the second array of elements;
generating a first compound operation that operates on a predetermined number of elements of the first array of elements, the first compound operation resulting in a first intermediate vector, wherein the first compound operation is executed in parallel in hardware;
generating a second compound operation that operates on the predetermined number of elements of the second array of elements, the second compound operation resulting in a second intermediate vector, wherein the second compound operation is executed in parallel in hardware;
interleaving the first intermediate vector and the second intermediate vector to produce an interleaved result, and storing the interleaved result in a temporary vector; and summing the interleaved result in the temporary vector using an order-preserving sum.
|