A computer implemented method for using Superword-Level Parallelism (SLP) in processing a plurality of statements, wherein the statements are associated with an array having a number of array positions, and each statement includes one or more expressions, the computer implemented method comprising the steps of:
- gathering, by one or more computer processors, isomorphic and non-isomorphic expressions for each of the statements into a merge stream of mixed isomorphic and non-isomorphic expressions, the merge stream being furnished with a location for each gathered isomorphic expression and each gathered non-isomorphic expression, wherein the location for a given expression is associated with one of the positions of the array;
- selectively identifying, by the one or more computer processors, one or more sets of expressions in the merge stream that are aggregatable by a SLP packing operation, and applying the SLP packing operation to the identified one or more sets of expressions in order to merge the identified one or more sets of expressions into one or more isomorphic sub-streams;
- selectively combining, by the one or more computer processors, the expressions of the one or more isomorphic sub-streams, and other non-isomorphic expressions of the merge stream, into a number of input vectors that are substantially equal in length to one another;
- generating, by the one or more computer processors, a location vector containing the respective locations for all of the isomorphic and non-isomorphic expressions in the merge stream;
- generating, by the one or more computer processors, an output stream comprising the expressions of the number of input vectors, wherein said expressions are arranged in an order in the output stream that is determined by the respective locations contained in the location vector;
- and
- preserving, by the one or more computer processors, at least one location vector or a set of location vectors at each step during processing.