Debian Codegraph @

gcc/testsuite/gcc.target/arm/mve/dlstp-compile-asm-2.c

raw
1
2 /* { dg-do compile { target { arm*-*-* } } } */
3 /* { dg-require-effective-target arm_v8_1m_mve_ok } */
4 /* { dg-options "-O3 -save-temps -fno-schedule-insns2 " } */
5 /* { dg-add-options arm_v8_1m_mve } */
6 /* { dg-additional-options "-mtune=cortex-m55" } */
7 /* { dg-final { check-function-bodies "**" "" "" } } */
8
9 #include <arm_mve.h>
10 /* Using a >=1 condition. */
11 void test1 (int32_t *a, int32_t *b, int32_t *c, int n)
12 {
13 while (n >= 1)
14 {
15 mve_pred16_t p = vctp32q (n);
16 int32x4_t va = vldrwq_z_s32 (a, p);
17 int32x4_t vb = vldrwq_z_s32 (b, p);
18 int32x4_t vc = vaddq_x_s32 (va, vb, p);
19 vstrwq_p_s32 (c, vc, p);
20 c+=4;
21 a+=4;
22 b+=4;
23 n-=4;
24 }
25 }
26 /*
27 ** test1:
28 **...
29 ** dlstp.32 lr, r3
30 ** vldrw.32 q[0-9]+, \[r0\], #16
31 ** vldrw.32 q[0-9]+, \[r1\], #16
32 ** vadd.i32 (q[0-9]+), q[0-9]+, q[0-9]+
33 ** vstrw.32 \1, \[r2\], #16
34 ** letp lr, .*
35 **...
36 */
37
38 /* Test a for loop format of decrementing to zero */
39 int32_t a[] = {0, 1, 2, 3, 4, 5, 6, 7};
40 void test2 (int32_t *b, int num_elems)
41 {
42 for (int i = num_elems; i > 0; i-= 4)
43 {
44 mve_pred16_t p = vctp32q (i);
45 int32x4_t va = vldrwq_z_s32 (&(a[i]), p);
46 vstrwq_p_s32 (b + i, va, p);
47 }
48 }
49 /*
50 ** test2:
51 **...
52 ** dlstp.32 lr, r1
53 **...
54 ** vldrw.32 (q[0-9]+), \[r3\], #-16
55 ** vstrw.32 \1, \[r0\], #-16
56 ** letp lr, .*
57 **...
58 */
59
60 /* Iteration counter counting up to num_iter. */
61 void test3 (uint8_t *a, uint8_t *b, uint8_t *c, unsigned n)
62 {
63 int num_iter = (n + 15)/16;
64 for (int i = 0; i < num_iter; i++)
65 {
66 mve_pred16_t p = vctp8q (n);
67 uint8x16_t va = vldrbq_z_u8 (a, p);
68 uint8x16_t vb = vldrbq_z_u8 (b, p);
69 uint8x16_t vc = vaddq_x_u8 (va, vb, p);
70 vstrbq_p_u8 (c, vc, p);
71 n-=16;
72 a += 16;
73 b += 16;
74 c += 16;
75 }
76 }
77
78 /*
79 ** test3:
80 **...
81 ** dlstp.8 lr, r3
82 **...
83 ** vldrb.8 q[0-9]+, \[(r[0-9]+|ip)\]
84 ** vldrb.8 q[0-9]+, \[(r[0-9]+|ip)\]
85 **...
86 ** vadd.i8 (q[0-9]+), q[0-9]+, q[0-9]+
87 ** vstrb.8 \3, \[(r[0-9]+|ip)\]
88 **...
89 ** letp lr, .*
90 **...
91 */
92
93 /* Iteration counter counting down from num_iter. */
94 void test4 (uint8_t *a, uint8_t *b, uint8_t *c, int n)
95 {
96 int num_iter = (n + 15)/16;
97 for (int i = num_iter; i > 0; i--)
98 {
99 mve_pred16_t p = vctp8q (n);
100 uint8x16_t va = vldrbq_z_u8 (a, p);
101 uint8x16_t vb = vldrbq_z_u8 (b, p);
102 uint8x16_t vc = vaddq_x_u8 (va, vb, p);
103 vstrbq_p_u8 (c, vc, p);
104 n-=16;
105 a += 16;
106 b += 16;
107 c += 16;
108 }
109 }
110 /*
111 ** test4:
112 **...
113 ** dlstp.8 lr, r3
114 **...
115 ** vldrb.8 q[0-9]+, \[(r[0-9]+|ip)\]
116 ** vldrb.8 q[0-9]+, \[(r[0-9]+|ip)\]
117 **...
118 ** vadd.i8 (q[0-9]+), q[0-9]+, q[0-9]+
119 ** vstrb.8 \3, \[(r[0-9]+|ip)\]
120 **...
121 ** letp lr, .*
122 **...
123 */
124
125 /* Using an unpredicated arithmetic instruction within the loop. */
126 void test5 (uint8_t *a, uint8_t *b, uint8_t *c, uint8_t *d, int n)
127 {
128 while (n > 0)
129 {
130 mve_pred16_t p = vctp8q (n);
131 uint8x16_t va = vldrbq_z_u8 (a, p);
132 uint8x16_t vb = vldrbq_u8 (b);
133 /* Is affected by implicit predication, because vb also
134 came from an unpredicated load, but there is no functional
135 problem, because the result is used in a predicated store. */
136 uint8x16_t vc = vaddq_u8 (va, vb);
137 uint8x16_t vd = vaddq_x_u8 (va, vb, p);
138 vstrbq_p_u8 (c, vc, p);
139 vstrbq_p_u8 (d, vd, p);
140 n-=16;
141 a += 16;
142 b += 16;
143 c += 16;
144 }
145 }
146
147 /*
148 ** test5:
149 **...
150 ** (?:mov (r[0-9]+), r3)?
151 **...
152 ** dlstp.8 lr, (?:r[0-9]+|ip)
153 **...
154 ** vldrb.8 q[0-9]+, \[r1\]
155 ** vldrb.8 q[0-9]+, \[r2\]
156 **...
157 ** vadd.i8 (q[0-9]+), q[0-9]+, q[0-9]+
158 **...
159 ** vstrb.8 \2, \[r2\]
160 ** vstrb.8 \2, \[(r3|\1)\]
161 ** letp lr, .*
162 **...
163 */
164
165 /* Using a different VPR value for one instruction in the loop. */
166 void test6 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
167 {
168 while (n > 0)
169 {
170 mve_pred16_t p = vctp32q (n);
171 int32x4_t va = vldrwq_z_s32 (a, p);
172 int32x4_t vb = vldrwq_z_s32 (b, p1);
173 int32x4_t vc = vaddq_x_s32 (va, vb, p);
174 vstrwq_p_s32 (c, vc, p);
175 c += 4;
176 a += 4;
177 b += 4;
178 n -= 4;
179 }
180 }
181
182 /*
183 ** test6:
184 **...
185 ** dlstp.32 lr, r3
186 ** vldrw.32 q[0-9]+, \[r0\], #16
187 ** vpst
188 ** vldrwt.32 q[0-9]+, \[r1\], #16
189 ** vadd.i32 (q[0-9]+), q[0-9]+, q[0-9]+
190 ** vstrw.32 \1, \[r2\], #16
191 ** letp lr, .*
192 **...
193 */
194
195 /* Generating and using another VPR value in the loop, with a vctp.
196 The doloop logic will always try to do the transform on the first
197 vctp it encounters, so this is still expected to work. */
198 void test7 (int32_t *a, int32_t *b, int32_t *c, int n, int g)
199 {
200 while (n > 0)
201 {
202 mve_pred16_t p = vctp32q (n);
203 int32x4_t va = vldrwq_z_s32 (a, p);
204 mve_pred16_t p1 = vctp32q (g);
205 int32x4_t vb = vldrwq_z_s32 (b, p1);
206 int32x4_t vc = vaddq_x_s32 (va, vb, p);
207 vstrwq_p_s32 (c, vc, p);
208 c += 4;
209 a += 4;
210 b += 4;
211 n -= 4;
212 }
213 }
214 /*
215 ** test7:
216 **...
217 ** dlstp.32 lr, r3
218 ** vldrw.32 q[0-9]+, \[r0\], #16
219 ** (
220 ** vmsr p0, .*
221 ** vpst
222 ** |
223 ** vpst
224 ** )
225 ** vldrwt.32 q[0-9]+, \[r1\], #16
226 ** vadd.i32 (q[0-9]+), q[0-9]+, q[0-9]+
227 ** vstrw.32 \1, \[r2\], #16
228 ** letp lr, .*
229 **...
230 */
231
232 /* Generating and using a different VPR value in the loop, with a vctp,
233 but this time the p1 will also change in every loop (still fine) */
234 void test8 (int32_t *a, int32_t *b, int32_t *c, int n, int g)
235 {
236 while (n > 0)
237 {
238 mve_pred16_t p = vctp32q (n);
239 int32x4_t va = vldrwq_z_s32 (a, p);
240 mve_pred16_t p1 = vctp32q (g);
241 int32x4_t vb = vldrwq_z_s32 (b, p1);
242 int32x4_t vc = vaddq_x_s32 (va, vb, p);
243 vstrwq_p_s32 (c, vc, p);
244 c += 4;
245 a += 4;
246 b += 4;
247 n -= 4;
248 g++;
249 }
250 }
251
252 /*
253 ** test8:
254 **...
255 ** dlstp.32 lr, r3
256 ** vldrw.32 q[0-9]+, \[r0\], #16
257 ** vctp.32 (?:r4|ip)
258 ** vpst
259 ** vldrwt.32 q[0-9]+, \[r1\], #16
260 **...
261 ** vadd.i32 (q[0-9]+), q[0-9]+, q[0-9]+
262 ** vstrw.32 \1, \[r2\], #16
263 ** letp lr, .*
264 **...
265 */
266
267 /* Generating and using a different VPR value in the loop, with a vctp_m
268 that is independent of the loop vctp VPR. */
269 void test9 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
270 {
271 while (n > 0)
272 {
273 mve_pred16_t p = vctp32q (n);
274 int32x4_t va = vldrwq_z_s32 (a, p);
275 mve_pred16_t p2 = vctp32q_m (n, p1);
276 int32x4_t vb = vldrwq_z_s32 (b, p1);
277 int32x4_t vc = vaddq_x_s32 (va, vb, p2);
278 vstrwq_p_s32 (c, vc, p);
279 c += 4;
280 a += 4;
281 b += 4;
282 n -= 4;
283 }
284 }
285
286 /*
287 ** test9:
288 **...
289 ** dlstp.32 lr, r3
290 ** vldrw.32 q[0-9]+, \[r0\], #16
291 ** vmsr p0, (r[0-9]+) @ movhi
292 ** vpst
293 ** vctpt.32 r3
294 ** vmrs (r[0-9]+), p0 @ movhi
295 ** vmsr p0, \1 @ movhi
296 ** vpst
297 ** vldrwt.32 q[0-9]+, \[r1\], #16
298 ** vmsr p0, \2 @ movhi
299 ** vpst
300 ** vaddt.i32 (q[0-9]+), q[0-9]+, q[0-9]+
301 **...
302 ** vstrw.32 \3, \[r2\], #16
303 ** letp lr, .*
304 **...
305 */
306
307 /* Generating and using a different VPR value in the loop,
308 with a vctp_m that is tied to the base vctp VPR. This
309 is still fine, because the vctp_m will be transformed
310 into a vctp and be implicitly predicated. */
311 void test10 (int32_t *a, int32_t *b, int32_t *c, int n)
312 {
313 while (n > 0)
314 {
315 mve_pred16_t p = vctp32q (n);
316 int32x4_t va = vldrwq_z_s32 (a, p);
317 mve_pred16_t p1 = vctp32q_m (n, p);
318 int32x4_t vb = vldrwq_z_s32 (b, p1);
319 int32x4_t vc = vaddq_x_s32 (va, vb, p1);
320 vstrwq_p_s32 (c, vc, p);
321 c += 4;
322 a += 4;
323 b += 4;
324 n -= 4;
325 }
326 }
327 /*
328 We don't need that extra vctp in the loop, but we currently do not optimize
329 it away, however, it is not wrong to use it...
330 */
331 /*
332 ** test10:
333 **...
334 ** dlstp.32 lr, r3
335 ** vctp.32 r3
336 ** vldrw.32 q[0-9]+, \[r0\], #16
337 **...
338 ** vpst
339 ** vldrwt.32 q[0-9]+, \[r1\], #16
340 ** vpst
341 ** vaddt.i32 (q[0-9]+), q[0-9]+, q[0-9]+
342 ** vstrw.32 \1, \[r2\], #16
343 ** letp lr, .*
344 **...
345 */
346
347 /* Generating and using a different VPR value in the loop, with a vcmp. */
348 void test11 (int32_t *a, int32_t *b, int32_t *c, int n)
349 {
350 while (n > 0)
351 {
352 mve_pred16_t p = vctp32q (n);
353 int32x4_t va = vldrwq_z_s32 (a, p);
354 int32x4_t vb = vldrwq_z_s32 (b, p);
355 mve_pred16_t p1 = vcmpeqq_s32 (va, vb);
356 int32x4_t vc = vaddq_x_s32 (va, vb, p1);
357 vstrwq_p_s32 (c, vc, p);
358 c += 4;
359 a += 4;
360 b += 4;
361 n -= 4;
362 }
363 }
364
365 /*
366 ** test11:
367 **...
368 ** dlstp.32 lr, r3
369 ** vldrw.32 q[0-9]+, \[r0\], #16
370 ** vldrw.32 q[0-9]+, \[r1\], #16
371 ** vcmp.i32 eq, q[0-9]+, q[0-9]+
372 ** vpst
373 ** vaddt.i32 (q[0-9]+), q[0-9]+, q[0-9]+
374 ** vstrw.32 \1, \[r2\], #16
375 ** letp lr, .*
376 **...
377 */
378
379 /* Generating and using a different VPR value in the loop, with a vcmp_m. */
380 void test12 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
381 {
382 while (n > 0)
383 {
384 mve_pred16_t p = vctp32q (n);
385 int32x4_t va = vldrwq_z_s32 (a, p);
386 int32x4_t vb = vldrwq_z_s32 (b, p);
387 mve_pred16_t p2 = vcmpeqq_m_s32 (va, vb, p1);
388 int32x4_t vc = vaddq_x_s32 (va, vb, p2);
389 vstrwq_p_s32 (c, vc, p);
390 c += 4;
391 a += 4;
392 b += 4;
393 n -= 4;
394 }
395 }
396
397 /*
398 ** test12:
399 **...
400 ** dlstp.32 lr, r3
401 ** vldrw.32 q[0-9]+, \[r0\], #16
402 ** vldrw.32 q[0-9]+, \[r1\], #16
403 ** vmsr p0, (r[0-9]+|ip) @ movhi
404 ** vpst
405 ** vcmpt.i32 eq, q[0-9]+, q[0-9]+
406 ** vpst
407 ** vaddt.i32 (q[0-9]+), q[0-9]+, q[0-9]+
408 ** vstrw.32 \2, \[r2\], #16
409 ** letp lr, .*
410 **...
411 */
412
413 /* Generating and using a different VPR value in the loop, with a vcmp_m
414 that is tied to the base vctp VPR (same as above, this will be turned
415 into a vcmp and be implicitly predicated). */
416 void test13 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
417 {
418 while (n > 0)
419 {
420 mve_pred16_t p = vctp32q (n);
421 int32x4_t va = vldrwq_z_s32 (a, p);
422 int32x4_t vb = vldrwq_z_s32 (b, p);
423 mve_pred16_t p2 = vcmpeqq_m_s32 (va, vb, p);
424 int32x4_t vc = vaddq_x_s32 (va, vb, p2);
425 vstrwq_p_s32 (c, vc, p);
426 c += 4;
427 a += 4;
428 b += 4;
429 n -= 4;
430 }
431 }
432
433 /*
434 ** test13:
435 **...
436 ** dlstp.32 lr, r3
437 ** vldrw.32 q[0-9]+, \[r0\], #16
438 ** vldrw.32 q[0-9]+, \[r1\], #16
439 ** vcmp.i32 eq, q[0-9]+, q[0-9]+
440 ** vpst
441 ** vaddt.i32 (q[0-9]+), q[0-9]+, q[0-9]+
442 ** vstrw.32 \1, \[r2\], #16
443 ** letp lr, .*
444 **...
445 */
446
447 /* Similar to test27 in dsltp-invalid-asm.c, but use a predicated load to make
448 it safe to implicitly predicate the vaddv. */
449 void test14 (int32_t *a, int32_t *c, int n)
450 {
451 int32_t res = 0;
452 while (n > 0)
453 {
454 mve_pred16_t p = vctp32q (n);
455 int32x4_t va = vldrwq_z_s32 (a, p);
456 res += vaddvq_s32 (va);
457 int32x4_t vc = vdupq_n_s32 (res);
458 vstrwq_p_s32 (c, vc, p);
459 a += 4;
460 n -= 4;
461 }
462 }
463
464 /*
465 ** test14:
466 **...
467 ** dlstp.32 lr, r2
468 ** vldrw.32 (q[0-9]+), \[r0\], #16
469 ** vaddv.s32 (r[0-9]+|ip), \1
470 ** add (r[0-9]+|ip), \3, \2
471 ** vdup.32 (q[0-9]+), \3
472 ** vstrw.32 \4, \[r1\]
473 ** letp lr, .*
474 **...
475 */
476
477 uint8_t test15 (uint8_t *a, uint8_t *b, int n)
478 {
479 uint8_t res = 0;
480 uint8x16_t vc = vdupq_n_u8 (0);
481 while (n > 0)
482 {
483 mve_pred16_t p = vctp8q (n);
484 uint8x16_t va = vldrbq_z_u8 (a, p);
485 uint8x16_t vb = vldrbq_u8 (b);
486 vc = vaddq_m (vc, va, vc, p);
487 res = vgetq_lane (vc, 5);
488
489 a += 16;
490 b += 16;
491 n -= 16;
492 }
493 return res;
494 }
495
496 /*
497 ** test15:
498 **...
499 ** dlstp.8 lr, r2
500 **...
501 ** vldrb.8 q[0-9]+, \[(r[0-9]+|ip)\]
502 **...
503 ** vadd.i8 (q[0-9]+), q[0-9]+, q[0-9]+
504 **...
505 ** letp lr, .*
506 ** vmov.u8 r[0-9]+, \2\[5\]
507 **...
508 */
509
510 uint8_t test16 (uint8_t *a, uint8_t *b, int n)
511 {
512 uint8_t res = 0;
513 uint8x16_t vc = vdupq_n_u8 (0);
514 while (n > 0)
515 {
516 mve_pred16_t p = vctp8q (n);
517 uint8x16_t va = vldrbq_z_u8 (a, p);
518 uint8x16_t vb = vldrbq_u8 (b);
519 vc = vaddq (va, vc);
520 vc = vaddq_m (vc, va, vc, p);
521 res = vgetq_lane (vc, 5);
522
523 a += 16;
524 b += 16;
525 n -= 16;
526 }
527 return res;
528 }
529
530 /*
531 ** test16:
532 **...
533 ** dlstp.8 lr, r2
534 **...
535 ** vldrb.8 q[0-9]+, \[(r[0-9]+|ip)\]
536 **...
537 ** vadd.i8 (q[0-9]+), q[0-9]+, q[0-9]+
538 ** vadd.i8 \2, q[0-9]+, q[0-9]+
539 ** letp lr, .*
540 ** vmov.u8 r[0-9]+, \2\[5\]
541 **...
542 */
543
544
545
546 /* Using an across-vector unpredicated instruction in a valid way.
547 This tests that "vc" has correctly masked the risky "vb". */
548 uint16_t test18 (uint16_t *a, uint16_t *b, uint16_t *c, int n)
549 {
550 uint16x8_t vb = vldrhq_u16 (b);
551 uint16_t res = 0;
552 while (n > 0)
553 {
554 mve_pred16_t p = vctp16q (n);
555 uint16x8_t va = vldrhq_z_u16 (a, p);
556 uint16x8_t vc = vaddq_m_u16 (va, va, vb, p);
557 res += vaddvq_u16 (vc);
558 c += 8;
559 a += 8;
560 b += 8;
561 n -= 8;
562 }
563 return res;
564 }
565
566 /*
567 ** test18:
568 **...
569 ** dlstp.16 lr, r3
570 ** vldrh.16 (q[0-9]+), \[r2\], #16
571 ** vadd.i16 \1, q[0-9]+, q[0-9]+
572 ** vaddv.u16 (r[0-9]+|ip), \1
573 ** add (r[0-9]+|ip), \3, \2
574 ** uxth \3, \3
575 ** letp lr, .*
576 **...
577 */
578
579 /* Using an across-vector unpredicated instruction with implicit scalar adding from outside the loop. */
580 uint16_t test19 (uint16_t *a, uint16_t *b, uint16_t *c, int n)
581 {
582 uint16x8_t vb = vldrhq_u16 (b);
583 uint16_t res = 0;
584 while (n > 0)
585 {
586 mve_pred16_t p = vctp16q (n);
587 uint16x8_t va = vldrhq_z_u16 (a, p);
588 uint16x8_t vc = vaddq_m_u16 (va, va, vb, p);
589 res = vaddvaq_u16 (res, vc);
590 c += 8;
591 a += 8;
592 b += 8;
593 n -= 8;
594 }
595 return res;
596 }
597
598 /*
599 ** test19:
600 **...
601 ** dlstp.16 lr, r3
602 ** vldrh.16 (q[0-9]+), \[r2\], #16
603 ** vadd.i16 \1, q[0-9]+, q[0-9]+
604 ** vaddva.u16 (r[0-9]+|ip), \1
605 ** uxth \2, \2
606 ** letp lr, .*
607 **...
608 */
609
610
611 /* Using an across-vector predicated instruction in a valid way. */
612 uint16_t test20 (uint16_t *a, uint16_t *b, uint16_t *c, int n)
613 {
614 uint16_t res = 0;
615 while (n > 0)
616 {
617 mve_pred16_t p = vctp16q (n);
618 uint16x8_t va = vldrhq_u16 (a);
619 res = vaddvaq_p_u16 (res, va, p);
620 c += 8;
621 a += 8;
622 b += 8;
623 n -= 8;
624 }
625 return res;
626 }
627
628 /* The uxth could be moved outside the loop. */
629 /*
630 ** test20:
631 **...
632 ** dlstp.16 lr, r3
633 ** vldrh.16 (q[0-9]+), \[r2\], #16
634 ** vaddva.u16 (r[0-9]+|ip), \1
635 ** uxth \2, \2
636 ** letp lr, .*
637 **...
638 */
639
640 /* Using an across-vector predicated instruction in a valid way. */
641 uint16_t test21 (uint16_t *a, uint16_t *b, uint16_t *c, int n)
642 {
643 uint16_t res = 0;
644 while (n > 0)
645 {
646 mve_pred16_t p = vctp16q (n);
647 uint16x8_t va = vldrhq_u16 (a);
648 res++;
649 res = vaddvaq_p_u16 (res, va, p);
650 c += 8;
651 a += 8;
652 b += 8;
653 n -= 8;
654 }
655 return res;
656 }
657
658 /* Also think it'd be safe to move uxth outside of the loop here. */
659 /*
660 ** test21:
661 **...
662 ** dlstp.16 lr, r3
663 ** vldrh.16 (q[0-9]+), \[r2\], #16
664 ** adds (r[0-9]+|ip), \2, #1
665 ** uxth \2, \2
666 ** vaddva.u16 \2, \1
667 ** uxth \2, \2
668 ** letp lr, .*
669 **...
670 */
671
672 int test22 (uint8_t *a, uint8_t *b, uint8_t *c, int n)
673 {
674 int res = 0;
675 while (n > 0)
676 {
677 mve_pred16_t p = vctp8q (n);
678 uint8x16_t va = vldrbq_z_u8 (a, p);
679 res = vmaxvq (res, va);
680 n-=16;
681 a+=16;
682 }
683 return res;
684 }
685
686 /*
687 ** test22:
688 **...
689 ** dlstp.8 lr, r3
690 **...
691 ** vldrb.8 (q[0-9]+), \[r[0-9]+\]
692 **...
693 ** vmaxv.u8 (r[0-9]+|ip), \1
694 ** uxtb \2, \2
695 ** letp lr, .*
696 **...
697 */
698
699 int test23 (int8_t *a, int8_t *b, int8_t *c, int n)
700 {
701 int res = 0;
702 while (n > 0)
703 {
704 mve_pred16_t p = vctp8q (n);
705 int8x16_t va = vldrbq_z_s8 (a, p);
706 res = vmaxavq (res, va);
707 n-=16;
708 a+=16;
709 }
710 return res;
711 }
712
713 /*
714 ** test23:
715 **...
716 ** dlstp.8 lr, r3
717 **...
718 ** vldrb.8 (q[0-9]+), \[r3\]
719 **...
720 ** vmaxav.s8 (r[0-9]+|ip), \1
721 ** uxtb \2, \2
722 ** letp lr, .*
723 **...
724 */
725
726 /* Like test1, but update n before vctp, meaning we should only iterate for n-4
727 elements. */
728 void test24 (int32_t *a, int32_t *b, int32_t *c, int n)
729 {
730 while (n >= 1)
731 {
732 n-=4;
733 mve_pred16_t p = vctp32q (n);
734 int32x4_t va = vldrwq_z_s32 (a, p);
735 int32x4_t vb = vldrwq_z_s32 (b, p);
736 int32x4_t vc = vaddq_x_s32 (va, vb, p);
737 vstrwq_p_s32 (c, vc, p);
738 c+=4;
739 a+=4;
740 b+=4;
741 }
742 }
743 /*
744 ** test24:
745 **...
746 ** subs r3, r3, #4
747 **...
748 ** dlstp.32 lr, r3
749 ** vldrw.32 q[0-9]+, \[r0\], #16
750 ** vldrw.32 q[0-9]+, \[r1\], #16
751 ** vadd.i32 (q[0-9]+), q[0-9]+, q[0-9]+
752 ** vstrw.32 \1, \[r2\], #16
753 ** letp lr, .*
754 **...
755 */
756