title: Will gfortran or ifort compilers wisely use SIMD instructions when summing the product of two arrays?
body: <p>I&#39;ve got some code written with numpy, and I&#39;m considering porting it to Fortran for better performance.</p>
  
  <p>One operation I do several times is summing the element-wise product of two arrays:</p>
  
  <pre><code>sum(A*B)
  </code></pre>
  
  <p>It looks like fused multiply-add instructions would help with this. My current processor doesn&#39;t support these instructions, so I can&#39;t test things yet. However, I may upgrade to a new processor that does support FMA3 (an Intel Haswell processor).</p>
  
  <p>Does anyone know if compiling the program with &quot;-march=native&quot; (or the ifort equivalent) will be enough to get the compiler (either gfortran or ifort) to wisely use SIMD instructions to optimize that code, or do you think I&#39;ll have to baby the compilers or code?</p>