aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c
blob: 260d65cd4972733202231099ef4850f448495002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-require-effective-target vect_double } */

double dotprod(const double *a, const double *b, unsigned long long n)
{
  double d1 = 0.0;
  double d2 = 0.0;

  for (unsigned long long i = 0; i < n; i += 2) {
    d1 += a[i] * b[i];
    d2 += a[i + 1] * b[i + 1];
  }

  return (d1 + d2);
}

/* We should use a SLP reduction even without -ffast-math by using a
   VF of one.  */
/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" { xfail vect_variable_length } } } */
/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */