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