title: How to optimize C-code with SSE-intrinsics for packed 32x32 => 64-bit multiplies, and unpacking the halves of those results for (Galois Fields)
body: <p>I've been struggling for a while with the performance of the network coding in an application I'm developing (see <a href="https://stackoverflow.com/questions/7794941/optimzing-sse-code">Optimzing SSE-code</a>, <a href="https://stackoverflow.com/questions/7737488/improving-performance-of-network-coding-encoding">Improving performance of network coding-encoding</a> and <a href="https://stackoverflow.com/questions/7751019/opencl-distribution">OpenCL distribution</a>). Now I'm quite close to achieve acceptable performance. This is the current state of the innermost loop (which is where >99% of the execution time is being spent):</p>
  
  <pre><code>while(elementIterations-- &gt;0)
  {   
      unsigned int firstMessageField = *(currentMessageGaloisFieldsArray++);
      unsigned int secondMessageField = *(currentMessageGaloisFieldsArray++);
      __m128i valuesToMultiply = _mm_set_epi32(0, secondMessageField, 0, firstMessageField);
      __m128i mulitpliedHalves = _mm_mul_epu32(valuesToMultiply, fragmentCoefficentVector);
  }
  </code></pre>
  
  <p>Do you have any suggestions on how to further optimize this? I understand that it's hard to do without more context but any help is appreciated!</p>