Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-3.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=zvl" } */
3
4 #include <stdint-gcc.h>
5
6 void __attribute__ ((noinline, noclone))
7 f0 (int8_t *__restrict x, int16_t *__restrict y, int n)
8 {
9 for (int i = 0, j = 0; i < n; i += 4, j += 8)
10 {
11 x[i + 0] += 1;
12 x[i + 1] += 2;
13 x[i + 2] += 3;
14 x[i + 3] += 4;
15 y[j + 0] += 1;
16 y[j + 1] += 2;
17 y[j + 2] += 3;
18 y[j + 3] += 4;
19 y[j + 4] += 5;
20 y[j + 5] += 6;
21 y[j + 6] += 7;
22 y[j + 7] += 8;
23 }
24 }
25
26 void __attribute__ ((optimize (0)))
27 f0_init (int8_t *__restrict x, int8_t *__restrict x2, int16_t *__restrict y,
28 int16_t *__restrict y2, int n)
29 {
30 for (int i = 0, j = 0; i < n; i += 4, j += 8)
31 {
32 x[i + 0] = i % 120;
33 x[i + 1] = i % 78;
34 x[i + 2] = i % 55;
35 x[i + 3] = i % 27;
36 y[j + 0] = j % 33;
37 y[j + 1] = j % 44;
38 y[j + 2] = j % 66;
39 y[j + 3] = j % 88;
40 y[j + 4] = j % 99;
41 y[j + 5] = j % 39;
42 y[j + 6] = j % 49;
43 y[j + 7] = j % 101;
44
45 x2[i + 0] = i % 120;
46 x2[i + 1] = i % 78;
47 x2[i + 2] = i % 55;
48 x2[i + 3] = i % 27;
49 y2[j + 0] = j % 33;
50 y2[j + 1] = j % 44;
51 y2[j + 2] = j % 66;
52 y2[j + 3] = j % 88;
53 y2[j + 4] = j % 99;
54 y2[j + 5] = j % 39;
55 y2[j + 6] = j % 49;
56 y2[j + 7] = j % 101;
57 }
58 }
59
60 void __attribute__ ((optimize (0)))
61 f0_golden (int8_t *__restrict x, int16_t *__restrict y, int n)
62 {
63 for (int i = 0, j = 0; i < n; i += 4, j += 8)
64 {
65 x[i + 0] += 1;
66 x[i + 1] += 2;
67 x[i + 2] += 3;
68 x[i + 3] += 4;
69 y[j + 0] += 1;
70 y[j + 1] += 2;
71 y[j + 2] += 3;
72 y[j + 3] += 4;
73 y[j + 4] += 5;
74 y[j + 5] += 6;
75 y[j + 6] += 7;
76 y[j + 7] += 8;
77 }
78 }
79
80 void __attribute__ ((optimize (0)))
81 f0_check (int8_t *__restrict x, int8_t *__restrict x2, int16_t *__restrict y,
82 int16_t *__restrict y2, int n)
83 {
84 for (int i = 0, j = 0; i < n; i += 4, j += 8)
85 {
86 if (x[i + 0] != x2[i + 0])
87 __builtin_abort ();
88 if (x[i + 1] != x2[i + 1])
89 __builtin_abort ();
90 if (x[i + 2] != x2[i + 2])
91 __builtin_abort ();
92 if (x[i + 3] != x2[i + 3])
93 __builtin_abort ();
94 if (y[j + 0] != y2[j + 0])
95 __builtin_abort ();
96 if (y[j + 1] != y2[j + 1])
97 __builtin_abort ();
98 if (y[j + 2] != y2[j + 2])
99 __builtin_abort ();
100 if (y[j + 3] != y2[j + 3])
101 __builtin_abort ();
102 if (y[j + 4] != y2[j + 4])
103 __builtin_abort ();
104 if (y[j + 5] != y2[j + 5])
105 __builtin_abort ();
106 if (y[j + 6] != y2[j + 6])
107 __builtin_abort ();
108 if (y[j + 7] != y2[j + 7])
109 __builtin_abort ();
110 }
111 }
112
113 void __attribute__ ((noinline, noclone))
114 f1 (int16_t *__restrict x, int32_t *__restrict y, int n)
115 {
116 for (int i = 0, j = 0; i < n; i += 2, j += 4)
117 {
118 x[i + 0] += 1;
119 x[i + 1] += 2;
120 y[j + 0] += 1;
121 y[j + 1] += 2;
122 y[j + 2] += 3;
123 y[j + 3] += 4;
124 }
125 }
126
127 void __attribute__ ((optimize (0)))
128 f1_init (int16_t *__restrict x, int16_t *__restrict x2, int32_t *__restrict y,
129 int32_t *__restrict y2, int n)
130 {
131 for (int i = 0, j = 0; i < n; i += 2, j += 4)
132 {
133 x[i + 0] = i % 67;
134 x[i + 1] = i % 76;
135 y[j + 0] = j % 111;
136 y[j + 1] = j % 63;
137 y[j + 2] = j % 39;
138 y[j + 3] = j % 8;
139
140 x2[i + 0] = i % 67;
141 x2[i + 1] = i % 76;
142 y2[j + 0] = j % 111;
143 y2[j + 1] = j % 63;
144 y2[j + 2] = j % 39;
145 y2[j + 3] = j % 8;
146 }
147 }
148
149 void __attribute__ ((optimize (0)))
150 f1_golden (int16_t *__restrict x, int32_t *__restrict y, int n)
151 {
152 for (int i = 0, j = 0; i < n; i += 2, j += 4)
153 {
154 x[i + 0] += 1;
155 x[i + 1] += 2;
156 y[j + 0] += 1;
157 y[j + 1] += 2;
158 y[j + 2] += 3;
159 y[j + 3] += 4;
160 }
161 }
162
163 void __attribute__ ((optimize (0)))
164 f1_check (int16_t *__restrict x, int16_t *__restrict x2, int32_t *__restrict y,
165 int32_t *__restrict y2, int n)
166 {
167 for (int i = 0, j = 0; i < n; i += 2, j += 4)
168 {
169 if (x[i + 0] != x2[i + 0])
170 __builtin_abort ();
171 if (x[i + 1] != x2[i + 1])
172 __builtin_abort ();
173 if (y[j + 0] != y2[j + 0])
174 __builtin_abort ();
175 if (y[j + 1] != y2[j + 1])
176 __builtin_abort ();
177 if (y[j + 2] != y2[j + 2])
178 __builtin_abort ();
179 if (y[j + 3] != y2[j + 3])
180 __builtin_abort ();
181 }
182 }
183
184 void __attribute__ ((noinline, noclone))
185 f2 (int32_t *__restrict x, int64_t *__restrict y, int n)
186 {
187 for (int i = 0, j = 0; i < n; i += 1, j += 2)
188 {
189 x[i + 0] += 1;
190 y[j + 0] += 1;
191 y[j + 1] += 2;
192 }
193 }
194
195 void __attribute__ ((optimize (0)))
196 f2_init (int32_t *__restrict x, int32_t *__restrict x2, int64_t *__restrict y,
197 int64_t *__restrict y2, int n)
198 {
199 for (int i = 0, j = 0; i < n; i += 1, j += 2)
200 {
201 x[i + 0] = i % 79;
202 y[j + 0] = j % 83;
203 y[j + 1] = j % 100;
204
205 x2[i + 0] = i % 79;
206 y2[j + 0] = j % 83;
207 y2[j + 1] = j % 100;
208 }
209 }
210
211 void __attribute__ ((optimize (0)))
212 f2_golden (int32_t *__restrict x, int64_t *__restrict y, int n)
213 {
214 for (int i = 0, j = 0; i < n; i += 1, j += 2)
215 {
216 x[i + 0] += 1;
217 y[j + 0] += 1;
218 y[j + 1] += 2;
219 }
220 }
221
222 void __attribute__ ((noinline, noclone))
223 f2_check (int32_t *__restrict x, int32_t *__restrict x2, int64_t *__restrict y,
224 int64_t *__restrict y2, int n)
225 {
226 for (int i = 0, j = 0; i < n; i += 1, j += 2)
227 {
228 if (x[i + 0] != x2[i + 0])
229 __builtin_abort ();
230 if (y[j + 0] != y2[j + 0])
231 __builtin_abort ();
232 if (y[j + 1] != y2[j + 1])
233 __builtin_abort ();
234 }
235 }
236
237 void __attribute__ ((noinline, noclone))
238 f3 (int8_t *__restrict x, int64_t *__restrict y, int n)
239 {
240 for (int i = 0, j = 0; i < n; i += 1, j += 2)
241 {
242 x[i + 0] += 1;
243 y[j + 0] += 1;
244 y[j + 1] += 2;
245 }
246 }
247
248 void __attribute__ ((noinline, noclone))
249 f3_init (int8_t *__restrict x, int8_t *__restrict x2, int64_t *__restrict y,
250 int64_t *__restrict y2, int n)
251 {
252 for (int i = 0, j = 0; i < n; i += 1, j += 2)
253 {
254 x[i + 0] = i % 22;
255 y[j + 0] = i % 12;
256 y[j + 1] = i % 21;
257
258 x2[i + 0] = i % 22;
259 y2[j + 0] = i % 12;
260 y2[j + 1] = i % 21;
261 }
262 }
263
264 void __attribute__ ((optimize (0)))
265 f3_golden (int8_t *__restrict x, int64_t *__restrict y, int n)
266 {
267 for (int i = 0, j = 0; i < n; i += 1, j += 2)
268 {
269 x[i + 0] += 1;
270 y[j + 0] += 1;
271 y[j + 1] += 2;
272 }
273 }
274
275 void __attribute__ ((noinline, noclone))
276 f3_check (int8_t *__restrict x, int8_t *__restrict x2, int64_t *__restrict y,
277 int64_t *__restrict y2, int n)
278 {
279 for (int i = 0, j = 0; i < n; i += 1, j += 2)
280 {
281 if (x[i + 0] != x2[i + 0])
282 __builtin_abort ();
283 if (y[j + 0] != y2[j + 0])
284 __builtin_abort ();
285 if (y[j + 1] != y2[j + 1])
286 __builtin_abort ();
287 }
288 }