Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / loop-versioning-13.c
blobc67da047fa6cd81c9af2183187209396f8b908d0
1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
3 /* Test that we do version for a step of 1 when that would lead the
4 iterations to access consecutive groups. */
6 void
7 f1 (unsigned short *x, int stepx, int n)
9 for (int i = 0; i < n; ++i)
11 x[i * stepx * 2] = 100;
12 x[i * stepx * 2 + 1] = 99;
16 void
17 f2 (unsigned short *x, int stepx, int n)
19 for (int i = 0; i < n; i += stepx * 2)
21 x[i] = 100;
22 x[i + 1] = 99;
26 void
27 f3 (unsigned short *x, int stepx, int n)
29 for (int i = 0; i < n; ++i)
31 x[i * stepx * 2 - 16] = 100;
32 x[i * stepx * 2 - 15] = 99;
36 void
37 f4 (unsigned short *x, int stepx, int n)
39 for (int i = 0; i < n; i += stepx * 2)
41 x[i - 16] = 100;
42 x[i - 15] = 99;
46 void
47 f5 (unsigned short *x, int stepx, int n)
49 for (unsigned short *y = x; y < x + n; y += stepx * 2)
51 y[0] = 100;
52 y[1] = 99;
56 unsigned short x[1000];
58 void
59 g1 (int stepx, int n)
61 for (int i = 0; i < n; ++i)
63 x[i * stepx * 2] = 100;
64 x[i * stepx * 2 + 1] = 99;
68 void
69 g2 (int stepx, int n)
71 for (int i = 0; i < n; i += stepx * 2)
73 x[i] = 100;
74 x[i + 1] = 99;
78 void
79 g3 (int stepx, int n)
81 for (int i = 0; i < n; ++i)
83 x[i * stepx * 2 - 16] = 100;
84 x[i * stepx * 2 - 15] = 99;
88 void
89 g4 (int stepx, int n)
91 for (int i = 0; i < n; i += stepx * 2)
93 x[i - 16] = 100;
94 x[i - 15] = 99;
98 void
99 g5 (int stepx, int n)
101 for (unsigned short *y = x; y < x + n; y += stepx * 2)
103 y[0] = 100;
104 y[1] = 99;
108 /* { dg-final { scan-tree-dump-times {want to version containing loop} 10 "lversion" } } */
109 /* { dg-final { scan-tree-dump-times {versioned this loop} 10 "lversion" } } */