title: Fastest method to calculate sum of all packed 32-bit integers using AVX512 or AVX2
body: <p>I am looking for an optimal method to calculate sum of all packed 32-bit integers in a <code>__m256i</code> or <code>__m512i</code>. To calculate sum of <strong>n</strong> elements, I ofter use <strong>log2(n)</strong> <code>vpaddd</code> and <code>vpermd</code> function, then extract the final result. Howerver, it is not the best option I think.</p>
  
  <p>Edit: best/optimal in term of speed/cycle reduction.</p>