1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_double } */
3
4 double dotprod(const double *a, const double *b, unsigned long long n)
5 {
6 double d1 = 0.0;
7 double d2 = 0.0;
8
9 for (unsigned long long i = 0; i < n; i += 2) {
10 d1 += a[i] * b[i];
11 d2 += a[i + 1] * b[i + 1];
12 }
13
14 return (d1 + d2);
15 }
16
17 /* We should use a SLP reduction even without -ffast-math by using a
18 VF of one. */
19 /* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" { xfail vect_variable_length } } } */
20 /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */