• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_COMPUTE_ENABLE_SVE
25 
26 #include "arm_gemm.hpp"
27 #include "../../utils.hpp"
28 
29 #include <cassert>
30 
31 namespace arm_gemm {
32 
sve_hybrid_s8s32_dot_6x4VL_a64fx(unsigned int num_strings,const unsigned int * string_lengths,IndirectInputArg<int8_t> A_arg,size_t M,size_t N,const int8_t * B_ptr,IndirectOutputArg<int32_t> output_arg,const int32_t *,Activation,bool accumulate)33 void sve_hybrid_s8s32_dot_6x4VL_a64fx (
34     unsigned int num_strings, const unsigned int *string_lengths, IndirectInputArg<int8_t> A_arg,
35     size_t M, size_t N, const int8_t *B_ptr, IndirectOutputArg<int32_t> output_arg,
36     const int32_t *, Activation, bool accumulate
37 )
38 {
39     struct KernelArgs {
40         unsigned int num_strings = {};
41         const unsigned int *string_lengths = {};
42         size_t N = {};
43         const int8_t *B_ptr = {};
44         size_t output_offset = {};
45         size_t input_initial_col = {};
46         size_t input_offset = {};
47     } ka;
48 
49     unsigned long flags=0;
50     void *output_ptr;
51     void *input_ptr;
52 
53     if (output_arg.is_indirect) {
54         output_ptr=(void *)(output_arg.indirect.ptr);
55         ka.output_offset=output_arg.indirect.offset;
56         flags |= 0x4;
57     } else {
58         output_ptr=(void *)(output_arg.direct.base);
59         ka.output_offset=output_arg.direct.stride;
60     }
61 
62     if (A_arg.is_indirect) {
63         input_ptr=(void *)(A_arg.indirect.ptr);
64         ka.input_offset=A_arg.indirect.start_row;
65         ka.input_initial_col=A_arg.indirect.start_col;
66         flags |= 0x8;
67     } else {
68         assert(num_strings==1);
69         input_ptr=(void *)(A_arg.direct.base);
70         ka.input_offset=A_arg.direct.stride;
71     }
72     if (accumulate) {
73         flags |= 0x1;
74     }
75     ka.num_strings = num_strings;
76     ka.string_lengths = string_lengths;
77     ka.N = N;
78     ka.B_ptr = B_ptr;
79     __asm__ __volatile__(
80       "ptrue p4.b\n"
81       "1:"  // Row loop
82       "cmp %x[M], #0x6\n"
83       "bge 51f\n"
84       "cmp %x[M], #0x4\n"
85       "bgt 41f\n"
86       "beq 31f\n"
87       "cmp %x[M], #0x2\n"
88       "bgt 21f\n"
89       "beq 11f\n"
90       "ldr x10, [%x[args_ptr], %[offsetof_N]]\n"
91       "ldr x9, [%x[args_ptr], %[offsetof_B_ptr]]\n"
92       "mov x28, %x[output_ptr]\n"
93       "2:"  // Height 1: Column loop
94       "mov x19, #0x0\n"
95       "whilelt p3.s, x19, x10\n"
96       "incw x19\n"
97       "whilelt p2.s, x19, x10\n"
98       "incw x19\n"
99       "whilelt p1.s, x19, x10\n"
100       "incw x19\n"
101       "whilelt p0.s, x19, x10\n"
102       "tbz %x[flags], #0, 3f\n"
103       "ld1w { z8.s }, p3/Z, [x28]\n"
104       "ld1w { z9.s }, p2/Z, [x28, #1, MUL VL]\n"
105       "ld1w { z10.s }, p1/Z, [x28, #2, MUL VL]\n"
106       "ld1w { z11.s }, p0/Z, [x28, #3, MUL VL]\n"
107       "b 4f\n"
108       "3:"  // Height 1: no accumulate
109       "mov z8.s, #0x0\n"
110       "mov z9.s, #0x0\n"
111       "mov z10.s, #0x0\n"
112       "mov z11.s, #0x0\n"
113       "4:"  // Height 1: setup done
114       "mov x27, #0x0\n"
115       "5:"  // Height 1: String loop
116       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
117       "ldr w26, [x19, x27, LSL #0x2]\n"
118       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
119       "tbz %x[flags], #3, 6f\n"
120       "ldr x20, [%x[input_ptr], x27, LSL #0x3]\n"
121       "add x20, x20, x19, LSL #3\n"
122       "ldr x25, [x20, #0x0]\n"
123       "cbnz x27, 7f\n"
124       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
125       "add x25, x25, x19\n"
126       "b 7f\n"
127       "6:"  // Height 1: setup direct input
128       "mov x25, %x[input_ptr]\n"
129       "7:"  // Height 1: input setup done
130       "subs x26, x26, #0x4\n"
131       "ld1rw { z0.s }, p4/Z, [x25]\n"
132       "ld1b { z6.b }, p4/Z, [x9]\n"
133       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
134       "ble 9f\n"
135       "8:"  // Height 1: Multiply loop: Main loop
136       "sdot z8.s, z6.b, z0.b\n"
137       "sdot z9.s, z7.b, z0.b\n"
138       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
139       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
140       "addvl x9, x9, #4\n"
141       "add x25, x25, #0x4\n"
142       "sdot z10.s, z6.b, z0.b\n"
143       "sdot z11.s, z7.b, z0.b\n"
144       "subs x26, x26, #0x4\n"
145       "ld1rw { z0.s }, p4/Z, [x25]\n"
146       "ld1b { z6.b }, p4/Z, [x9]\n"
147       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
148       "bgt 8b\n"
149       "9:"  // Height 1: Multiply loop: Main loop skip
150       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
151       "sdot z8.s, z6.b, z0.b\n"
152       "sdot z9.s, z7.b, z0.b\n"
153       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
154       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
155       "add x27, x27, #0x1\n"
156       "cmp x27, x19\n"
157       "sdot z10.s, z6.b, z0.b\n"
158       "sdot z11.s, z7.b, z0.b\n"
159       "addvl x9, x9, #4\n"
160       "bne 5b\n"
161       "st1w { z8.s }, p3, [x28]\n"
162       "st1w { z9.s }, p2, [x28, #1, MUL VL]\n"
163       "st1w { z10.s }, p1, [x28, #2, MUL VL]\n"
164       "st1w { z11.s }, p0, [x28, #3, MUL VL]\n"
165       "addvl x28, x28, #4\n"
166       "10:"  // Height 1: Writeback done
167       "decw x10, ALL, MUL #4\n"
168       "cmp x10, XZR\n"
169       "bgt 2b\n"
170       "b 62f\n"
171       "11:"  // Height 2
172       "ldr x10, [%x[args_ptr], %[offsetof_N]]\n"
173       "ldr x9, [%x[args_ptr], %[offsetof_B_ptr]]\n"
174       "mov x28, %x[output_ptr]\n"
175       "12:"  // Height 2: Column loop
176       "mov x19, #0x0\n"
177       "whilelt p3.s, x19, x10\n"
178       "incw x19\n"
179       "whilelt p2.s, x19, x10\n"
180       "incw x19\n"
181       "whilelt p1.s, x19, x10\n"
182       "incw x19\n"
183       "whilelt p0.s, x19, x10\n"
184       "tbz %x[flags], #0, 13f\n"
185       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
186       "add x23, x28, x19, LSL #2\n"
187       "ld1w { z8.s }, p3/Z, [x28]\n"
188       "ld1w { z9.s }, p2/Z, [x28, #1, MUL VL]\n"
189       "ld1w { z10.s }, p1/Z, [x28, #2, MUL VL]\n"
190       "ld1w { z11.s }, p0/Z, [x28, #3, MUL VL]\n"
191       "ld1w { z12.s }, p3/Z, [x23]\n"
192       "ld1w { z13.s }, p2/Z, [x23, #1, MUL VL]\n"
193       "ld1w { z14.s }, p1/Z, [x23, #2, MUL VL]\n"
194       "ld1w { z15.s }, p0/Z, [x23, #3, MUL VL]\n"
195       "b 14f\n"
196       "13:"  // Height 2: no accumulate
197       "mov z8.s, #0x0\n"
198       "mov z9.s, #0x0\n"
199       "mov z10.s, #0x0\n"
200       "mov z11.s, #0x0\n"
201       "mov z12.s, #0x0\n"
202       "mov z13.s, #0x0\n"
203       "mov z14.s, #0x0\n"
204       "mov z15.s, #0x0\n"
205       "14:"  // Height 2: setup done
206       "mov x27, #0x0\n"
207       "15:"  // Height 2: String loop
208       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
209       "ldr w26, [x19, x27, LSL #0x2]\n"
210       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
211       "tbz %x[flags], #3, 16f\n"
212       "ldr x20, [%x[input_ptr], x27, LSL #0x3]\n"
213       "add x20, x20, x19, LSL #3\n"
214       "ldr x25, [x20, #0x0]\n"
215       "ldr x24, [x20, #0x8]\n"
216       "cbnz x27, 17f\n"
217       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
218       "add x25, x25, x19\n"
219       "add x24, x24, x19\n"
220       "b 17f\n"
221       "16:"  // Height 2: setup direct input
222       "mov x25, %x[input_ptr]\n"
223       "add x24, x25, x19\n"
224       "17:"  // Height 2: input setup done
225       "subs x26, x26, #0x4\n"
226       "ld1rw { z0.s }, p4/Z, [x25]\n"
227       "ld1rw { z1.s }, p4/Z, [x24]\n"
228       "ld1b { z6.b }, p4/Z, [x9]\n"
229       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
230       "ble 19f\n"
231       "18:"  // Height 2: Multiply loop: Main loop
232       "sdot z8.s, z6.b, z0.b\n"
233       "sdot z12.s, z6.b, z1.b\n"
234       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
235       "add x25, x25, #0x4\n"
236       "sdot z9.s, z7.b, z0.b\n"
237       "sdot z13.s, z7.b, z1.b\n"
238       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
239       "addvl x9, x9, #4\n"
240       "subs x26, x26, #0x4\n"
241       "add x24, x24, #0x4\n"
242       "sdot z10.s, z6.b, z0.b\n"
243       "sdot z14.s, z6.b, z1.b\n"
244       "sdot z11.s, z7.b, z0.b\n"
245       "sdot z15.s, z7.b, z1.b\n"
246       "ld1rw { z0.s }, p4/Z, [x25]\n"
247       "ld1rw { z1.s }, p4/Z, [x24]\n"
248       "ld1b { z6.b }, p4/Z, [x9]\n"
249       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
250       "bgt 18b\n"
251       "19:"  // Height 2: Multiply loop: Main loop skip
252       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
253       "sdot z8.s, z6.b, z0.b\n"
254       "sdot z12.s, z6.b, z1.b\n"
255       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
256       "sdot z9.s, z7.b, z0.b\n"
257       "sdot z13.s, z7.b, z1.b\n"
258       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
259       "add x27, x27, #0x1\n"
260       "cmp x27, x19\n"
261       "sdot z10.s, z6.b, z0.b\n"
262       "sdot z14.s, z6.b, z1.b\n"
263       "addvl x9, x9, #4\n"
264       "sdot z11.s, z7.b, z0.b\n"
265       "sdot z15.s, z7.b, z1.b\n"
266       "bne 15b\n"
267       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
268       "add x23, x28, x19, LSL #2\n"
269       "st1w { z8.s }, p3, [x28]\n"
270       "st1w { z9.s }, p2, [x28, #1, MUL VL]\n"
271       "st1w { z10.s }, p1, [x28, #2, MUL VL]\n"
272       "st1w { z11.s }, p0, [x28, #3, MUL VL]\n"
273       "addvl x28, x28, #4\n"
274       "st1w { z12.s }, p3, [x23]\n"
275       "st1w { z13.s }, p2, [x23, #1, MUL VL]\n"
276       "st1w { z14.s }, p1, [x23, #2, MUL VL]\n"
277       "st1w { z15.s }, p0, [x23, #3, MUL VL]\n"
278       "20:"  // Height 2: Writeback done
279       "decw x10, ALL, MUL #4\n"
280       "cmp x10, XZR\n"
281       "bgt 12b\n"
282       "b 62f\n"
283       "21:"  // Height 3
284       "ldr x10, [%x[args_ptr], %[offsetof_N]]\n"
285       "ldr x9, [%x[args_ptr], %[offsetof_B_ptr]]\n"
286       "mov x28, %x[output_ptr]\n"
287       "22:"  // Height 3: Column loop
288       "mov x19, #0x0\n"
289       "whilelt p3.s, x19, x10\n"
290       "incw x19\n"
291       "whilelt p2.s, x19, x10\n"
292       "incw x19\n"
293       "whilelt p1.s, x19, x10\n"
294       "incw x19\n"
295       "whilelt p0.s, x19, x10\n"
296       "tbz %x[flags], #0, 23f\n"
297       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
298       "add x23, x28, x19, LSL #2\n"
299       "add x22, x23, x19, LSL #2\n"
300       "ld1w { z8.s }, p3/Z, [x28]\n"
301       "ld1w { z9.s }, p2/Z, [x28, #1, MUL VL]\n"
302       "ld1w { z10.s }, p1/Z, [x28, #2, MUL VL]\n"
303       "ld1w { z11.s }, p0/Z, [x28, #3, MUL VL]\n"
304       "ld1w { z12.s }, p3/Z, [x23]\n"
305       "ld1w { z13.s }, p2/Z, [x23, #1, MUL VL]\n"
306       "ld1w { z14.s }, p1/Z, [x23, #2, MUL VL]\n"
307       "ld1w { z15.s }, p0/Z, [x23, #3, MUL VL]\n"
308       "ld1w { z16.s }, p3/Z, [x22]\n"
309       "ld1w { z17.s }, p2/Z, [x22, #1, MUL VL]\n"
310       "ld1w { z18.s }, p1/Z, [x22, #2, MUL VL]\n"
311       "ld1w { z19.s }, p0/Z, [x22, #3, MUL VL]\n"
312       "b 24f\n"
313       "23:"  // Height 3: no accumulate
314       "mov z8.s, #0x0\n"
315       "mov z9.s, #0x0\n"
316       "mov z10.s, #0x0\n"
317       "mov z11.s, #0x0\n"
318       "mov z12.s, #0x0\n"
319       "mov z13.s, #0x0\n"
320       "mov z14.s, #0x0\n"
321       "mov z15.s, #0x0\n"
322       "mov z16.s, #0x0\n"
323       "mov z17.s, #0x0\n"
324       "mov z18.s, #0x0\n"
325       "mov z19.s, #0x0\n"
326       "24:"  // Height 3: setup done
327       "mov x27, #0x0\n"
328       "25:"  // Height 3: String loop
329       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
330       "ldr w26, [x19, x27, LSL #0x2]\n"
331       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
332       "tbz %x[flags], #3, 26f\n"
333       "ldr x20, [%x[input_ptr], x27, LSL #0x3]\n"
334       "add x20, x20, x19, LSL #3\n"
335       "ldr x25, [x20, #0x0]\n"
336       "ldr x24, [x20, #0x8]\n"
337       "ldr x23, [x20, #0x10]\n"
338       "cbnz x27, 27f\n"
339       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
340       "add x25, x25, x19\n"
341       "add x24, x24, x19\n"
342       "add x23, x23, x19\n"
343       "b 27f\n"
344       "26:"  // Height 3: setup direct input
345       "mov x25, %x[input_ptr]\n"
346       "add x24, x25, x19\n"
347       "add x23, x24, x19\n"
348       "27:"  // Height 3: input setup done
349       "subs x26, x26, #0x4\n"
350       "ld1rw { z0.s }, p4/Z, [x25]\n"
351       "ld1rw { z1.s }, p4/Z, [x24]\n"
352       "ld1rw { z2.s }, p4/Z, [x23]\n"
353       "ld1b { z6.b }, p4/Z, [x9]\n"
354       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
355       "ble 29f\n"
356       "28:"  // Height 3: Multiply loop: Main loop
357       "sdot z8.s, z6.b, z0.b\n"
358       "sdot z12.s, z6.b, z1.b\n"
359       "add x25, x25, #0x4\n"
360       "subs x26, x26, #0x4\n"
361       "sdot z16.s, z6.b, z2.b\n"
362       "sdot z9.s, z7.b, z0.b\n"
363       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
364       "add x24, x24, #0x4\n"
365       "sdot z13.s, z7.b, z1.b\n"
366       "sdot z17.s, z7.b, z2.b\n"
367       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
368       "addvl x9, x9, #4\n"
369       "add x23, x23, #0x4\n"
370       "sdot z10.s, z6.b, z0.b\n"
371       "sdot z14.s, z6.b, z1.b\n"
372       "sdot z18.s, z6.b, z2.b\n"
373       "sdot z11.s, z7.b, z0.b\n"
374       "ld1rw { z0.s }, p4/Z, [x25]\n"
375       "ld1b { z6.b }, p4/Z, [x9]\n"
376       "sdot z15.s, z7.b, z1.b\n"
377       "sdot z19.s, z7.b, z2.b\n"
378       "ld1rw { z1.s }, p4/Z, [x24]\n"
379       "ld1rw { z2.s }, p4/Z, [x23]\n"
380       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
381       "bgt 28b\n"
382       "29:"  // Height 3: Multiply loop: Main loop skip
383       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
384       "sdot z8.s, z6.b, z0.b\n"
385       "sdot z12.s, z6.b, z1.b\n"
386       "add x27, x27, #0x1\n"
387       "sdot z16.s, z6.b, z2.b\n"
388       "sdot z9.s, z7.b, z0.b\n"
389       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
390       "cmp x27, x19\n"
391       "sdot z13.s, z7.b, z1.b\n"
392       "sdot z17.s, z7.b, z2.b\n"
393       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
394       "addvl x9, x9, #4\n"
395       "sdot z10.s, z6.b, z0.b\n"
396       "sdot z14.s, z6.b, z1.b\n"
397       "sdot z18.s, z6.b, z2.b\n"
398       "sdot z11.s, z7.b, z0.b\n"
399       "sdot z15.s, z7.b, z1.b\n"
400       "sdot z19.s, z7.b, z2.b\n"
401       "bne 25b\n"
402       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
403       "add x23, x28, x19, LSL #2\n"
404       "add x22, x23, x19, LSL #2\n"
405       "st1w { z8.s }, p3, [x28]\n"
406       "st1w { z9.s }, p2, [x28, #1, MUL VL]\n"
407       "st1w { z10.s }, p1, [x28, #2, MUL VL]\n"
408       "st1w { z11.s }, p0, [x28, #3, MUL VL]\n"
409       "addvl x28, x28, #4\n"
410       "st1w { z12.s }, p3, [x23]\n"
411       "st1w { z13.s }, p2, [x23, #1, MUL VL]\n"
412       "st1w { z14.s }, p1, [x23, #2, MUL VL]\n"
413       "st1w { z15.s }, p0, [x23, #3, MUL VL]\n"
414       "st1w { z16.s }, p3, [x22]\n"
415       "st1w { z17.s }, p2, [x22, #1, MUL VL]\n"
416       "st1w { z18.s }, p1, [x22, #2, MUL VL]\n"
417       "st1w { z19.s }, p0, [x22, #3, MUL VL]\n"
418       "30:"  // Height 3: Writeback done
419       "decw x10, ALL, MUL #4\n"
420       "cmp x10, XZR\n"
421       "bgt 22b\n"
422       "b 62f\n"
423       "31:"  // Height 4
424       "ldr x10, [%x[args_ptr], %[offsetof_N]]\n"
425       "ldr x9, [%x[args_ptr], %[offsetof_B_ptr]]\n"
426       "mov x28, %x[output_ptr]\n"
427       "32:"  // Height 4: Column loop
428       "mov x19, #0x0\n"
429       "whilelt p3.s, x19, x10\n"
430       "incw x19\n"
431       "whilelt p2.s, x19, x10\n"
432       "incw x19\n"
433       "whilelt p1.s, x19, x10\n"
434       "incw x19\n"
435       "whilelt p0.s, x19, x10\n"
436       "tbz %x[flags], #0, 33f\n"
437       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
438       "add x23, x28, x19, LSL #2\n"
439       "add x22, x23, x19, LSL #2\n"
440       "ld1w { z8.s }, p3/Z, [x28]\n"
441       "ld1w { z9.s }, p2/Z, [x28, #1, MUL VL]\n"
442       "add x21, x22, x19, LSL #2\n"
443       "ld1w { z10.s }, p1/Z, [x28, #2, MUL VL]\n"
444       "ld1w { z11.s }, p0/Z, [x28, #3, MUL VL]\n"
445       "ld1w { z12.s }, p3/Z, [x23]\n"
446       "ld1w { z13.s }, p2/Z, [x23, #1, MUL VL]\n"
447       "ld1w { z14.s }, p1/Z, [x23, #2, MUL VL]\n"
448       "ld1w { z15.s }, p0/Z, [x23, #3, MUL VL]\n"
449       "ld1w { z16.s }, p3/Z, [x22]\n"
450       "ld1w { z17.s }, p2/Z, [x22, #1, MUL VL]\n"
451       "ld1w { z18.s }, p1/Z, [x22, #2, MUL VL]\n"
452       "ld1w { z19.s }, p0/Z, [x22, #3, MUL VL]\n"
453       "ld1w { z20.s }, p3/Z, [x21]\n"
454       "ld1w { z21.s }, p2/Z, [x21, #1, MUL VL]\n"
455       "ld1w { z22.s }, p1/Z, [x21, #2, MUL VL]\n"
456       "ld1w { z23.s }, p0/Z, [x21, #3, MUL VL]\n"
457       "b 34f\n"
458       "33:"  // Height 4: no accumulate
459       "mov z8.s, #0x0\n"
460       "mov z9.s, #0x0\n"
461       "mov z10.s, #0x0\n"
462       "mov z11.s, #0x0\n"
463       "mov z12.s, #0x0\n"
464       "mov z13.s, #0x0\n"
465       "mov z14.s, #0x0\n"
466       "mov z15.s, #0x0\n"
467       "mov z16.s, #0x0\n"
468       "mov z17.s, #0x0\n"
469       "mov z18.s, #0x0\n"
470       "mov z19.s, #0x0\n"
471       "mov z20.s, #0x0\n"
472       "mov z21.s, #0x0\n"
473       "mov z22.s, #0x0\n"
474       "mov z23.s, #0x0\n"
475       "34:"  // Height 4: setup done
476       "mov x27, #0x0\n"
477       "35:"  // Height 4: String loop
478       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
479       "ldr w26, [x19, x27, LSL #0x2]\n"
480       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
481       "tbz %x[flags], #3, 36f\n"
482       "ldr x20, [%x[input_ptr], x27, LSL #0x3]\n"
483       "add x20, x20, x19, LSL #3\n"
484       "ldr x25, [x20, #0x0]\n"
485       "ldr x24, [x20, #0x8]\n"
486       "ldr x23, [x20, #0x10]\n"
487       "ldr x22, [x20, #0x18]\n"
488       "cbnz x27, 37f\n"
489       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
490       "add x25, x25, x19\n"
491       "add x24, x24, x19\n"
492       "add x23, x23, x19\n"
493       "add x22, x22, x19\n"
494       "b 37f\n"
495       "36:"  // Height 4: setup direct input
496       "mov x25, %x[input_ptr]\n"
497       "add x24, x25, x19\n"
498       "add x23, x24, x19\n"
499       "add x22, x23, x19\n"
500       "37:"  // Height 4: input setup done
501       "subs x26, x26, #0x4\n"
502       "ld1rw { z0.s }, p4/Z, [x25]\n"
503       "ld1rw { z1.s }, p4/Z, [x24]\n"
504       "ld1rw { z2.s }, p4/Z, [x23]\n"
505       "ld1rw { z3.s }, p4/Z, [x22]\n"
506       "ld1b { z6.b }, p4/Z, [x9]\n"
507       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
508       "ble 39f\n"
509       "38:"  // Height 4: Multiply loop: Main loop
510       "sdot z8.s, z6.b, z0.b\n"
511       "sdot z12.s, z6.b, z1.b\n"
512       "add x25, x25, #0x4\n"
513       "subs x26, x26, #0x4\n"
514       "sdot z16.s, z6.b, z2.b\n"
515       "sdot z20.s, z6.b, z3.b\n"
516       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
517       "add x24, x24, #0x4\n"
518       "sdot z9.s, z7.b, z0.b\n"
519       "sdot z13.s, z7.b, z1.b\n"
520       "add x23, x23, #0x4\n"
521       "add x22, x22, #0x4\n"
522       "sdot z17.s, z7.b, z2.b\n"
523       "sdot z21.s, z7.b, z3.b\n"
524       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
525       "addvl x9, x9, #4\n"
526       "sdot z10.s, z6.b, z0.b\n"
527       "sdot z14.s, z6.b, z1.b\n"
528       "sdot z18.s, z6.b, z2.b\n"
529       "sdot z22.s, z6.b, z3.b\n"
530       "ld1b { z6.b }, p4/Z, [x9]\n"
531       "sdot z11.s, z7.b, z0.b\n"
532       "sdot z15.s, z7.b, z1.b\n"
533       "ld1rw { z0.s }, p4/Z, [x25]\n"
534       "ld1rw { z1.s }, p4/Z, [x24]\n"
535       "sdot z19.s, z7.b, z2.b\n"
536       "sdot z23.s, z7.b, z3.b\n"
537       "ld1rw { z2.s }, p4/Z, [x23]\n"
538       "ld1rw { z3.s }, p4/Z, [x22]\n"
539       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
540       "bgt 38b\n"
541       "39:"  // Height 4: Multiply loop: Main loop skip
542       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
543       "sdot z8.s, z6.b, z0.b\n"
544       "sdot z12.s, z6.b, z1.b\n"
545       "add x27, x27, #0x1\n"
546       "sdot z16.s, z6.b, z2.b\n"
547       "sdot z20.s, z6.b, z3.b\n"
548       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
549       "cmp x27, x19\n"
550       "sdot z9.s, z7.b, z0.b\n"
551       "sdot z13.s, z7.b, z1.b\n"
552       "sdot z17.s, z7.b, z2.b\n"
553       "sdot z21.s, z7.b, z3.b\n"
554       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
555       "addvl x9, x9, #4\n"
556       "sdot z10.s, z6.b, z0.b\n"
557       "sdot z14.s, z6.b, z1.b\n"
558       "sdot z18.s, z6.b, z2.b\n"
559       "sdot z22.s, z6.b, z3.b\n"
560       "sdot z11.s, z7.b, z0.b\n"
561       "sdot z15.s, z7.b, z1.b\n"
562       "sdot z19.s, z7.b, z2.b\n"
563       "sdot z23.s, z7.b, z3.b\n"
564       "bne 35b\n"
565       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
566       "add x23, x28, x19, LSL #2\n"
567       "add x22, x23, x19, LSL #2\n"
568       "st1w { z8.s }, p3, [x28]\n"
569       "add x21, x22, x19, LSL #2\n"
570       "st1w { z9.s }, p2, [x28, #1, MUL VL]\n"
571       "st1w { z10.s }, p1, [x28, #2, MUL VL]\n"
572       "st1w { z11.s }, p0, [x28, #3, MUL VL]\n"
573       "addvl x28, x28, #4\n"
574       "st1w { z12.s }, p3, [x23]\n"
575       "st1w { z13.s }, p2, [x23, #1, MUL VL]\n"
576       "st1w { z14.s }, p1, [x23, #2, MUL VL]\n"
577       "st1w { z15.s }, p0, [x23, #3, MUL VL]\n"
578       "st1w { z16.s }, p3, [x22]\n"
579       "st1w { z17.s }, p2, [x22, #1, MUL VL]\n"
580       "st1w { z18.s }, p1, [x22, #2, MUL VL]\n"
581       "st1w { z19.s }, p0, [x22, #3, MUL VL]\n"
582       "st1w { z20.s }, p3, [x21]\n"
583       "st1w { z21.s }, p2, [x21, #1, MUL VL]\n"
584       "st1w { z22.s }, p1, [x21, #2, MUL VL]\n"
585       "st1w { z23.s }, p0, [x21, #3, MUL VL]\n"
586       "40:"  // Height 4: Writeback done
587       "decw x10, ALL, MUL #4\n"
588       "cmp x10, XZR\n"
589       "bgt 32b\n"
590       "b 62f\n"
591       "41:"  // Height 5
592       "ldr x10, [%x[args_ptr], %[offsetof_N]]\n"
593       "ldr x9, [%x[args_ptr], %[offsetof_B_ptr]]\n"
594       "mov x28, %x[output_ptr]\n"
595       "42:"  // Height 5: Column loop
596       "mov x19, #0x0\n"
597       "whilelt p3.s, x19, x10\n"
598       "incw x19\n"
599       "whilelt p2.s, x19, x10\n"
600       "incw x19\n"
601       "whilelt p1.s, x19, x10\n"
602       "incw x19\n"
603       "whilelt p0.s, x19, x10\n"
604       "tbz %x[flags], #0, 43f\n"
605       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
606       "add x23, x28, x19, LSL #2\n"
607       "add x22, x23, x19, LSL #2\n"
608       "ld1w { z8.s }, p3/Z, [x28]\n"
609       "ld1w { z9.s }, p2/Z, [x28, #1, MUL VL]\n"
610       "add x21, x22, x19, LSL #2\n"
611       "add x20, x21, x19, LSL #2\n"
612       "ld1w { z10.s }, p1/Z, [x28, #2, MUL VL]\n"
613       "ld1w { z11.s }, p0/Z, [x28, #3, MUL VL]\n"
614       "ld1w { z12.s }, p3/Z, [x23]\n"
615       "ld1w { z13.s }, p2/Z, [x23, #1, MUL VL]\n"
616       "ld1w { z14.s }, p1/Z, [x23, #2, MUL VL]\n"
617       "ld1w { z15.s }, p0/Z, [x23, #3, MUL VL]\n"
618       "ld1w { z16.s }, p3/Z, [x22]\n"
619       "ld1w { z17.s }, p2/Z, [x22, #1, MUL VL]\n"
620       "ld1w { z18.s }, p1/Z, [x22, #2, MUL VL]\n"
621       "ld1w { z19.s }, p0/Z, [x22, #3, MUL VL]\n"
622       "ld1w { z20.s }, p3/Z, [x21]\n"
623       "ld1w { z21.s }, p2/Z, [x21, #1, MUL VL]\n"
624       "ld1w { z22.s }, p1/Z, [x21, #2, MUL VL]\n"
625       "ld1w { z23.s }, p0/Z, [x21, #3, MUL VL]\n"
626       "ld1w { z24.s }, p3/Z, [x20]\n"
627       "ld1w { z25.s }, p2/Z, [x20, #1, MUL VL]\n"
628       "ld1w { z26.s }, p1/Z, [x20, #2, MUL VL]\n"
629       "ld1w { z27.s }, p0/Z, [x20, #3, MUL VL]\n"
630       "b 44f\n"
631       "43:"  // Height 5: no accumulate
632       "mov z8.s, #0x0\n"
633       "mov z9.s, #0x0\n"
634       "mov z10.s, #0x0\n"
635       "mov z11.s, #0x0\n"
636       "mov z12.s, #0x0\n"
637       "mov z13.s, #0x0\n"
638       "mov z14.s, #0x0\n"
639       "mov z15.s, #0x0\n"
640       "mov z16.s, #0x0\n"
641       "mov z17.s, #0x0\n"
642       "mov z18.s, #0x0\n"
643       "mov z19.s, #0x0\n"
644       "mov z20.s, #0x0\n"
645       "mov z21.s, #0x0\n"
646       "mov z22.s, #0x0\n"
647       "mov z23.s, #0x0\n"
648       "mov z24.s, #0x0\n"
649       "mov z25.s, #0x0\n"
650       "mov z26.s, #0x0\n"
651       "mov z27.s, #0x0\n"
652       "44:"  // Height 5: setup done
653       "mov x27, #0x0\n"
654       "45:"  // Height 5: String loop
655       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
656       "ldr w26, [x19, x27, LSL #0x2]\n"
657       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
658       "tbz %x[flags], #3, 46f\n"
659       "ldr x20, [%x[input_ptr], x27, LSL #0x3]\n"
660       "add x20, x20, x19, LSL #3\n"
661       "ldr x25, [x20, #0x0]\n"
662       "ldr x24, [x20, #0x8]\n"
663       "ldr x23, [x20, #0x10]\n"
664       "ldr x22, [x20, #0x18]\n"
665       "ldr x21, [x20, #0x20]\n"
666       "cbnz x27, 47f\n"
667       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
668       "add x25, x25, x19\n"
669       "add x24, x24, x19\n"
670       "add x23, x23, x19\n"
671       "add x22, x22, x19\n"
672       "add x21, x21, x19\n"
673       "b 47f\n"
674       "46:"  // Height 5: setup direct input
675       "mov x25, %x[input_ptr]\n"
676       "add x24, x25, x19\n"
677       "add x23, x24, x19\n"
678       "add x22, x23, x19\n"
679       "add x21, x22, x19\n"
680       "47:"  // Height 5: input setup done
681       "subs x26, x26, #0x4\n"
682       "ld1rw { z0.s }, p4/Z, [x25]\n"
683       "ld1rw { z1.s }, p4/Z, [x24]\n"
684       "ld1rw { z2.s }, p4/Z, [x23]\n"
685       "ld1rw { z3.s }, p4/Z, [x22]\n"
686       "ld1rw { z4.s }, p4/Z, [x21]\n"
687       "ld1b { z6.b }, p4/Z, [x9]\n"
688       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
689       "ble 49f\n"
690       "48:"  // Height 5: Multiply loop: Main loop
691       "sdot z8.s, z6.b, z0.b\n"
692       "sdot z12.s, z6.b, z1.b\n"
693       "add x25, x25, #0x4\n"
694       "subs x26, x26, #0x4\n"
695       "sdot z16.s, z6.b, z2.b\n"
696       "sdot z20.s, z6.b, z3.b\n"
697       "add x24, x24, #0x4\n"
698       "add x23, x23, #0x4\n"
699       "sdot z24.s, z6.b, z4.b\n"
700       "sdot z9.s, z7.b, z0.b\n"
701       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
702       "add x22, x22, #0x4\n"
703       "sdot z13.s, z7.b, z1.b\n"
704       "sdot z17.s, z7.b, z2.b\n"
705       "add x21, x21, #0x4\n"
706       "sdot z21.s, z7.b, z3.b\n"
707       "sdot z25.s, z7.b, z4.b\n"
708       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
709       "addvl x9, x9, #4\n"
710       "sdot z10.s, z6.b, z0.b\n"
711       "sdot z14.s, z6.b, z1.b\n"
712       "sdot z18.s, z6.b, z2.b\n"
713       "sdot z22.s, z6.b, z3.b\n"
714       "sdot z26.s, z6.b, z4.b\n"
715       "sdot z11.s, z7.b, z0.b\n"
716       "ld1rw { z0.s }, p4/Z, [x25]\n"
717       "ld1b { z6.b }, p4/Z, [x9]\n"
718       "sdot z15.s, z7.b, z1.b\n"
719       "sdot z19.s, z7.b, z2.b\n"
720       "ld1rw { z1.s }, p4/Z, [x24]\n"
721       "ld1rw { z2.s }, p4/Z, [x23]\n"
722       "sdot z23.s, z7.b, z3.b\n"
723       "sdot z27.s, z7.b, z4.b\n"
724       "ld1rw { z3.s }, p4/Z, [x22]\n"
725       "ld1rw { z4.s }, p4/Z, [x21]\n"
726       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
727       "bgt 48b\n"
728       "49:"  // Height 5: Multiply loop: Main loop skip
729       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
730       "sdot z8.s, z6.b, z0.b\n"
731       "sdot z12.s, z6.b, z1.b\n"
732       "add x27, x27, #0x1\n"
733       "sdot z16.s, z6.b, z2.b\n"
734       "sdot z20.s, z6.b, z3.b\n"
735       "cmp x27, x19\n"
736       "sdot z24.s, z6.b, z4.b\n"
737       "sdot z9.s, z7.b, z0.b\n"
738       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
739       "sdot z13.s, z7.b, z1.b\n"
740       "sdot z17.s, z7.b, z2.b\n"
741       "sdot z21.s, z7.b, z3.b\n"
742       "sdot z25.s, z7.b, z4.b\n"
743       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
744       "addvl x9, x9, #4\n"
745       "sdot z10.s, z6.b, z0.b\n"
746       "sdot z14.s, z6.b, z1.b\n"
747       "sdot z18.s, z6.b, z2.b\n"
748       "sdot z22.s, z6.b, z3.b\n"
749       "sdot z26.s, z6.b, z4.b\n"
750       "sdot z11.s, z7.b, z0.b\n"
751       "sdot z15.s, z7.b, z1.b\n"
752       "sdot z19.s, z7.b, z2.b\n"
753       "sdot z23.s, z7.b, z3.b\n"
754       "sdot z27.s, z7.b, z4.b\n"
755       "bne 45b\n"
756       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
757       "add x23, x28, x19, LSL #2\n"
758       "add x22, x23, x19, LSL #2\n"
759       "st1w { z8.s }, p3, [x28]\n"
760       "add x21, x22, x19, LSL #2\n"
761       "add x20, x21, x19, LSL #2\n"
762       "st1w { z9.s }, p2, [x28, #1, MUL VL]\n"
763       "st1w { z10.s }, p1, [x28, #2, MUL VL]\n"
764       "st1w { z11.s }, p0, [x28, #3, MUL VL]\n"
765       "addvl x28, x28, #4\n"
766       "st1w { z12.s }, p3, [x23]\n"
767       "st1w { z13.s }, p2, [x23, #1, MUL VL]\n"
768       "st1w { z14.s }, p1, [x23, #2, MUL VL]\n"
769       "st1w { z15.s }, p0, [x23, #3, MUL VL]\n"
770       "st1w { z16.s }, p3, [x22]\n"
771       "st1w { z17.s }, p2, [x22, #1, MUL VL]\n"
772       "st1w { z18.s }, p1, [x22, #2, MUL VL]\n"
773       "st1w { z19.s }, p0, [x22, #3, MUL VL]\n"
774       "st1w { z20.s }, p3, [x21]\n"
775       "st1w { z21.s }, p2, [x21, #1, MUL VL]\n"
776       "st1w { z22.s }, p1, [x21, #2, MUL VL]\n"
777       "st1w { z23.s }, p0, [x21, #3, MUL VL]\n"
778       "st1w { z24.s }, p3, [x20]\n"
779       "st1w { z25.s }, p2, [x20, #1, MUL VL]\n"
780       "st1w { z26.s }, p1, [x20, #2, MUL VL]\n"
781       "st1w { z27.s }, p0, [x20, #3, MUL VL]\n"
782       "50:"  // Height 5: Writeback done
783       "decw x10, ALL, MUL #4\n"
784       "cmp x10, XZR\n"
785       "bgt 42b\n"
786       "b 62f\n"
787       "51:"  // Height 6
788       "ldr x20, [%x[args_ptr], %[offsetof_output_offset]]\n"
789       "mov x19, #0x18\n"
790       "ldr x10, [%x[args_ptr], %[offsetof_N]]\n"
791       "mov x28, %x[output_ptr]\n"
792       "ldr x9, [%x[args_ptr], %[offsetof_B_ptr]]\n"
793       "madd %x[output_ptr], x20, x19, %x[output_ptr]\n"
794       "52:"  // Height 6: Column loop
795       "mov x19, #0x0\n"
796       "whilelt p3.s, x19, x10\n"
797       "incw x19\n"
798       "whilelt p2.s, x19, x10\n"
799       "incw x19\n"
800       "whilelt p1.s, x19, x10\n"
801       "incw x19\n"
802       "whilelt p0.s, x19, x10\n"
803       "tbz %x[flags], #0, 53f\n"
804       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
805       "add x23, x28, x19, LSL #2\n"
806       "add x22, x23, x19, LSL #2\n"
807       "ld1w { z8.s }, p3/Z, [x28]\n"
808       "ld1w { z9.s }, p2/Z, [x28, #1, MUL VL]\n"
809       "add x21, x22, x19, LSL #2\n"
810       "add x20, x21, x19, LSL #2\n"
811       "ld1w { z10.s }, p1/Z, [x28, #2, MUL VL]\n"
812       "ld1w { z11.s }, p0/Z, [x28, #3, MUL VL]\n"
813       "add x19, x20, x19, LSL #2\n"
814       "ld1w { z12.s }, p3/Z, [x23]\n"
815       "ld1w { z13.s }, p2/Z, [x23, #1, MUL VL]\n"
816       "ld1w { z14.s }, p1/Z, [x23, #2, MUL VL]\n"
817       "ld1w { z15.s }, p0/Z, [x23, #3, MUL VL]\n"
818       "ld1w { z16.s }, p3/Z, [x22]\n"
819       "ld1w { z17.s }, p2/Z, [x22, #1, MUL VL]\n"
820       "ld1w { z18.s }, p1/Z, [x22, #2, MUL VL]\n"
821       "ld1w { z19.s }, p0/Z, [x22, #3, MUL VL]\n"
822       "ld1w { z20.s }, p3/Z, [x21]\n"
823       "ld1w { z21.s }, p2/Z, [x21, #1, MUL VL]\n"
824       "ld1w { z22.s }, p1/Z, [x21, #2, MUL VL]\n"
825       "ld1w { z23.s }, p0/Z, [x21, #3, MUL VL]\n"
826       "ld1w { z24.s }, p3/Z, [x20]\n"
827       "ld1w { z25.s }, p2/Z, [x20, #1, MUL VL]\n"
828       "ld1w { z26.s }, p1/Z, [x20, #2, MUL VL]\n"
829       "ld1w { z27.s }, p0/Z, [x20, #3, MUL VL]\n"
830       "ld1w { z28.s }, p3/Z, [x19]\n"
831       "ld1w { z29.s }, p2/Z, [x19, #1, MUL VL]\n"
832       "ld1w { z30.s }, p1/Z, [x19, #2, MUL VL]\n"
833       "ld1w { z31.s }, p0/Z, [x19, #3, MUL VL]\n"
834       "b 54f\n"
835       "53:"  // Height 6: no accumulate
836       "mov z8.s, #0x0\n"
837       "mov z9.s, #0x0\n"
838       "mov z10.s, #0x0\n"
839       "mov z11.s, #0x0\n"
840       "mov z12.s, #0x0\n"
841       "mov z13.s, #0x0\n"
842       "mov z14.s, #0x0\n"
843       "mov z15.s, #0x0\n"
844       "mov z16.s, #0x0\n"
845       "mov z17.s, #0x0\n"
846       "mov z18.s, #0x0\n"
847       "mov z19.s, #0x0\n"
848       "mov z20.s, #0x0\n"
849       "mov z21.s, #0x0\n"
850       "mov z22.s, #0x0\n"
851       "mov z23.s, #0x0\n"
852       "mov z24.s, #0x0\n"
853       "mov z25.s, #0x0\n"
854       "mov z26.s, #0x0\n"
855       "mov z27.s, #0x0\n"
856       "mov z28.s, #0x0\n"
857       "mov z29.s, #0x0\n"
858       "mov z30.s, #0x0\n"
859       "mov z31.s, #0x0\n"
860       "54:"  // Height 6: setup done
861       "mov x27, #0x0\n"
862       "55:"  // Height 6: String loop
863       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
864       "ldr w26, [x19, x27, LSL #0x2]\n"
865       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
866       "tbz %x[flags], #3, 56f\n"
867       "ldr x20, [%x[input_ptr], x27, LSL #0x3]\n"
868       "add x20, x20, x19, LSL #3\n"
869       "ldr x25, [x20, #0x0]\n"
870       "ldr x24, [x20, #0x8]\n"
871       "ldr x23, [x20, #0x10]\n"
872       "ldr x22, [x20, #0x18]\n"
873       "ldr x21, [x20, #0x20]\n"
874       "ldr x20, [x20, #0x28]\n"
875       "cbnz x27, 57f\n"
876       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
877       "add x25, x25, x19\n"
878       "add x24, x24, x19\n"
879       "add x23, x23, x19\n"
880       "add x22, x22, x19\n"
881       "add x21, x21, x19\n"
882       "add x20, x20, x19\n"
883       "b 57f\n"
884       "56:"  // Height 6: setup direct input
885       "mov x25, %x[input_ptr]\n"
886       "add x24, x25, x19\n"
887       "add x23, x24, x19\n"
888       "add x22, x23, x19\n"
889       "add x21, x22, x19\n"
890       "add x20, x21, x19\n"
891       "57:"  // Height 6: input setup done
892       "subs x26, x26, #0x4\n"
893       "ld1rw { z0.s }, p4/Z, [x25]\n"
894       "ld1rw { z1.s }, p4/Z, [x24]\n"
895       "ld1rw { z2.s }, p4/Z, [x23]\n"
896       "ld1rw { z3.s }, p4/Z, [x22]\n"
897       "ld1rw { z4.s }, p4/Z, [x21]\n"
898       "ld1rw { z5.s }, p4/Z, [x20]\n"
899       "ld1b { z6.b }, p4/Z, [x9]\n"
900       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
901       "ble 59f\n"
902       "58:"  // Height 6: Multiply loop: Main loop
903       "sdot z8.s, z6.b, z0.b\n"
904       "sdot z12.s, z6.b, z1.b\n"
905       "add x25, x25, #0x4\n"
906       "subs x26, x26, #0x4\n"
907       "sdot z16.s, z6.b, z2.b\n"
908       "sdot z20.s, z6.b, z3.b\n"
909       "add x24, x24, #0x4\n"
910       "add x23, x23, #0x4\n"
911       "sdot z24.s, z6.b, z4.b\n"
912       "sdot z28.s, z6.b, z5.b\n"
913       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
914       "add x22, x22, #0x4\n"
915       "sdot z9.s, z7.b, z0.b\n"
916       "sdot z13.s, z7.b, z1.b\n"
917       "add x21, x21, #0x4\n"
918       "add x20, x20, #0x4\n"
919       "sdot z17.s, z7.b, z2.b\n"
920       "sdot z21.s, z7.b, z3.b\n"
921       "sdot z25.s, z7.b, z4.b\n"
922       "sdot z29.s, z7.b, z5.b\n"
923       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
924       "addvl x9, x9, #4\n"
925       "sdot z10.s, z6.b, z0.b\n"
926       "sdot z14.s, z6.b, z1.b\n"
927       "sdot z18.s, z6.b, z2.b\n"
928       "sdot z22.s, z6.b, z3.b\n"
929       "sdot z26.s, z6.b, z4.b\n"
930       "sdot z30.s, z6.b, z5.b\n"
931       "ld1b { z6.b }, p4/Z, [x9]\n"
932       "sdot z11.s, z7.b, z0.b\n"
933       "sdot z15.s, z7.b, z1.b\n"
934       "ld1rw { z0.s }, p4/Z, [x25]\n"
935       "ld1rw { z1.s }, p4/Z, [x24]\n"
936       "sdot z19.s, z7.b, z2.b\n"
937       "sdot z23.s, z7.b, z3.b\n"
938       "ld1rw { z2.s }, p4/Z, [x23]\n"
939       "ld1rw { z3.s }, p4/Z, [x22]\n"
940       "sdot z27.s, z7.b, z4.b\n"
941       "sdot z31.s, z7.b, z5.b\n"
942       "ld1rw { z4.s }, p4/Z, [x21]\n"
943       "ld1rw { z5.s }, p4/Z, [x20]\n"
944       "ld1b { z7.b }, p4/Z, [x9, #1, MUL VL]\n"
945       "bgt 58b\n"
946       "59:"  // Height 6: Multiply loop: Main loop skip
947       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
948       "sdot z8.s, z6.b, z0.b\n"
949       "sdot z12.s, z6.b, z1.b\n"
950       "add x27, x27, #0x1\n"
951       "sdot z16.s, z6.b, z2.b\n"
952       "sdot z20.s, z6.b, z3.b\n"
953       "cmp x27, x19\n"
954       "sdot z24.s, z6.b, z4.b\n"
955       "sdot z28.s, z6.b, z5.b\n"
956       "ld1b { z6.b }, p4/Z, [x9, #2, MUL VL]\n"
957       "sdot z9.s, z7.b, z0.b\n"
958       "sdot z13.s, z7.b, z1.b\n"
959       "sdot z17.s, z7.b, z2.b\n"
960       "sdot z21.s, z7.b, z3.b\n"
961       "sdot z25.s, z7.b, z4.b\n"
962       "sdot z29.s, z7.b, z5.b\n"
963       "ld1b { z7.b }, p4/Z, [x9, #3, MUL VL]\n"
964       "addvl x9, x9, #4\n"
965       "sdot z10.s, z6.b, z0.b\n"
966       "sdot z14.s, z6.b, z1.b\n"
967       "sdot z18.s, z6.b, z2.b\n"
968       "sdot z22.s, z6.b, z3.b\n"
969       "sdot z26.s, z6.b, z4.b\n"
970       "sdot z30.s, z6.b, z5.b\n"
971       "sdot z11.s, z7.b, z0.b\n"
972       "sdot z15.s, z7.b, z1.b\n"
973       "sdot z19.s, z7.b, z2.b\n"
974       "sdot z23.s, z7.b, z3.b\n"
975       "sdot z27.s, z7.b, z4.b\n"
976       "sdot z31.s, z7.b, z5.b\n"
977       "bne 55b\n"
978       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
979       "add x23, x28, x19, LSL #2\n"
980       "add x22, x23, x19, LSL #2\n"
981       "st1w { z8.s }, p3, [x28]\n"
982       "add x21, x22, x19, LSL #2\n"
983       "add x20, x21, x19, LSL #2\n"
984       "st1w { z9.s }, p2, [x28, #1, MUL VL]\n"
985       "add x19, x20, x19, LSL #2\n"
986       "st1w { z10.s }, p1, [x28, #2, MUL VL]\n"
987       "st1w { z11.s }, p0, [x28, #3, MUL VL]\n"
988       "addvl x28, x28, #4\n"
989       "st1w { z12.s }, p3, [x23]\n"
990       "st1w { z13.s }, p2, [x23, #1, MUL VL]\n"
991       "st1w { z14.s }, p1, [x23, #2, MUL VL]\n"
992       "st1w { z15.s }, p0, [x23, #3, MUL VL]\n"
993       "st1w { z16.s }, p3, [x22]\n"
994       "st1w { z17.s }, p2, [x22, #1, MUL VL]\n"
995       "st1w { z18.s }, p1, [x22, #2, MUL VL]\n"
996       "st1w { z19.s }, p0, [x22, #3, MUL VL]\n"
997       "st1w { z20.s }, p3, [x21]\n"
998       "st1w { z21.s }, p2, [x21, #1, MUL VL]\n"
999       "st1w { z22.s }, p1, [x21, #2, MUL VL]\n"
1000       "st1w { z23.s }, p0, [x21, #3, MUL VL]\n"
1001       "st1w { z24.s }, p3, [x20]\n"
1002       "st1w { z25.s }, p2, [x20, #1, MUL VL]\n"
1003       "st1w { z26.s }, p1, [x20, #2, MUL VL]\n"
1004       "st1w { z27.s }, p0, [x20, #3, MUL VL]\n"
1005       "st1w { z28.s }, p3, [x19]\n"
1006       "st1w { z29.s }, p2, [x19, #1, MUL VL]\n"
1007       "st1w { z30.s }, p1, [x19, #2, MUL VL]\n"
1008       "st1w { z31.s }, p0, [x19, #3, MUL VL]\n"
1009       "60:"  // Height 6: Writeback done
1010       "decw x10, ALL, MUL #4\n"
1011       "cmp x10, XZR\n"
1012       "bgt 52b\n"
1013       "subs %x[M], %x[M], #0x6\n"
1014       "beq 62f\n"
1015       "ldr x20, [%x[args_ptr], %[offsetof_input_offset]]\n"
1016       "tbz %x[flags], #3, 61f\n"
1017       "add x20, x20, #0x6\n"
1018       "str x20, [%x[args_ptr], %[offsetof_input_offset]]\n"
1019       "b 1b\n"
1020       "61:"  // Update direct input
1021       "mov x19, #0x6\n"
1022       "madd %x[input_ptr], x19, x20, %x[input_ptr]\n"
1023       "b 1b\n"
1024       "62:"  // Exit
1025 
1026       : [M] "+&r" (M), [input_ptr] "+&r" (input_ptr), [output_ptr] "+&r" (output_ptr)
1027       : [args_ptr] "r" (&ka), [flags] "r" (flags), [offsetof_B_ptr] "I" (offsetof(KernelArgs, B_ptr)), [offsetof_N] "I" (offsetof(KernelArgs, N)), [offsetof_input_initial_col] "I" (offsetof(KernelArgs, input_initial_col)), [offsetof_input_offset] "I" (offsetof(KernelArgs, input_offset)), [offsetof_num_strings] "I" (offsetof(KernelArgs, num_strings)), [offsetof_output_offset] "I" (offsetof(KernelArgs, output_offset)), [offsetof_string_lengths] "I" (offsetof(KernelArgs, string_lengths))
1028       : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "x9", "x10", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "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"
1029     );
1030 }
1031 
1032 } // namespace arm_gemm
1033 #endif // ARM_COMPUTE_ENABLE_SVE
1034