1*d572bcb2SRichard Henderson #include <stdio.h>
2*d572bcb2SRichard Henderson #include <string.h>
3*d572bcb2SRichard Henderson
main()4*d572bcb2SRichard Henderson int main()
5*d572bcb2SRichard Henderson {
6*d572bcb2SRichard Henderson static const int cmp[4][4] = {
7*d572bcb2SRichard Henderson { 110, 134, 158, 182 },
8*d572bcb2SRichard Henderson { 390, 478, 566, 654 },
9*d572bcb2SRichard Henderson { 670, 822, 974, 1126 },
10*d572bcb2SRichard Henderson { 950, 1166, 1382, 1598 }
11*d572bcb2SRichard Henderson };
12*d572bcb2SRichard Henderson int dst[4][4];
13*d572bcb2SRichard Henderson int *tmp = &dst[0][0];
14*d572bcb2SRichard Henderson
15*d572bcb2SRichard Henderson asm volatile(
16*d572bcb2SRichard Henderson ".arch armv8-r+sme\n\t"
17*d572bcb2SRichard Henderson "smstart\n\t"
18*d572bcb2SRichard Henderson "index z0.b, #0, #1\n\t"
19*d572bcb2SRichard Henderson "movprfx z1, z0\n\t"
20*d572bcb2SRichard Henderson "add z1.b, z1.b, #16\n\t"
21*d572bcb2SRichard Henderson "ptrue p0.b\n\t"
22*d572bcb2SRichard Henderson "smopa za0.s, p0/m, p0/m, z0.b, z1.b\n\t"
23*d572bcb2SRichard Henderson "ptrue p0.s, vl4\n\t"
24*d572bcb2SRichard Henderson "mov w12, #0\n\t"
25*d572bcb2SRichard Henderson "st1w { za0h.s[w12, #0] }, p0, [%0]\n\t"
26*d572bcb2SRichard Henderson "add %0, %0, #16\n\t"
27*d572bcb2SRichard Henderson "st1w { za0h.s[w12, #1] }, p0, [%0]\n\t"
28*d572bcb2SRichard Henderson "add %0, %0, #16\n\t"
29*d572bcb2SRichard Henderson "st1w { za0h.s[w12, #2] }, p0, [%0]\n\t"
30*d572bcb2SRichard Henderson "add %0, %0, #16\n\t"
31*d572bcb2SRichard Henderson "st1w { za0h.s[w12, #3] }, p0, [%0]\n\t"
32*d572bcb2SRichard Henderson "smstop"
33*d572bcb2SRichard Henderson : "+r"(tmp) : : "memory");
34*d572bcb2SRichard Henderson
35*d572bcb2SRichard Henderson if (memcmp(cmp, dst, sizeof(dst)) == 0) {
36*d572bcb2SRichard Henderson return 0;
37*d572bcb2SRichard Henderson }
38*d572bcb2SRichard Henderson
39*d572bcb2SRichard Henderson /* See above for correct results. */
40*d572bcb2SRichard Henderson for (int i = 0; i < 4; ++i) {
41*d572bcb2SRichard Henderson for (int j = 0; j < 4; ++j) {
42*d572bcb2SRichard Henderson printf("%6d", dst[i][j]);
43*d572bcb2SRichard Henderson }
44*d572bcb2SRichard Henderson printf("\n");
45*d572bcb2SRichard Henderson }
46*d572bcb2SRichard Henderson return 1;
47*d572bcb2SRichard Henderson }
48