(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
pr107451.c
       1  /* { dg-do run } */
       2  /* { dg-additional-options "-ftree-vectorize -fno-vect-cost-model" } */
       3  /* { dg-additional-options "-mavx2" { target avx2_runtime } } */
       4  
       5  double getdot(int n, const double *x, int inc_x, const double *y)
       6  {
       7    int i, ix = 0;
       8    double dot[4] = { 0.0, 0.0, 0.0, 0.0 } ;
       9  
      10    for(i = 0; i < n; i++) {
      11        dot[0] += x[ix]   * y[ix]   ;
      12        dot[1] += x[ix+1] * y[ix+1] ;
      13        dot[2] += x[ix]   * y[ix+1] ;
      14        dot[3] += x[ix+1] * y[ix]   ;
      15        ix += inc_x ;
      16    }
      17  
      18    return dot[0] + dot[1] + dot[2] + dot[3];
      19  }
      20  
      21  int main()
      22  {
      23    double x[2] = {0, 0}, y[2] = {0, 0};
      24    if (getdot(1, x, 4096*4096, y) != 0.)
      25      __builtin_abort ();
      26    return 0;
      27  }