Permute instructions copy unaltered contents from a source array to a destination array, where the indices are specified by a second source array. The size (bitwidth) of the source elements is not restricted but remains the same as the destination size. There exists two important variants, known as gather and scatter, respectively. The scatter variant is as follows: for i = 0 to length-1 dest[i] = src[indices[i]] where the gather variant is: for i = 0 to length-1 dest[indices[[i]] = src[i]

Bogdan Ilić

Permute instructions copy unaltered contents from a source array to a destination array, where the indices are specified by a second source array. The size (bitwidth) of the source elements is not restricted but remains the same as the destination size. There exists two important variants, known as gather and scatter, respectively. The scatter variant is as follows: for i = 0 to length-1 dest[i] = src[indices[i]] where the gather variant is: for i = 0 to length-1 dest[indices[[i]] = src[i] The scatter variant can be seen to "scatter" the source elements across (into) to the destination, where the "gather" variant is gathering data from the source elements. Given that the indices may be repeated in both variants, the resultant output is not a strict mathematical permutation because duplicates can occur in the output. Permute instructions, misleadingly, actually create combinations. A special case of permute is also used in GPU "swizzling" (again, actually a combination) which performs on-the-fly reordering of subvector data so as to align or duplicate elements with the appropriate SIMD lane.