• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 #ifdef __ARM_FEATURE_SVE
25 #ifdef ARM_COMPUTE_ENABLE_SME2
26 
27 #include "arm_gemm.hpp"
28 #include "../../utils.hpp"
29 
30 #include <cassert>
31 #include <cstdint>
32 
33 namespace arm_gemm {
34 
sme2_gemv_s8qa_dot_16VL(const int8_t * A_ptr,const int8_t * B_ptr,int8_t * output_ptr,size_t N,size_t K,const Requantize32 * qp,const int32_t * col_bias,unsigned int col_base)35 void sme2_gemv_s8qa_dot_16VL (
36     const int8_t *A_ptr, const int8_t *B_ptr, int8_t *output_ptr,
37     size_t N, size_t K,
38     const Requantize32 *qp, const int32_t *col_bias, unsigned int col_base
39 )
40 {
41     ARM_COMPUTE_UNUSED(col_base);
42 
43     struct KernelArgs {
44         const int8_t *B_ptr = {};
45         size_t output_offset = {};
46         unsigned int input_initial_col = {};
47     } ka;
48 
49     unsigned long flags=0;
50     ka.B_ptr = B_ptr;
51     if (qp->c_offset > qp->minval) {
52         flags |= 0x20;
53     }
54     __asm__ __volatile__(
55       "ptrue p2.b\n"
56       ".inst 0xd503477f  // SMSTART ZA\n"
57       "cntw x27, ALL, MUL #4\n"
58       "add x26, %x[N], x27\n"
59       "sub x26, x26, #0x1\n"
60       "udiv x26, x26, x27\n"
61       "add x21, x26, #0x3\n"
62       "and x21, x21, #0xfffffffffffffffc\n"
63       "mul x21, x21, x27\n"
64       "mov x9, #0x0\n"
65       "mov x25, %x[B_ptr]\n"
66       "mov x24, %x[output_ptr]\n"
67       "ptrue p2.b\n"
68       ".inst 0x25207810  // ptrue pn8.b\n"
69       "mul x21, x21, %x[K]\n"
70       "mov x20, #0x1\n"
71       "1:"  // RHS size check loop
72       "cmp x21, #0x200000\n"
73       "blt 2f\n"
74       "tbnz x21, #0, 3f\n"
75       "lsr x21, x21, #0x1\n"
76       "lsl x20, x20, #0x1\n"
77       "b 1b\n"
78       "2:"  // RHS do prefetch
79       "lsl x19, x21, #0x26\n"
80       "sub x20, x20, #0x1\n"
81       "lsl x20, x20, #0x16\n"
82       "orr x21, x21, x19\n"
83       "orr x21, x21, x20\n"
84       ".inst 0xf8b54b3a  // rprfm pldonce, x21, [x25]\n"
85       "3:"  // RHS prefetch exit
86       "mov x23, %x[col_bias]\n"
87       "mov z26.s, #0x0\n"
88       "mov z24.b, #0x1\n"
89       "bic %x[flags], %x[flags], #0x80000000\n"
90       "4:"  // Column loop
91       "cmp x26, #0x4\n"
92       "bge 34f\n"
93       "cmp x26, #0x2\n"
94       "bgt 24f\n"
95       "beq 14f\n"
96       "mov x22, %x[A_ptr]\n"
97       "mov x21, %x[K]\n"
98       "mov x19, %x[N]\n"
99       "mov x20, %x[K]\n"
100       ".inst 0xf8b54ad8  // rprfm pldmany, x21, [x22]\n"
101       "whilelt p1.b, XZR, x19\n"
102       "cbz x23, 5f\n"
103       ".inst 0xa040c2e4  // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n"
104       ".inst 0xc0042c80  // mova za.d[x9, #0], { z4.d-z7.d }\n"
105       "b 6f\n"
106       "5:"  // Width 1: no bias
107       ".inst 0xc00800ff  // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n"
108       "6:"  // Width 1: setup done
109       "cmp x20, #0x10\n"
110       "ble 9f\n"
111       "7:"  // Width 1: Multiply loop: Main loop head
112       "whilelt p0.b, XZR, x20\n"
113       "ld1rqb { z3.b }, p0/Z, [x22]\n"
114       "add x22, x22, #0x10\n"
115       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
116       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
117       "addvl x25, x25, #16\n"
118       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
119       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
120       "addvl x25, x25, #16\n"
121       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
122       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
123       "addvl x25, x25, #16\n"
124       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
125       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
126       "addvl x25, x25, #16\n"
127       "tbnz %x[flags], #31, 8f\n"
128       "sdot z26.s, z3.b, z24.b\n"
129       "8:"  // Width 1: Multiply loop: unique 1: skip row sum
130       "sub x20, x20, #0x10\n"
131       "cmp x20, #0x10\n"
132       "bgt 7b\n"
133       "9:"  // Width 1: Multiply loop: Single iteration only
134       "whilelt p0.b, XZR, x20\n"
135       "ld1rqb { z3.b }, p0/Z, [x22]\n"
136       "subs x20, x20, #0x4\n"
137       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
138       "add x22, x22, #0x10\n"
139       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
140       "addvl x25, x25, #16\n"
141       "ble 10f\n"
142       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
143       "subs x20, x20, #0x4\n"
144       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
145       "addvl x25, x25, #16\n"
146       "ble 10f\n"
147       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
148       "subs x20, x20, #0x4\n"
149       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
150       "addvl x25, x25, #16\n"
151       "ble 10f\n"
152       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
153       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
154       "addvl x25, x25, #16\n"
155       "10:"  // Width 1: Multiply loop: multiply skip
156       "tbnz %x[flags], #31, 11f\n"
157       "sdot z26.s, z3.b, z24.b\n"
158       "11:"  // Width 1: Multiply loop: unique 2: skip row sum
159       "tbnz %x[flags], #31, 12f\n"
160       "add x20, %x[qp], %[b_offset]\n"
161       "mov x19, #0x4\n"
162       "ld1rw { z10.s }, p2/Z, [x20]\n"
163       "neg z10.s, p2/M, z10.s\n"
164       "whilelt p0.s, XZR, x19\n"
165       "saddv d26, p0, z26.s\n"
166       "mov z26.s, z26.s[0]\n"
167       "mul z26.s, p2/M, z26.s, z10.s\n"
168       "orr %x[flags], %x[flags], #0x80000000\n"
169       "12:"  // Width 1: skip row sum fixup
170       ".inst 0xc0904b40  // addha za0.s, p2/M, p2/M, z26.s\n"
171       "add x19, %x[qp], %[per_layer_mul]\n"
172       "ld1rw { z5.s }, p2/Z, [x19]\n"
173       "add x19, %x[qp], %[per_layer_right_shift]\n"
174       ".inst 0xc0904b41  // addha za1.s, p2/M, p2/M, z26.s\n"
175       "ld1rw { z4.s }, p2/Z, [x19]\n"
176       "add x19, %x[qp], %[c_offset]\n"
177       "add x20, %x[qp], %[minval]\n"
178       ".inst 0xc0904b42  // addha za2.s, p2/M, p2/M, z26.s\n"
179       "ld1rw { z6.s }, p2/Z, [x19]\n"
180       "add x19, %x[qp], %[maxval]\n"
181       ".inst 0xc0904b43  // addha za3.s, p2/M, p2/M, z26.s\n"
182       "ld1rw { z21.s }, p2/Z, [x20]\n"
183       ".inst 0xc0062c1c  // mova { z28.d-z31.d }, za.d[x9, #0]\n"
184       ".inst 0xc1a5ac1c  // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n"
185       ".inst 0xc1a4aa3c  // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n"
186       "ld1rw { z16.s }, p2/Z, [x19]\n"
187       ".inst 0xc1a6ab1c  // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n"
188       ".inst 0xc1b0cebc  // sclamp { z28.s-z31.s }, z21.s, z16.s\n"
189       "uzp1 z28.h, z28.h, z29.h\n"
190       "uzp1 z29.h, z30.h, z31.h\n"
191       "uzp1 z28.b, z28.b, z29.b\n"
192       "st1b { z28.b }, p1, [x24]\n"
193       "addvl x24, x24, #1\n"
194       "13:"  // Width 1: Output done
195       "b 44f\n"
196       "14:"  // Width 2
197       "mov x22, %x[A_ptr]\n"
198       "mov x21, %x[K]\n"
199       "sub x19, %x[N], x27\n"
200       "mov x20, %x[K]\n"
201       ".inst 0xf8b54ad8  // rprfm pldmany, x21, [x22]\n"
202       "whilelt p1.b, XZR, x19\n"
203       "cbz x23, 15f\n"
204       ".inst 0xa040c2e4  // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n"
205       ".inst 0xc0042c80  // mova za.d[x9, #0], { z4.d-z7.d }\n"
206       ".inst 0xa041c2f4  // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x4, MUL VL]\n"
207       ".inst 0xc0042e81  // mova za.d[x9, #1], { z20.d-z23.d }\n"
208       "b 16f\n"
209       "15:"  // Width 2: no bias
210       ".inst 0xc00800ff  // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n"
211       "16:"  // Width 2: setup done
212       "cmp x20, #0x10\n"
213       "ble 19f\n"
214       "17:"  // Width 2: Multiply loop: Main loop head
215       "whilelt p0.b, XZR, x20\n"
216       "ld1rqb { z3.b }, p0/Z, [x22]\n"
217       "add x22, x22, #0x10\n"
218       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
219       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
220       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
221       ".inst 0xc153b0a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n"
222       "addvl x25, x25, #16\n"
223       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
224       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
225       ".inst 0xa0418329  // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
226       ".inst 0xc153b521  // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n"
227       "addvl x25, x25, #16\n"
228       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
229       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
230       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
231       ".inst 0xc153b8a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n"
232       "addvl x25, x25, #16\n"
233       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
234       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
235       ".inst 0xa0418335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
236       ".inst 0xc153bea1  // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n"
237       "addvl x25, x25, #16\n"
238       "tbnz %x[flags], #31, 18f\n"
239       "sdot z26.s, z3.b, z24.b\n"
240       "18:"  // Width 2: Multiply loop: unique 3: skip row sum
241       "sub x20, x20, #0x10\n"
242       "cmp x20, #0x10\n"
243       "bgt 17b\n"
244       "19:"  // Width 2: Multiply loop: Single iteration only
245       "whilelt p0.b, XZR, x20\n"
246       "ld1rqb { z3.b }, p0/Z, [x22]\n"
247       "subs x20, x20, #0x4\n"
248       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
249       "add x22, x22, #0x10\n"
250       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
251       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
252       ".inst 0xc153b0a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n"
253       "addvl x25, x25, #16\n"
254       "ble 20f\n"
255       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
256       "subs x20, x20, #0x4\n"
257       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
258       ".inst 0xa0418329  // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
259       ".inst 0xc153b521  // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n"
260       "addvl x25, x25, #16\n"
261       "ble 20f\n"
262       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
263       "subs x20, x20, #0x4\n"
264       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
265       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
266       ".inst 0xc153b8a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n"
267       "addvl x25, x25, #16\n"
268       "ble 20f\n"
269       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
270       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
271       ".inst 0xa0418335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
272       ".inst 0xc153bea1  // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n"
273       "addvl x25, x25, #16\n"
274       "20:"  // Width 2: Multiply loop: multiply skip
275       "tbnz %x[flags], #31, 21f\n"
276       "sdot z26.s, z3.b, z24.b\n"
277       "21:"  // Width 2: Multiply loop: unique 4: skip row sum
278       "tbnz %x[flags], #31, 22f\n"
279       "add x20, %x[qp], %[b_offset]\n"
280       "mov x19, #0x4\n"
281       "ld1rw { z10.s }, p2/Z, [x20]\n"
282       "neg z10.s, p2/M, z10.s\n"
283       "whilelt p0.s, XZR, x19\n"
284       "saddv d26, p0, z26.s\n"
285       "mov z26.s, z26.s[0]\n"
286       "mul z26.s, p2/M, z26.s, z10.s\n"
287       "orr %x[flags], %x[flags], #0x80000000\n"
288       "22:"  // Width 2: skip row sum fixup
289       ".inst 0xc0904b40  // addha za0.s, p2/M, p2/M, z26.s\n"
290       "add x19, %x[qp], %[per_layer_mul]\n"
291       "ld1rw { z5.s }, p2/Z, [x19]\n"
292       "add x19, %x[qp], %[per_layer_right_shift]\n"
293       ".inst 0xc0904b41  // addha za1.s, p2/M, p2/M, z26.s\n"
294       "ld1rw { z4.s }, p2/Z, [x19]\n"
295       "add x19, %x[qp], %[c_offset]\n"
296       "add x20, %x[qp], %[minval]\n"
297       ".inst 0xc0904b42  // addha za2.s, p2/M, p2/M, z26.s\n"
298       "ld1rw { z6.s }, p2/Z, [x19]\n"
299       "add x19, %x[qp], %[maxval]\n"
300       ".inst 0xc0904b43  // addha za3.s, p2/M, p2/M, z26.s\n"
301       "ld1rw { z21.s }, p2/Z, [x20]\n"
302       ".inst 0xc0062c1c  // mova { z28.d-z31.d }, za.d[x9, #0]\n"
303       ".inst 0xc1a5ac1c  // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n"
304       ".inst 0xc0062c2c  // mova { z12.d-z15.d }, za.d[x9, #1]\n"
305       ".inst 0xc1a5ac0c  // sqdmulh { z12.s-z15.s }, { z12.s-z15.s }, z5.s\n"
306       ".inst 0xc1a4aa3c  // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n"
307       "ld1rw { z16.s }, p2/Z, [x19]\n"
308       ".inst 0xc1a4aa2c  // srshl { z12.s-z15.s }, { z12.s-z15.s }, z4.s\n"
309       ".inst 0xc1a6ab1c  // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n"
310       ".inst 0xc1a6ab0c  // add { z12.s-z15.s }, { z12.s-z15.s }, z6.s\n"
311       ".inst 0xc1b0cebc  // sclamp { z28.s-z31.s }, z21.s, z16.s\n"
312       ".inst 0xc1b0ceac  // sclamp { z12.s-z15.s }, z21.s, z16.s\n"
313       "uzp1 z28.h, z28.h, z29.h\n"
314       "uzp1 z29.h, z30.h, z31.h\n"
315       "uzp1 z12.h, z12.h, z13.h\n"
316       "uzp1 z13.h, z14.h, z15.h\n"
317       "uzp1 z28.b, z28.b, z29.b\n"
318       "st1b { z28.b }, p2, [x24]\n"
319       "uzp1 z12.b, z12.b, z13.b\n"
320       "st1b { z12.b }, p1, [x24, #1, MUL VL]\n"
321       "addvl x24, x24, #2\n"
322       "23:"  // Width 2: Output done
323       "b 44f\n"
324       "24:"  // Width 3
325       "mov x19, #0x2\n"
326       "mov x22, %x[A_ptr]\n"
327       "mov x21, %x[K]\n"
328       "msub x19, x27, x19, %x[N]\n"
329       "mov x20, %x[K]\n"
330       ".inst 0xf8b54ad8  // rprfm pldmany, x21, [x22]\n"
331       "whilelt p1.b, XZR, x19\n"
332       "cbz x23, 25f\n"
333       ".inst 0xa040c2e4  // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n"
334       ".inst 0xc0042c80  // mova za.d[x9, #0], { z4.d-z7.d }\n"
335       ".inst 0xa041c2f4  // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x4, MUL VL]\n"
336       ".inst 0xc0042e81  // mova za.d[x9, #1], { z20.d-z23.d }\n"
337       ".inst 0xa042c2f4  // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x8, MUL VL]\n"
338       ".inst 0xc0042e82  // mova za.d[x9, #2], { z20.d-z23.d }\n"
339       "b 26f\n"
340       "25:"  // Width 3: no bias
341       ".inst 0xc00800ff  // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n"
342       "26:"  // Width 3: setup done
343       "cmp x20, #0x10\n"
344       "ble 29f\n"
345       "27:"  // Width 3: Multiply loop: Main loop head
346       "whilelt p0.b, XZR, x20\n"
347       "ld1rqb { z3.b }, p0/Z, [x22]\n"
348       "add x22, x22, #0x10\n"
349       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
350       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
351       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
352       ".inst 0xc153b0a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n"
353       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
354       ".inst 0xc153b1a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n"
355       "addvl x25, x25, #16\n"
356       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
357       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
358       ".inst 0xa0418329  // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
359       ".inst 0xc153b521  // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n"
360       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
361       ".inst 0xc153b622  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n"
362       "addvl x25, x25, #16\n"
363       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
364       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
365       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
366       ".inst 0xc153b8a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n"
367       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
368       ".inst 0xc153b9a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n"
369       "addvl x25, x25, #16\n"
370       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
371       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
372       ".inst 0xa0418335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
373       ".inst 0xc153bea1  // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n"
374       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
375       ".inst 0xc153be22  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n"
376       "addvl x25, x25, #16\n"
377       "tbnz %x[flags], #31, 28f\n"
378       "sdot z26.s, z3.b, z24.b\n"
379       "28:"  // Width 3: Multiply loop: unique 5: skip row sum
380       "sub x20, x20, #0x10\n"
381       "cmp x20, #0x10\n"
382       "bgt 27b\n"
383       "29:"  // Width 3: Multiply loop: Single iteration only
384       "whilelt p0.b, XZR, x20\n"
385       "ld1rqb { z3.b }, p0/Z, [x22]\n"
386       "subs x20, x20, #0x4\n"
387       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
388       "add x22, x22, #0x10\n"
389       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
390       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
391       ".inst 0xc153b0a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n"
392       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
393       ".inst 0xc153b1a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n"
394       "addvl x25, x25, #16\n"
395       "ble 30f\n"
396       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
397       "subs x20, x20, #0x4\n"
398       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
399       ".inst 0xa0418329  // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
400       ".inst 0xc153b521  // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n"
401       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
402       ".inst 0xc153b622  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n"
403       "addvl x25, x25, #16\n"
404       "ble 30f\n"
405       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
406       "subs x20, x20, #0x4\n"
407       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
408       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
409       ".inst 0xc153b8a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n"
410       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
411       ".inst 0xc153b9a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n"
412       "addvl x25, x25, #16\n"
413       "ble 30f\n"
414       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
415       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
416       ".inst 0xa0418335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
417       ".inst 0xc153bea1  // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n"
418       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
419       ".inst 0xc153be22  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n"
420       "addvl x25, x25, #16\n"
421       "30:"  // Width 3: Multiply loop: multiply skip
422       "tbnz %x[flags], #31, 31f\n"
423       "sdot z26.s, z3.b, z24.b\n"
424       "31:"  // Width 3: Multiply loop: unique 6: skip row sum
425       "tbnz %x[flags], #31, 32f\n"
426       "add x20, %x[qp], %[b_offset]\n"
427       "mov x19, #0x4\n"
428       "ld1rw { z10.s }, p2/Z, [x20]\n"
429       "neg z10.s, p2/M, z10.s\n"
430       "whilelt p0.s, XZR, x19\n"
431       "saddv d26, p0, z26.s\n"
432       "mov z26.s, z26.s[0]\n"
433       "mul z26.s, p2/M, z26.s, z10.s\n"
434       "orr %x[flags], %x[flags], #0x80000000\n"
435       "32:"  // Width 3: skip row sum fixup
436       ".inst 0xc0904b40  // addha za0.s, p2/M, p2/M, z26.s\n"
437       "add x19, %x[qp], %[per_layer_mul]\n"
438       "ld1rw { z5.s }, p2/Z, [x19]\n"
439       "add x19, %x[qp], %[per_layer_right_shift]\n"
440       ".inst 0xc0904b41  // addha za1.s, p2/M, p2/M, z26.s\n"
441       "ld1rw { z4.s }, p2/Z, [x19]\n"
442       "add x19, %x[qp], %[c_offset]\n"
443       "add x20, %x[qp], %[minval]\n"
444       ".inst 0xc0904b42  // addha za2.s, p2/M, p2/M, z26.s\n"
445       "ld1rw { z6.s }, p2/Z, [x19]\n"
446       "add x19, %x[qp], %[maxval]\n"
447       ".inst 0xc0904b43  // addha za3.s, p2/M, p2/M, z26.s\n"
448       "ld1rw { z21.s }, p2/Z, [x20]\n"
449       ".inst 0xc0062c1c  // mova { z28.d-z31.d }, za.d[x9, #0]\n"
450       ".inst 0xc1a5ac1c  // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n"
451       ".inst 0xc0062c2c  // mova { z12.d-z15.d }, za.d[x9, #1]\n"
452       ".inst 0xc1a5ac0c  // sqdmulh { z12.s-z15.s }, { z12.s-z15.s }, z5.s\n"
453       ".inst 0xc0062c40  // mova { z0.d-z3.d }, za.d[x9, #2]\n"
454       ".inst 0xc1a5ac00  // sqdmulh { z0.s-z3.s }, { z0.s-z3.s }, z5.s\n"
455       ".inst 0xc1a4aa3c  // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n"
456       "ld1rw { z16.s }, p2/Z, [x19]\n"
457       ".inst 0xc1a4aa2c  // srshl { z12.s-z15.s }, { z12.s-z15.s }, z4.s\n"
458       ".inst 0xc1a4aa20  // srshl { z0.s-z3.s }, { z0.s-z3.s }, z4.s\n"
459       ".inst 0xc1a6ab1c  // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n"
460       ".inst 0xc1a6ab0c  // add { z12.s-z15.s }, { z12.s-z15.s }, z6.s\n"
461       ".inst 0xc1a6ab00  // add { z0.s-z3.s }, { z0.s-z3.s }, z6.s\n"
462       ".inst 0xc1b0cebc  // sclamp { z28.s-z31.s }, z21.s, z16.s\n"
463       ".inst 0xc1b0ceac  // sclamp { z12.s-z15.s }, z21.s, z16.s\n"
464       "uzp1 z28.h, z28.h, z29.h\n"
465       ".inst 0xc1b0cea0  // sclamp { z0.s-z3.s }, z21.s, z16.s\n"
466       "uzp1 z29.h, z30.h, z31.h\n"
467       "uzp1 z12.h, z12.h, z13.h\n"
468       "uzp1 z13.h, z14.h, z15.h\n"
469       "uzp1 z0.h, z0.h, z1.h\n"
470       "uzp1 z1.h, z2.h, z3.h\n"
471       "uzp1 z28.b, z28.b, z29.b\n"
472       "st1b { z28.b }, p2, [x24]\n"
473       "uzp1 z12.b, z12.b, z13.b\n"
474       "st1b { z12.b }, p2, [x24, #1, MUL VL]\n"
475       "uzp1 z0.b, z0.b, z1.b\n"
476       "st1b { z0.b }, p1, [x24, #2, MUL VL]\n"
477       "addvl x24, x24, #3\n"
478       "33:"  // Width 3: Output done
479       "b 44f\n"
480       "34:"  // Width 4
481       "mov x19, #0x3\n"
482       "mov x22, %x[A_ptr]\n"
483       "mov x21, %x[K]\n"
484       "msub x19, x27, x19, %x[N]\n"
485       "mov x20, %x[K]\n"
486       ".inst 0xf8b54ad8  // rprfm pldmany, x21, [x22]\n"
487       "whilelt p1.b, XZR, x19\n"
488       "cbz x23, 35f\n"
489       ".inst 0xa040c2e4  // ld1w { z4.s-z7.s }, pn8.b/Z, [x23]\n"
490       ".inst 0xc0042c80  // mova za.d[x9, #0], { z4.d-z7.d }\n"
491       ".inst 0xa041c2f4  // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x4, MUL VL]\n"
492       ".inst 0xc0042e81  // mova za.d[x9, #1], { z20.d-z23.d }\n"
493       ".inst 0xa042c2f4  // ld1w { z20.s-z23.s }, pn8.b/Z, [x23, #0x8, MUL VL]\n"
494       ".inst 0xc0042e82  // mova za.d[x9, #2], { z20.d-z23.d }\n"
495       ".inst 0xa043c2f0  // ld1w { z16.s-z19.s }, pn8.b/Z, [x23, #0xc, MUL VL]\n"
496       ".inst 0xc0042e03  // mova za.d[x9, #3], { z16.d-z19.d }\n"
497       "addvl x23, x23, #16\n"
498       "b 36f\n"
499       "35:"  // Width 4: no bias
500       ".inst 0xc00800ff  // zero { zad0, zad1, zad2, zad3, zad4, zad5, zad6, zad7 }\n"
501       "36:"  // Width 4: setup done
502       "cmp x20, #0x10\n"
503       "ble 39f\n"
504       "37:"  // Width 4: Multiply loop: Main loop head
505       "whilelt p0.b, XZR, x20\n"
506       "ld1rqb { z3.b }, p0/Z, [x22]\n"
507       "add x22, x22, #0x10\n"
508       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
509       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
510       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
511       ".inst 0xc153b0a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n"
512       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
513       ".inst 0xc153b1a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n"
514       ".inst 0xa043832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
515       ".inst 0xc153b1a3  // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[0]\n"
516       "addvl x25, x25, #16\n"
517       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
518       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
519       ".inst 0xa0418329  // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
520       ".inst 0xc153b521  // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n"
521       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
522       ".inst 0xc153b622  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n"
523       ".inst 0xa043832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
524       ".inst 0xc153b5a3  // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[1]\n"
525       "addvl x25, x25, #16\n"
526       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
527       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
528       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
529       ".inst 0xc153b8a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n"
530       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
531       ".inst 0xc153b9a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n"
532       ".inst 0xa043833d  // ldnt1b { z28.b-z31.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
533       ".inst 0xc153bba3  // sdot za.s[x9, 3], { z28.b-z31.b }, z3.b[2]\n"
534       "addvl x25, x25, #16\n"
535       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
536       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
537       ".inst 0xa0418335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
538       ".inst 0xc153bea1  // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n"
539       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
540       ".inst 0xc153be22  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n"
541       ".inst 0xa0438331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
542       ".inst 0xc153be23  // sdot za.s[x9, 3], { z16.b-z19.b }, z3.b[3]\n"
543       "addvl x25, x25, #16\n"
544       "tbnz %x[flags], #31, 38f\n"
545       "sdot z26.s, z3.b, z24.b\n"
546       "38:"  // Width 4: Multiply loop: unique 7: skip row sum
547       "sub x20, x20, #0x10\n"
548       "cmp x20, #0x10\n"
549       "bgt 37b\n"
550       "39:"  // Width 4: Multiply loop: Single iteration only
551       "whilelt p0.b, XZR, x20\n"
552       "ld1rqb { z3.b }, p0/Z, [x22]\n"
553       "subs x20, x20, #0x4\n"
554       ".inst 0xa0408331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25]\n"
555       "add x22, x22, #0x10\n"
556       ".inst 0xc153b220  // sdot za.s[x9, 0], { z16.b-z19.b }, z3.b[0]\n"
557       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
558       ".inst 0xc153b0a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[0]\n"
559       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
560       ".inst 0xc153b1a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[0]\n"
561       ".inst 0xa043832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
562       ".inst 0xc153b1a3  // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[0]\n"
563       "addvl x25, x25, #16\n"
564       "ble 40f\n"
565       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
566       "subs x20, x20, #0x4\n"
567       ".inst 0xc153b6a0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[1]\n"
568       ".inst 0xa0418329  // ldnt1b { z8.b-z11.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
569       ".inst 0xc153b521  // sdot za.s[x9, 1], { z8.b-z11.b }, z3.b[1]\n"
570       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
571       ".inst 0xc153b622  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[1]\n"
572       ".inst 0xa043832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
573       ".inst 0xc153b5a3  // sdot za.s[x9, 3], { z12.b-z15.b }, z3.b[1]\n"
574       "addvl x25, x25, #16\n"
575       "ble 40f\n"
576       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
577       "subs x20, x20, #0x4\n"
578       ".inst 0xc153baa0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[2]\n"
579       ".inst 0xa0418325  // ldnt1b { z4.b-z7.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
580       ".inst 0xc153b8a1  // sdot za.s[x9, 1], { z4.b-z7.b }, z3.b[2]\n"
581       ".inst 0xa042832d  // ldnt1b { z12.b-z15.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
582       ".inst 0xc153b9a2  // sdot za.s[x9, 2], { z12.b-z15.b }, z3.b[2]\n"
583       ".inst 0xa043833d  // ldnt1b { z28.b-z31.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
584       ".inst 0xc153bba3  // sdot za.s[x9, 3], { z28.b-z31.b }, z3.b[2]\n"
585       "addvl x25, x25, #16\n"
586       "ble 40f\n"
587       ".inst 0xa0408335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25]\n"
588       ".inst 0xc153bea0  // sdot za.s[x9, 0], { z20.b-z23.b }, z3.b[3]\n"
589       ".inst 0xa0418335  // ldnt1b { z20.b-z23.b }, pn8.b/Z, [x25, #0x4, MUL VL]\n"
590       ".inst 0xc153bea1  // sdot za.s[x9, 1], { z20.b-z23.b }, z3.b[3]\n"
591       ".inst 0xa0428331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0x8, MUL VL]\n"
592       ".inst 0xc153be22  // sdot za.s[x9, 2], { z16.b-z19.b }, z3.b[3]\n"
593       ".inst 0xa0438331  // ldnt1b { z16.b-z19.b }, pn8.b/Z, [x25, #0xc, MUL VL]\n"
594       ".inst 0xc153be23  // sdot za.s[x9, 3], { z16.b-z19.b }, z3.b[3]\n"
595       "addvl x25, x25, #16\n"
596       "40:"  // Width 4: Multiply loop: multiply skip
597       "tbnz %x[flags], #31, 41f\n"
598       "sdot z26.s, z3.b, z24.b\n"
599       "41:"  // Width 4: Multiply loop: unique 8: skip row sum
600       "tbnz %x[flags], #31, 42f\n"
601       "add x20, %x[qp], %[b_offset]\n"
602       "mov x19, #0x4\n"
603       "ld1rw { z10.s }, p2/Z, [x20]\n"
604       "neg z10.s, p2/M, z10.s\n"
605       "whilelt p0.s, XZR, x19\n"
606       "saddv d26, p0, z26.s\n"
607       "mov z26.s, z26.s[0]\n"
608       "mul z26.s, p2/M, z26.s, z10.s\n"
609       "orr %x[flags], %x[flags], #0x80000000\n"
610       "42:"  // Width 4: skip row sum fixup
611       ".inst 0xc0904b40  // addha za0.s, p2/M, p2/M, z26.s\n"
612       "add x19, %x[qp], %[per_layer_mul]\n"
613       "ld1rw { z5.s }, p2/Z, [x19]\n"
614       "add x19, %x[qp], %[per_layer_right_shift]\n"
615       ".inst 0xc0904b41  // addha za1.s, p2/M, p2/M, z26.s\n"
616       "ld1rw { z4.s }, p2/Z, [x19]\n"
617       "add x19, %x[qp], %[c_offset]\n"
618       "add x20, %x[qp], %[minval]\n"
619       ".inst 0xc0904b42  // addha za2.s, p2/M, p2/M, z26.s\n"
620       "ld1rw { z6.s }, p2/Z, [x19]\n"
621       "add x19, %x[qp], %[maxval]\n"
622       ".inst 0xc0904b43  // addha za3.s, p2/M, p2/M, z26.s\n"
623       "ld1rw { z21.s }, p2/Z, [x20]\n"
624       ".inst 0xc0062c1c  // mova { z28.d-z31.d }, za.d[x9, #0]\n"
625       ".inst 0xc1a5ac1c  // sqdmulh { z28.s-z31.s }, { z28.s-z31.s }, z5.s\n"
626       ".inst 0xc0062c2c  // mova { z12.d-z15.d }, za.d[x9, #1]\n"
627       ".inst 0xc1a5ac0c  // sqdmulh { z12.s-z15.s }, { z12.s-z15.s }, z5.s\n"
628       ".inst 0xc0062c40  // mova { z0.d-z3.d }, za.d[x9, #2]\n"
629       ".inst 0xc1a5ac00  // sqdmulh { z0.s-z3.s }, { z0.s-z3.s }, z5.s\n"
630       ".inst 0xc0062c68  // mova { z8.d-z11.d }, za.d[x9, #3]\n"
631       ".inst 0xc1a5ac08  // sqdmulh { z8.s-z11.s }, { z8.s-z11.s }, z5.s\n"
632       ".inst 0xc1a4aa3c  // srshl { z28.s-z31.s }, { z28.s-z31.s }, z4.s\n"
633       "ld1rw { z16.s }, p2/Z, [x19]\n"
634       ".inst 0xc1a4aa2c  // srshl { z12.s-z15.s }, { z12.s-z15.s }, z4.s\n"
635       ".inst 0xc1a4aa20  // srshl { z0.s-z3.s }, { z0.s-z3.s }, z4.s\n"
636       ".inst 0xc1a4aa28  // srshl { z8.s-z11.s }, { z8.s-z11.s }, z4.s\n"
637       ".inst 0xc1a6ab1c  // add { z28.s-z31.s }, { z28.s-z31.s }, z6.s\n"
638       ".inst 0xc1a6ab0c  // add { z12.s-z15.s }, { z12.s-z15.s }, z6.s\n"
639       ".inst 0xc1a6ab00  // add { z0.s-z3.s }, { z0.s-z3.s }, z6.s\n"
640       ".inst 0xc1a6ab08  // add { z8.s-z11.s }, { z8.s-z11.s }, z6.s\n"
641       ".inst 0xc1b0cebc  // sclamp { z28.s-z31.s }, z21.s, z16.s\n"
642       ".inst 0xc1b0ceac  // sclamp { z12.s-z15.s }, z21.s, z16.s\n"
643       "uzp1 z28.h, z28.h, z29.h\n"
644       ".inst 0xc1b0cea0  // sclamp { z0.s-z3.s }, z21.s, z16.s\n"
645       ".inst 0xc1b0cea8  // sclamp { z8.s-z11.s }, z21.s, z16.s\n"
646       "uzp1 z29.h, z30.h, z31.h\n"
647       "uzp1 z12.h, z12.h, z13.h\n"
648       "uzp1 z13.h, z14.h, z15.h\n"
649       "uzp1 z0.h, z0.h, z1.h\n"
650       "uzp1 z1.h, z2.h, z3.h\n"
651       "uzp1 z8.h, z8.h, z9.h\n"
652       "uzp1 z9.h, z10.h, z11.h\n"
653       "uzp1 z28.b, z28.b, z29.b\n"
654       "st1b { z28.b }, p2, [x24]\n"
655       "uzp1 z12.b, z12.b, z13.b\n"
656       "st1b { z12.b }, p2, [x24, #1, MUL VL]\n"
657       "uzp1 z0.b, z0.b, z1.b\n"
658       "uzp1 z8.b, z8.b, z9.b\n"
659       "st1b { z0.b }, p2, [x24, #2, MUL VL]\n"
660       "st1b { z8.b }, p1, [x24, #3, MUL VL]\n"
661       "addvl x24, x24, #4\n"
662       "43:"  // Width 4: Output done
663       "subs x26, x26, #0x4\n"
664       "sub %x[N], %x[N], x27, LSL #2\n"
665       "bgt 4b\n"
666       "44:"  // Exit
667       ".inst 0xd503467f  // SMSTOP\n"
668       "ptrue p2.b\n"
669       : [N] "+&r" (N), [flags] "+&r" (flags)
670       : [A_ptr] "r" (A_ptr), [B_ptr] "r" (B_ptr), [K] "r" (K), [b_offset] "I" (offsetof(Requantize32, b_offset)), [c_offset] "I" (offsetof(Requantize32, c_offset)), [col_bias] "r" (col_bias), [maxval] "I" (offsetof(Requantize32, maxval)), [minval] "I" (offsetof(Requantize32, minval)), [output_ptr] "r" (output_ptr), [per_layer_mul] "I" (offsetof(Requantize32, per_layer_mul)), [per_layer_right_shift] "I" (offsetof(Requantize32, per_layer_right_shift)), [qp] "r" (qp)
671       : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
672     );
673 }
674 
675 } // namespace arm_gemm
676 
677 #endif // ARM_COMPUTE_ENABLE_SME2
678 #endif
679