aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/mve/dlstp-compile-asm-2.c
blob: 84f4a2fc4f9bc7a90ba2d030f572c1dcacf4e5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749

/* { dg-do compile { target { arm*-*-* } } } */
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-options "-O3 -save-temps -fno-schedule-insns2 " } */
/* { dg-add-options arm_v8_1m_mve } */
/* { dg-additional-options "-mtune=cortex-m55" } */
/* { dg-final { check-function-bodies "**" "" "" } } */

#include <arm_mve.h>
/* Using a >=1 condition.  */
void test1 (int32_t *a, int32_t *b, int32_t *c, int n)
{
  while (n >= 1)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      int32x4_t vb = vldrwq_z_s32 (b, p);
      int32x4_t vc = vaddq_x_s32 (va, vb, p);
      vstrwq_p_s32 (c, vc, p);
      c+=4;
      a+=4;
      b+=4;
      n-=4;
    }
}
/*
** test1:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vldrw.32	q[0-9]+, \[r1\], #16
**	vadd.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Test a for loop format of decrementing to zero */
int32_t a[] = {0, 1, 2, 3, 4, 5, 6, 7};
void test2 (int32_t *b, int num_elems)
{
    for (int i = num_elems; i > 0; i-= 4)
    {
        mve_pred16_t p = vctp32q (i);
        int32x4_t va = vldrwq_z_s32 (&(a[i]), p);
        vstrwq_p_s32 (b + i, va, p);
    }
}
/*
** test2:
**...
**	dlstp.32	lr, r1
**...
**	vldrw.32	(q[0-9]+), \[r3\], #-16
**	vstrw.32	\1, \[r0\], #-16
**	letp	lr, .*
**...
*/

/* Iteration counter counting up to num_iter.  */
void test3 (uint8_t *a, uint8_t *b, uint8_t *c, unsigned n)
{
    int num_iter = (n + 15)/16;
    for (int i = 0; i < num_iter; i++)
    {
	mve_pred16_t p = vctp8q (n);
	uint8x16_t va = vldrbq_z_u8 (a, p);
	uint8x16_t vb = vldrbq_z_u8 (b, p);
	uint8x16_t vc = vaddq_x_u8 (va, vb, p);
	vstrbq_p_u8 (c, vc, p);
	n-=16;
	a += 16;
	b += 16;
	c += 16;
    }
}

/*
** test3:
**...
**	dlstp.8	lr, r3
**...
**	vldrb.8	q[0-9]+, \[(r[0-9]+|ip)\]
**	vldrb.8	q[0-9]+, \[(r[0-9]+|ip)\]
**...
**	vadd.i8	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrb.8	\3, \[(r[0-9]+|ip)\]
**...
**	letp	lr, .*
**...
*/

/* Iteration counter counting down from num_iter.  */
void test4 (uint8_t *a, uint8_t *b, uint8_t *c, int n)
{
    int num_iter = (n + 15)/16;
    for (int i = num_iter; i > 0; i--)
    {
	mve_pred16_t p = vctp8q (n);
	uint8x16_t va = vldrbq_z_u8 (a, p);
	uint8x16_t vb = vldrbq_z_u8 (b, p);
	uint8x16_t vc = vaddq_x_u8 (va, vb, p);
	vstrbq_p_u8 (c, vc, p);
	n-=16;
	a += 16;
	b += 16;
	c += 16;
    }
}
/*
** test4:
**...
**	dlstp.8	lr, r3
**...
**	vldrb.8	q[0-9]+, \[(r[0-9]+|ip)\]
**	vldrb.8	q[0-9]+, \[(r[0-9]+|ip)\]
**...
**	vadd.i8	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrb.8	\3, \[(r[0-9]+|ip)\]
**...
**	letp	lr, .*
**...
*/

/* Using an unpredicated arithmetic instruction within the loop.  */
void test5 (uint8_t *a, uint8_t *b, uint8_t *c,  uint8_t *d, int n)
{
    while (n > 0)
    {
        mve_pred16_t p = vctp8q (n);
        uint8x16_t va = vldrbq_z_u8 (a, p);
        uint8x16_t vb = vldrbq_u8 (b);
	/* Is affected by implicit predication, because vb also
	came from an unpredicated load, but there is no functional
	problem, because the result is used in a predicated store.  */
        uint8x16_t vc = vaddq_u8 (va, vb);
        uint8x16_t vd = vaddq_x_u8 (va, vb, p);
        vstrbq_p_u8 (c, vc, p);
        vstrbq_p_u8 (d, vd, p);
        n-=16;
	a += 16;
	b += 16;
	c += 16;
    }
}

/*
** test5:
**...
**	dlstp.8	lr, r[0-9]+
**...
**	vldrb.8	q[0-9]+, \[r1\]
**	vldrb.8	q[0-9]+, \[r2\]
**...
**	vadd.i8	(q[0-9]+), q[0-9]+, q[0-9]+
**...
**	vstrb.8	\1, \[r2\]
**	vstrb.8	\1, \[r3\]
**	letp	lr, .*
**...
*/

/* Using a different VPR value for one instruction in the loop.  */
void test6 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      int32x4_t vb = vldrwq_z_s32 (b, p1);
      int32x4_t vc = vaddq_x_s32 (va, vb, p);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}

/*
** test6:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vpst
**	vldrwt.32	q[0-9]+, \[r1\], #16
**	vadd.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using another VPR value in the loop, with a vctp.
   The doloop logic will always try to do the transform on the first
   vctp it encounters, so this is still expected to work.  */
void test7 (int32_t *a, int32_t *b, int32_t *c, int n, int g)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      mve_pred16_t p1 = vctp32q (g);
      int32x4_t vb = vldrwq_z_s32 (b, p1);
      int32x4_t vc = vaddq_x_s32 (va, vb, p);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}
/*
** test7:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vpst
**	vldrwt.32	q[0-9]+, \[r1\], #16
**	vadd.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using a different VPR value in the loop, with a vctp,
   but this time the p1 will also change in every loop (still fine)  */
void test8 (int32_t *a, int32_t *b, int32_t *c, int n, int g)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      mve_pred16_t p1 = vctp32q (g);
      int32x4_t vb = vldrwq_z_s32 (b, p1);
      int32x4_t vc = vaddq_x_s32 (va, vb, p);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
      g++;
    }
}

/*
** test8:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vctp.32	r4
**	vpst
**	vldrwt.32	q[0-9]+, \[r1\], #16
**...
**	vadd.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using a different VPR value in the loop, with a vctp_m
   that is independent of the loop vctp VPR.  */
void test9 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      mve_pred16_t p2 = vctp32q_m (n, p1);
      int32x4_t vb = vldrwq_z_s32 (b, p1);
      int32x4_t vc = vaddq_x_s32 (va, vb, p2);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}

/*
** test9:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vmsr	p0, (r[0-9]+)	@ movhi
**	vpst
**	vctpt.32	r3
**	vmrs	(r[0-9]+), p0	@ movhi
**	vmsr	p0, \1	@ movhi
**	vpst
**	vldrwt.32	q[0-9]+, \[r1\], #16
**	vmsr	p0, \2	@ movhi
**	vpst
**	vaddt.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**...
**	vstrw.32	\3, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using a different VPR value in the loop,
   with a vctp_m that is tied to the base vctp VPR.  This
   is still fine, because the vctp_m will be transformed
   into a vctp and be implicitly predicated.  */
void test10 (int32_t *a, int32_t *b, int32_t *c, int n)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      mve_pred16_t p1 = vctp32q_m (n, p);
      int32x4_t vb = vldrwq_z_s32 (b, p1);
      int32x4_t vc = vaddq_x_s32 (va, vb, p1);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}
/*
   We don't need that extra vctp in the loop, but we currently do not optimize
   it away, however, it is not wrong to use it...
*/
/*
** test10:
**...
**	dlstp.32	lr, r3
**	vctp.32	r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**...
**	vpst
**	vldrwt.32	q[0-9]+, \[r1\], #16
**	vpst
**	vaddt.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using a different VPR value in the loop, with a vcmp.  */
void test11 (int32_t *a, int32_t *b, int32_t *c, int n)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      int32x4_t vb = vldrwq_z_s32 (b, p);
      mve_pred16_t p1 = vcmpeqq_s32 (va, vb);
      int32x4_t vc = vaddq_x_s32 (va, vb, p1);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}

/*
** test11:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vldrw.32	q[0-9]+, \[r1\], #16
**	vcmp.i32	eq, q[0-9]+, q[0-9]+
**	vpst
**	vaddt.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using a different VPR value in the loop, with a vcmp_m.  */
void test12 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      int32x4_t vb = vldrwq_z_s32 (b, p);
      mve_pred16_t p2 = vcmpeqq_m_s32 (va, vb, p1);
      int32x4_t vc = vaddq_x_s32 (va, vb, p2);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}

/*
** test12:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vldrw.32	q[0-9]+, \[r1\], #16
**	vmsr	p0, (r[0-9]+|ip)	@ movhi
**	vpst
**	vcmpt.i32	eq, q[0-9]+, q[0-9]+
**	vpst
**	vaddt.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\2, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Generating and using a different VPR value in the loop, with a vcmp_m
   that is tied to the base vctp VPR (same as above, this will be turned
   into a vcmp and be implicitly predicated).  */
void test13 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p1)
{
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      int32x4_t vb = vldrwq_z_s32 (b, p);
      mve_pred16_t p2 = vcmpeqq_m_s32 (va, vb, p);
      int32x4_t vc = vaddq_x_s32 (va, vb, p2);
      vstrwq_p_s32 (c, vc, p);
      c += 4;
      a += 4;
      b += 4;
      n -= 4;
    }
}

/*
** test13:
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vldrw.32	q[0-9]+, \[r1\], #16
**	vcmp.i32	eq, q[0-9]+, q[0-9]+
**	vpst
**	vaddt.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/

/* Similar to test27 in dsltp-invalid-asm.c, but use a predicated load to make
   it safe to implicitly predicate the vaddv.  */
void test14 (int32_t *a, int32_t *c, int n)
{
  int32_t res = 0;
  while (n > 0)
    {
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      res += vaddvq_s32 (va);
      int32x4_t vc = vdupq_n_s32 (res);
      vstrwq_p_s32 (c, vc, p);
      a += 4;
      n -= 4;
    }
}

/*
** test14:
**...
**	dlstp.32	lr, r2
**	vldrw.32	(q[0-9]+), \[r0\], #16
**	vaddv.s32	(r[0-9]+|ip), \1
**	add	(r[0-9]+|ip), \3, \2
**	vdup.32	(q[0-9]+), \3
**	vstrw.32	\4, \[r1\]
**	letp	lr, .*
**...
*/

uint8_t test15 (uint8_t *a, uint8_t *b, int n)
{
    uint8_t res = 0;
    uint8x16_t vc = vdupq_n_u8 (0);
    while (n > 0)
    {
       mve_pred16_t p = vctp8q (n);
       uint8x16_t va = vldrbq_z_u8 (a, p);
       uint8x16_t vb = vldrbq_u8 (b);
       vc = vaddq_m (vc, va, vc, p);
       res = vgetq_lane (vc, 5);

       a += 16;
       b += 16;
       n -= 16;
    }
    return res;
}

/*
** test15:
**...
**	dlstp.8	lr, r2
**...
**	vldrb.8	q[0-9]+, \[(r[0-9]+|ip)\]
**...
**	vadd.i8	(q[0-9]+), q[0-9]+, q[0-9]+
**...
**	letp	lr, .*
**	vmov.u8	r[0-9]+, \2\[5\]
**...
*/

uint8_t test16 (uint8_t *a, uint8_t *b, int n)
{
    uint8_t res = 0;
    uint8x16_t vc = vdupq_n_u8 (0);
    while (n > 0)
    {
       mve_pred16_t p = vctp8q (n);
       uint8x16_t va = vldrbq_z_u8 (a, p);
       uint8x16_t vb = vldrbq_u8 (b);
       vc = vaddq (va, vc);
       vc = vaddq_m (vc, va, vc, p);
       res = vgetq_lane (vc, 5);

       a += 16;
       b += 16;
       n -= 16;
    }
    return res;
}

/*
** test16:
**...
**	dlstp.8	lr, r2
**...
**	vldrb.8	q[0-9]+, \[(r[0-9]+|ip)\]
**...
**	vadd.i8	(q[0-9]+), q[0-9]+, q[0-9]+
**	vadd.i8	\2, q[0-9]+, q[0-9]+
**	letp	lr, .*
**	vmov.u8	r[0-9]+, \2\[5\]
**...
*/



/* Using an across-vector unpredicated instruction in a valid way.
   This tests that "vc" has correctly masked the risky "vb".  */
uint16_t test18 (uint16_t *a, uint16_t *b,  uint16_t *c, int n)
{
  uint16x8_t vb = vldrhq_u16 (b);
  uint16_t res = 0;
  while (n > 0)
    {
      mve_pred16_t p = vctp16q (n);
      uint16x8_t va = vldrhq_z_u16 (a, p);
      uint16x8_t vc = vaddq_m_u16 (va, va, vb, p);
      res += vaddvq_u16 (vc);
      c += 8;
      a += 8;
      b += 8;
      n -= 8;
    }
  return res;
}

/*
** test18:
**...
**	dlstp.16	lr, r3
**	vldrh.16	(q[0-9]+), \[r2\], #16
**	vadd.i16	\1, q[0-9]+, q[0-9]+
**	vaddv.u16	(r[0-9]+|ip), \1
**	add	(r[0-9]+|ip), \3, \2
**	uxth	\3, \3
**	letp	lr, .*
**...
*/

/* Using an across-vector unpredicated instruction with implicit scalar adding from outside the loop.  */
uint16_t test19 (uint16_t *a, uint16_t *b,  uint16_t *c, int n)
{
  uint16x8_t vb = vldrhq_u16 (b);
  uint16_t res = 0;
  while (n > 0)
    {
      mve_pred16_t p = vctp16q (n);
      uint16x8_t va = vldrhq_z_u16 (a, p);
      uint16x8_t vc = vaddq_m_u16 (va, va, vb, p);
      res = vaddvaq_u16 (res, vc);
      c += 8;
      a += 8;
      b += 8;
      n -= 8;
    }
  return res;
}

/*
** test19:
**...
**	dlstp.16	lr, r3
**	vldrh.16	(q[0-9]+), \[r2\], #16
**	vadd.i16	\1, q[0-9]+, q[0-9]+
**	vaddva.u16	(r[0-9]+|ip), \1
**	uxth	\2, \2
**	letp	lr, .*
**...
*/


/* Using an across-vector predicated instruction in a valid way.  */
uint16_t  test20 (uint16_t *a, uint16_t *b,  uint16_t *c, int n)
{
  uint16_t res = 0;
  while (n > 0)
    {
      mve_pred16_t p = vctp16q (n);
      uint16x8_t va = vldrhq_u16 (a);
      res = vaddvaq_p_u16 (res, va, p);
      c += 8;
      a += 8;
      b += 8;
      n -= 8;
    }
  return res;
}

/* The uxth could be moved outside the loop.  */
/*
** test20:
**...
**	dlstp.16	lr, r3
**	vldrh.16	(q[0-9]+), \[r2\], #16
**	vaddva.u16	(r[0-9]+|ip), \1
**	uxth	\2, \2
**	letp	lr, .*
**...
*/

/* Using an across-vector predicated instruction in a valid way.  */
uint16_t  test21 (uint16_t *a, uint16_t *b,  uint16_t *c, int n)
{
  uint16_t res = 0;
  while (n > 0)
    {
      mve_pred16_t p = vctp16q (n);
      uint16x8_t va = vldrhq_u16 (a);
      res++;
      res = vaddvaq_p_u16 (res, va, p);
      c += 8;
      a += 8;
      b += 8;
      n -= 8;
    }
  return res;
}

/* Also think it'd be safe to move uxth outside of the loop here.  */
/*
** test21:
**...
**	dlstp.16	lr, r3
**	vldrh.16	(q[0-9]+), \[r2\], #16
**	adds	(r[0-9]+|ip), \2, #1
**	uxth	\2, \2
**	vaddva.u16	\2, \1
**	uxth	\2, \2
**	letp	lr, .*
**...
*/

int test22 (uint8_t *a, uint8_t *b, uint8_t *c, int n)
{
    int res = 0;
    while (n > 0)
    {
        mve_pred16_t p = vctp8q (n);
        uint8x16_t va = vldrbq_z_u8 (a, p);
        res = vmaxvq (res, va);
        n-=16;
        a+=16;
    }
    return res;
}

/*
** test22:
**...
**	dlstp.8	lr, r3
**...
**	vldrb.8	(q[0-9]+), \[r[0-9]+\]
**...
**	vmaxv.u8	(r[0-9]+|ip), \1
**	uxtb	\2, \2
**	letp	lr, .*
**...
*/

int test23 (int8_t *a, int8_t *b, int8_t *c, int n)
{
    int res = 0;
    while (n > 0)
    {
        mve_pred16_t p = vctp8q (n);
        int8x16_t va = vldrbq_z_s8 (a, p);
        res = vmaxavq (res, va);
        n-=16;
        a+=16;
    }
    return res;
}

/*
** test23:
**...
**	dlstp.8	lr, r3
**...
**	vldrb.8	(q[0-9]+), \[r3\]
**...
**	vmaxav.s8	(r[0-9]+|ip), \1
**	uxtb	\2, \2
**	letp	lr, .*
**...
*/

/* Like test1, but update n before vctp, meaning we should only iterate for n-4
   elements.  */
void test24 (int32_t *a, int32_t *b, int32_t *c, int n)
{
  while (n >= 1)
    {
      n-=4;
      mve_pred16_t p = vctp32q (n);
      int32x4_t va = vldrwq_z_s32 (a, p);
      int32x4_t vb = vldrwq_z_s32 (b, p);
      int32x4_t vc = vaddq_x_s32 (va, vb, p);
      vstrwq_p_s32 (c, vc, p);
      c+=4;
      a+=4;
      b+=4;
    }
}
/*
** test24:
**...
**	subs	r3, r3, #4
**...
**	dlstp.32	lr, r3
**	vldrw.32	q[0-9]+, \[r0\], #16
**	vldrw.32	q[0-9]+, \[r1\], #16
**	vadd.i32	(q[0-9]+), q[0-9]+, q[0-9]+
**	vstrw.32	\1, \[r2\], #16
**	letp	lr, .*
**...
*/