How to perform element-wise left shift with __m128i? <p>The SSE shift instructions I have found can only shift by the same amount on all the elements:</p> <ul> <li><code>_mm_sll_epi32()</code></li> <li><code>_mm_slli_epi32()</code></li> </ul> <p><a href="http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011/compiler_c/intref_cls/common/intref_sse2_int_shift.htm" rel="nofollow">These shift all elements, but by the same shift amount.</a></p> <p>Is there a way to apply different shifts to the different elements? Something like this:</p> <pre><code>__m128i a, __m128i b; r0:= a0 &lt;&lt; b0; r1:= a1 &lt;&lt; b1; r2:= a2 &lt;&lt; b2; r3:= a3 &lt;&lt; b3; </code></pre>