builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / loop-versioning-10.c
blobf634448c253cfee9cc13c422192408fdec741d17
1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
3 /* Test that we can version a gather-like operation in which a variable
4 stride is applied to the index. */
6 int
7 f1 (int *x, int *index, int step, int n)
9 int res = 0;
10 for (int i = 0; i < n; ++i)
11 res += x[index[i] * step];
12 return res;
15 int
16 f2 (int *x, int *index, int step, int n)
18 int res = 0;
19 for (int i = 0; i < n; ++i)
21 int *ptr = x + index[i] * step;
22 res += *ptr;
24 return res;
27 int x[1000];
29 int
30 g1 (int *index, int step, int n)
32 int res = 0;
33 for (int i = 0; i < n; ++i)
34 res += x[index[i] * step];
35 return res;
38 int
39 g2 (int *index, int step, int n)
41 int res = 0;
42 for (int i = 0; i < n; ++i)
44 int *ptr = x + index[i] * step;
45 res += *ptr;
47 return res;
50 /* { dg-final { scan-tree-dump-times {address term [^\n]* \* loop-invariant} 4 "lversion" } } */
51 /* { dg-final { scan-tree-dump-times {want to version containing loop} 4 "lversion" } } */
52 /* { dg-final { scan-tree-dump-times {versioned this loop} 4 "lversion" } } */