title: How to Calculate single-vector Dot Product using SSE intrinsic functions in C
body: <p>I am trying to multiply two vectors together where each element of one vector is multiplied by the element in the same index at the other vector.  I then want to sum all the elements of the resulting vector to obtain one number.  For instance, the calculation would look like this for the vectors {1,2,3,4} and {5,6,7,8}:</p>
  
  <pre><code>1*5 + 2*6 + 3*7 + 4*8
  </code></pre>
  
  <p>Essentially, I am taking the dot product of the two vectors.  I know there is an SSE command to do this, but the command doesn't have an intrinsic function associated with it.  At this point, I don't want to write inline assembly in my C code, so I want to use only intrinsic functions.  This seems like a common calculation so I am surprised by myself that I couldn't find the answer on Google.</p>
  
  <p>Note:  I am optimizing for a specific micro architecture which supports up to SSE 4.2.</p>