Use getScalarSizeInBits not getPrimitiveSizeInBits to determine the shift value at the element level.