1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
2
3 /* Test that we don't try to version for a step of 1 when that would
4 cause the iterations to overlap. */
5
6 void
f1(unsigned short * x,int stepx,int n)7 f1 (unsigned short *x, int stepx, int n)
8 {
9 for (int i = 0; i < n; ++i)
10 {
11 x[i * stepx] = 100;
12 x[i * stepx + 1] = 99;
13 }
14 }
15
16 void
f2(unsigned short * x,int stepx,int n)17 f2 (unsigned short *x, int stepx, int n)
18 {
19 for (int i = 0; i < n; i += stepx)
20 {
21 x[i] = 100;
22 x[i + 1] = 99;
23 }
24 }
25
26 void
f3(unsigned short * x,int stepx,int n)27 f3 (unsigned short *x, int stepx, int n)
28 {
29 for (int i = 0; i < n; ++i)
30 {
31 x[i * stepx - 16] = 100;
32 x[i * stepx - 15] = 99;
33 }
34 }
35
36 void
f4(unsigned short * x,int stepx,int n)37 f4 (unsigned short *x, int stepx, int n)
38 {
39 for (int i = 0; i < n; i += stepx)
40 {
41 x[i - 16] = 100;
42 x[i - 15] = 99;
43 }
44 }
45
46 void
f5(unsigned short * x,int stepx,int n)47 f5 (unsigned short *x, int stepx, int n)
48 {
49 for (int i = 0; i < n; ++i)
50 {
51 x[i * stepx - 16] = 100;
52 x[i * stepx + 15] = 99;
53 }
54 }
55
56 void
f6(unsigned short * x,int stepx,int n)57 f6 (unsigned short *x, int stepx, int n)
58 {
59 for (int i = 0; i < n; i += stepx)
60 {
61 x[i - 16] = 100;
62 x[i + 15] = 99;
63 }
64 }
65
66 void
f7(unsigned short * x,int stepx,int n)67 f7 (unsigned short *x, int stepx, int n)
68 {
69 for (unsigned short *y = x; y < x + n; y += stepx)
70 {
71 y[0] = 100;
72 y[1] = 99;
73 }
74 }
75
76 unsigned short x[1000];
77
78 void
g1(int stepx,int n)79 g1 (int stepx, int n)
80 {
81 for (int i = 0; i < n; ++i)
82 {
83 x[i * stepx] = 100;
84 x[i * stepx + 1] = 99;
85 }
86 }
87
88 void
g2(int stepx,int n)89 g2 (int stepx, int n)
90 {
91 for (int i = 0; i < n; i += stepx)
92 {
93 x[i] = 100;
94 x[i + 1] = 99;
95 }
96 }
97
98 void
g3(int stepx,int n)99 g3 (int stepx, int n)
100 {
101 for (int i = 0; i < n; ++i)
102 {
103 x[i * stepx - 16] = 100;
104 x[i * stepx - 15] = 99;
105 }
106 }
107
108 void
g4(int stepx,int n)109 g4 (int stepx, int n)
110 {
111 for (int i = 0; i < n; i += stepx)
112 {
113 x[i - 16] = 100;
114 x[i - 15] = 99;
115 }
116 }
117
118 void
g5(int stepx,int n)119 g5 (int stepx, int n)
120 {
121 for (int i = 0; i < n; ++i)
122 {
123 x[i * stepx - 16] = 100;
124 x[i * stepx + 15] = 99;
125 }
126 }
127
128 void
g6(int stepx,int n)129 g6 (int stepx, int n)
130 {
131 for (int i = 0; i < n; i += stepx)
132 {
133 x[i - 16] = 100;
134 x[i + 15] = 99;
135 }
136 }
137
138 void
g7(int stepx,int n)139 g7 (int stepx, int n)
140 {
141 for (unsigned short *y = x; y < x + n; y += stepx)
142 {
143 y[0] = 100;
144 y[1] = 99;
145 }
146 }
147
148 /* { dg-final { scan-tree-dump-not {want to version} "lversion" } } */
149 /* { dg-final { scan-tree-dump-not {versioned} "lversion" } } */
150