1. A method for generating a result vector with shifted values from an input vector, comprising: receiving the input vector and a control vector, and optionally receiving a predicate vector, wherein each vector includes N elements; and generating the result vector, wherein generating the result vector involves, if the predicate vector is received, for each element in the result vector to the right of a key element position for which a corresponding element in the predicate vector contains a non-zero value, otherwise, for each element in the result vector to the right of the key element position: if an element at a first element position in the control vector to the left of the element in the result vector contains a non-zero value, setting the element in the result vector equal to a value contained in an element at the first element position in the input vector; otherwise, if the element at the first element position in the control vector contains a zero, setting the element in the result vector equal to a value contained in an element at a second element position in the input vector which corresponds to the rightmost element that contains a non-zero value in the control vector that is to the left of the first element position.