]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/loop-versioning-7.c
Add a loop versioning pass
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / loop-versioning-7.c
1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
2
3 /* Check that versioning can handle arrays of structures. */
4
5 struct foo {
6 int a, b, c;
7 };
8
9 void
10 f1 (struct foo *x, int stepx, int n)
11 {
12 for (int i = 0; i < n; ++i)
13 {
14 x[stepx * i].a = 1;
15 x[stepx * i].b = 2;
16 x[stepx * i].c = 3;
17 }
18 }
19
20 void
21 f2 (struct foo *x, int stepx, int limit)
22 {
23 for (int i = 0; i < limit; i += stepx)
24 {
25 x[i].a = 1;
26 x[i].b = 2;
27 x[i].c = 3;
28 }
29 }
30
31 /* { dg-final { scan-tree-dump-times {want to version containing loop} 2 "lversion" } } */
32 /* { dg-final { scan-tree-dump-times {versioned this loop} 2 "lversion" } } */