https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40073
--- Comment #12 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> --- If we are left shifting a narrow signed type for the result, and no defined overflow semantics are in place, it should be OK to just vectorize the code using the result type. If we are right shifting a signed type, we could apply a MAX operation to the shift count. If we are shifting an unsigned type, we can do a vector compare to check if the shift count exceeds the range, and use an AND to zero the result if that is the case. If we are doing a shift right of a signed value where -fwrapv semantics are required or allowed, we can do the same as for unsigned shift. Thus, a shift is replaced by two or three vactor operations, which should be a win if the vectorization factor is four or more. The MAX and compare operations might subsequently be eliminated if value range propagation finds that the value can't be out of range.