(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr94308.c
       1  /* PR target/94308 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -mfpmath=sse -mavx2 -mfma" } */
       4  
       5  #include <x86intrin.h>
       6  
       7  void
       8  foo (float *x, const float *y, const float *z, unsigned int w)
       9  {
      10    unsigned int a;
      11    const unsigned int b = w / 8;
      12    const float *c = y;
      13    const float *d = z;
      14    __m256 e = _mm256_setzero_ps ();
      15    __m256 f, g;
      16    for (a = 0; a < b; a++)
      17      {
      18        f = _mm256_loadu_ps (c);
      19        g = _mm256_loadu_ps (d);
      20        c += 8;
      21        d += 8;
      22        e = _mm256_fmadd_ps (f, g, e);
      23      }
      24    __attribute__ ((aligned (32))) float h[8];
      25    _mm256_storeu_ps (h, e);
      26    _mm256_zeroupper ();
      27    float i = h[0] + h[1] + h[2] + h[3] + h[4] + h[5] + h[6] + h[7];
      28    for (a = b * 8; a < w; a++)
      29      i += (*c++) * (*d++);
      30    *x = i;
      31  }