1 /* { dg-do compile } */
2 /* { dg-additional-options "-fno-tree-loop-vectorize" } */
3 /* { dg-require-effective-target vect_double } */
4 /* { dg-require-effective-target lp64 } */
5 
6 void
f1(double * p,double * q,unsigned int n)7 f1 (double *p, double *q, unsigned int n)
8 {
9   p = (double *) __builtin_assume_aligned (p, sizeof (double) * 2);
10   q = (double *) __builtin_assume_aligned (q, sizeof (double) * 2);
11   for (unsigned int i = 0; i < n; i += 4)
12     {
13       double a = q[i] + p[i];
14       double b = q[i + 1] + p[i + 1];
15       q[i] = a;
16       q[i + 1] = b;
17     }
18 }
19 
20 void
f2(double * p,double * q,unsigned int n)21 f2 (double *p, double *q, unsigned int n)
22 {
23   p = (double *) __builtin_assume_aligned (p, sizeof (double) * 2);
24   q = (double *) __builtin_assume_aligned (q, sizeof (double) * 2);
25   for (unsigned int i = 0; i < n; i += 2)
26     {
27       double a = q[i] + p[i];
28       double b = q[i + 1] + p[i + 1];
29       q[i] = a;
30       q[i + 1] = b;
31     }
32 }
33 
34 void
f3(double * p,double * q,unsigned int n)35 f3 (double *p, double *q, unsigned int n)
36 {
37   p = (double *) __builtin_assume_aligned (p, sizeof (double) * 2);
38   q = (double *) __builtin_assume_aligned (q, sizeof (double) * 2);
39   for (unsigned int i = 0; i < n; i += 6)
40     {
41       double a = q[i] + p[i];
42       double b = q[i + 1] + p[i + 1];
43       q[i] = a;
44       q[i + 1] = b;
45     }
46 }
47 
48 void
f4(double * p,double * q,unsigned int start,unsigned int n)49 f4 (double *p, double *q, unsigned int start, unsigned int n)
50 {
51   p = (double *) __builtin_assume_aligned (p, sizeof (double) * 2);
52   q = (double *) __builtin_assume_aligned (q, sizeof (double) * 2);
53   for (unsigned int i = start & -2; i < n; i += 2)
54     {
55       double a = q[i] + p[i];
56       double b = q[i + 1] + p[i + 1];
57       q[i] = a;
58       q[i + 1] = b;
59     }
60 }
61 
62 /* { dg-final { scan-tree-dump-times "basic block vectorized" 4 "slp1" } } */
63