title: What's the most efficient way to multiply 4 floats by 4 floats using SSE?
body: <p>I currently have the following code:</p>
  
  <pre><code>float a[4] = { 10, 20, 30, 40 };
  float b[4] = { 0.1, 0.1, 0.1, 0.1 };
  asm volatile("movups (%0), %%xmm0\n\t"
               "mulps (%1), %%xmm0\n\t"             
               "movups %%xmm0, (%1)"             
               :: "r" (a), "r" (b));
  </code></pre>
  
  <p>I have first of all a few questions:</p>
  
  <p>(1) if i WERE to align the arrays on 16 byte boundaries, would it even work? Since the arrays are allocated on the stack is it true that aligning them is near impossible?</p>
  
  <p>see the selected answer for this post: <a href="https://stackoverflow.com/questions/841433/gcc-attributealignedx-explanation">Are stack variables aligned by the GCC __attribute__((aligned(x)))?</a></p>
  
  <p>(2) Could the code be refactored at all to make it more efficient? What if I put both float arrays in registers rather than just one?</p>
  
  <p>Thanks</p>