• 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 #include "../../bfloat.hpp"
29 
30 #include <cassert>
31 #include <limits>
32 
33 namespace arm_gemm {
34 
sve_hybrid_fp32bf16fp32_mmla_4x6VL(unsigned int num_strings,const unsigned int * string_lengths,IndirectInputArg<float> A_arg,size_t M,size_t N,const bfloat16 * B_ptr,IndirectOutputArg<float> output_arg,const float * bias,Activation act,bool accumulate)35 void sve_hybrid_fp32bf16fp32_mmla_4x6VL (
36     unsigned int num_strings, const unsigned int *string_lengths, IndirectInputArg<float> A_arg,
37     size_t M, size_t N, const bfloat16 *B_ptr, IndirectOutputArg<float> output_arg,
38     const float *bias, Activation act, bool accumulate
39 )
40 {
41     struct KernelArgs {
42         float maxval = static_cast<float>(std::numeric_limits<float>::infinity());
43         float minval = - static_cast<float>(std::numeric_limits<float>::infinity());
44         unsigned int num_strings = {};
45         const unsigned int *string_lengths = {};
46         size_t N = {};
47         const bfloat16 *B_ptr = {};
48         size_t output_offset = {};
49         size_t input_initial_col = {};
50         size_t input_offset = {};
51     } ka;
52 
53     unsigned long flags=0;
54     void *output_ptr;
55     void *input_ptr;
56 
57     if (output_arg.is_indirect) {
58         output_ptr=(void *)(output_arg.indirect.ptr);
59         ka.output_offset=output_arg.indirect.offset;
60         flags |= 0x4;
61     } else {
62         output_ptr=(void *)(output_arg.direct.base);
63         ka.output_offset=output_arg.direct.stride;
64     }
65 
66     if (A_arg.is_indirect) {
67         input_ptr=(void *)(A_arg.indirect.ptr);
68         ka.input_offset=A_arg.indirect.start_row;
69         ka.input_initial_col=A_arg.indirect.start_col;
70         flags |= 0x8;
71     } else {
72         assert(num_strings==1);
73         input_ptr=(void *)(A_arg.direct.base);
74         ka.input_offset=A_arg.direct.stride;
75     }
76     if (accumulate) {
77         flags |= 0x1;
78     }
79     ka.num_strings = num_strings;
80     ka.string_lengths = string_lengths;
81     ka.N = N;
82     ka.B_ptr = B_ptr;
83     switch(act.type) {
84         default:
85         case Activation::Type::None:
86             break;
87         case Activation::Type::BoundedReLU:
88             ka.maxval = static_cast<float>(act.param1);
89             /* fall through */
90         case Activation::Type::ReLU:
91             ka.minval = 0;
92             flags |= 0x2;
93             break;
94     }
95     __asm__ __volatile__(
96       "ptrue p7.b\n"
97       "1:"  // Row loop
98       "cmp %x[M], #0x4\n"
99       "bge 40f\n"
100       "cmp %x[M], #0x2\n"
101       "bgt 27f\n"
102       "beq 14f\n"
103       "mov x9, %x[bias]\n"
104       "ldr x28, [%x[args_ptr], %[offsetof_N]]\n"
105       "ldr x27, [%x[args_ptr], %[offsetof_B_ptr]]\n"
106       "mov x26, %x[output_ptr]\n"
107       "2:"  // Height 1: Column loop
108       "mov x19, #0x0\n"
109       "whilelt p6.s, x19, x28\n"
110       "incw x19\n"
111       "whilelt p5.s, x19, x28\n"
112       "incw x19\n"
113       "whilelt p4.s, x19, x28\n"
114       "incw x19\n"
115       "whilelt p3.s, x19, x28\n"
116       "incw x19\n"
117       "whilelt p2.s, x19, x28\n"
118       "incw x19\n"
119       "whilelt p1.s, x19, x28\n"
120       "cbz x9, 3f\n"
121       "ld1w { z8.s }, p7/Z, [x9]\n"
122       "ld1w { z9.s }, p7/Z, [x9, #1, MUL VL]\n"
123       "ld1w { z10.s }, p7/Z, [x9, #2, MUL VL]\n"
124       "zip2 z14.d, z8.d, z8.d\n"
125       "zip1 z8.d, z8.d, z8.d\n"
126       "ld1w { z11.s }, p7/Z, [x9, #3, MUL VL]\n"
127       "ld1w { z12.s }, p7/Z, [x9, #4, MUL VL]\n"
128       "zip2 z15.d, z9.d, z9.d\n"
129       "zip1 z9.d, z9.d, z9.d\n"
130       "ld1w { z13.s }, p7/Z, [x9, #5, MUL VL]\n"
131       "zip2 z16.d, z10.d, z10.d\n"
132       "zip1 z10.d, z10.d, z10.d\n"
133       "addvl x9, x9, #6\n"
134       "zip2 z17.d, z11.d, z11.d\n"
135       "zip1 z11.d, z11.d, z11.d\n"
136       "zip2 z18.d, z12.d, z12.d\n"
137       "zip1 z12.d, z12.d, z12.d\n"
138       "zip2 z19.d, z13.d, z13.d\n"
139       "zip1 z13.d, z13.d, z13.d\n"
140       "b 5f\n"
141       "3:"  // Height 1: no bias
142       "tbz %x[flags], #0, 4f\n"
143       "ld1w { z9.s }, p6/Z, [x26]\n"
144       "ld1w { z10.s }, p5/Z, [x26, #1, MUL VL]\n"
145       "zip1 z8.d, z9.d, z14.d\n"
146       "ld1w { z11.s }, p4/Z, [x26, #2, MUL VL]\n"
147       "ld1w { z12.s }, p3/Z, [x26, #3, MUL VL]\n"
148       "zip2 z14.d, z9.d, z14.d\n"
149       "zip1 z9.d, z10.d, z15.d\n"
150       "ld1w { z13.s }, p2/Z, [x26, #4, MUL VL]\n"
151       "ld1w { z20.s }, p1/Z, [x26, #5, MUL VL]\n"
152       "zip2 z15.d, z10.d, z15.d\n"
153       "zip1 z10.d, z11.d, z16.d\n"
154       "zip2 z16.d, z11.d, z16.d\n"
155       "zip1 z11.d, z12.d, z17.d\n"
156       "zip2 z17.d, z12.d, z17.d\n"
157       "zip1 z12.d, z13.d, z18.d\n"
158       "zip2 z18.d, z13.d, z18.d\n"
159       "zip1 z13.d, z20.d, z19.d\n"
160       "zip2 z19.d, z20.d, z19.d\n"
161       "b 5f\n"
162       "4:"  // Height 1: no accumulate
163       "mov z8.b, #0x0\n"
164       "mov z9.b, #0x0\n"
165       "mov z10.b, #0x0\n"
166       "mov z11.b, #0x0\n"
167       "mov z12.b, #0x0\n"
168       "mov z13.b, #0x0\n"
169       "mov z14.b, #0x0\n"
170       "mov z15.b, #0x0\n"
171       "mov z16.b, #0x0\n"
172       "mov z17.b, #0x0\n"
173       "mov z18.b, #0x0\n"
174       "mov z19.b, #0x0\n"
175       "5:"  // Height 1: setup done
176       "mov x25, #0x0\n"
177       "6:"  // Height 1: String loop
178       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
179       "ldr w24, [x19, x25, LSL #0x2]\n"
180       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
181       "tbz %x[flags], #3, 7f\n"
182       "ldr x20, [%x[input_ptr], x25, LSL #0x3]\n"
183       "add x20, x20, x19, LSL #3\n"
184       "ldr x23, [x20, #0x0]\n"
185       "cbnz x25, 8f\n"
186       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
187       "add x23, x23, x19, LSL #2\n"
188       "b 8f\n"
189       "7:"  // Height 1: setup direct input
190       "mov x23, %x[input_ptr]\n"
191       "8:"  // Height 1: input setup done
192       "cmp x24, #0x4\n"
193       "ble 10f\n"
194       "9:"  // Height 1: Multiply loop: Main loop head
195       "whilelt p0.s, XZR, x24\n"
196       "ld1rqw { z0.s }, p0/Z, [x23]\n"
197       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
198       "uzp1 z0.h, z0.h, z0.h\n"
199       "ld1h { z4.h }, p7/Z, [x27]\n"
200       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
201       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
202       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
203       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
204       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
205       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
206       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
207       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
208       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
209       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
210       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
211       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
212       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
213       "addvl x27, x27, #16\n"
214       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
215       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
216       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
217       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
218       "sub x24, x24, #0x4\n"
219       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
220       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
221       "cmp x24, #0x4\n"
222       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
223       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
224       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
225       "add x23, x23, #0x10\n"
226       "addvl x27, x27, #-4\n"
227       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
228       "bgt 9b\n"
229       "10:"  // Height 1: Multiply loop: Single iteration only
230       "whilelt p0.s, XZR, x24\n"
231       "ld1rqw { z0.s }, p0/Z, [x23]\n"
232       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
233       "uzp1 z0.h, z0.h, z0.h\n"
234       "ld1h { z4.h }, p7/Z, [x27]\n"
235       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
236       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
237       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
238       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
239       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
240       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
241       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
242       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
243       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
244       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
245       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
246       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
247       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
248       "addvl x27, x27, #16\n"
249       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
250       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
251       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
252       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
253       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
254       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
255       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
256       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
257       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
258       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
259       "addvl x27, x27, #-4\n"
260       "11:"  // Height 1: Multiply loop: multiply skip
261       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
262       "add x25, x25, #0x1\n"
263       "cmp x25, x19\n"
264       "bne 6b\n"
265       "uzp1 z8.d, z8.d, z14.d\n"
266       "uzp1 z9.d, z9.d, z15.d\n"
267       "uzp1 z10.d, z10.d, z16.d\n"
268       "uzp1 z11.d, z11.d, z17.d\n"
269       "uzp1 z12.d, z12.d, z18.d\n"
270       "uzp1 z13.d, z13.d, z19.d\n"
271       "tbz %x[flags], #1, 12f\n"
272       "add x19, %x[args_ptr], %[offset_max]\n"
273       "ld1rw { z1.s }, p7/Z, [x19]\n"
274       "add x19, %x[args_ptr], %[offset_min]\n"
275       "ld1rw { z0.s }, p7/Z, [x19]\n"
276       "fmin z8.s, p7/M, z8.s, z1.s\n"
277       "fmin z9.s, p7/M, z9.s, z1.s\n"
278       "fmin z10.s, p7/M, z10.s, z1.s\n"
279       "fmin z11.s, p7/M, z11.s, z1.s\n"
280       "fmin z12.s, p7/M, z12.s, z1.s\n"
281       "fmin z13.s, p7/M, z13.s, z1.s\n"
282       "fmax z8.s, p7/M, z8.s, z0.s\n"
283       "fmax z9.s, p7/M, z9.s, z0.s\n"
284       "fmax z10.s, p7/M, z10.s, z0.s\n"
285       "fmax z11.s, p7/M, z11.s, z0.s\n"
286       "fmax z12.s, p7/M, z12.s, z0.s\n"
287       "fmax z13.s, p7/M, z13.s, z0.s\n"
288       "12:"  // Height 1: No activation
289       "st1w { z8.s }, p6, [x26]\n"
290       "st1w { z9.s }, p5, [x26, #1, MUL VL]\n"
291       "st1w { z10.s }, p4, [x26, #2, MUL VL]\n"
292       "st1w { z11.s }, p3, [x26, #3, MUL VL]\n"
293       "st1w { z12.s }, p2, [x26, #4, MUL VL]\n"
294       "st1w { z13.s }, p1, [x26, #5, MUL VL]\n"
295       "addvl x26, x26, #6\n"
296       "13:"  // Height 1: Writeback done
297       "decw x28, ALL, MUL #6\n"
298       "cmp x28, XZR\n"
299       "bgt 2b\n"
300       "b 54f\n"
301       "14:"  // Height 2
302       "mov x9, %x[bias]\n"
303       "ldr x28, [%x[args_ptr], %[offsetof_N]]\n"
304       "ldr x27, [%x[args_ptr], %[offsetof_B_ptr]]\n"
305       "mov x26, %x[output_ptr]\n"
306       "15:"  // Height 2: Column loop
307       "mov x19, #0x0\n"
308       "whilelt p6.s, x19, x28\n"
309       "incw x19\n"
310       "whilelt p5.s, x19, x28\n"
311       "incw x19\n"
312       "whilelt p4.s, x19, x28\n"
313       "incw x19\n"
314       "whilelt p3.s, x19, x28\n"
315       "incw x19\n"
316       "whilelt p2.s, x19, x28\n"
317       "incw x19\n"
318       "whilelt p1.s, x19, x28\n"
319       "cbz x9, 16f\n"
320       "ld1w { z8.s }, p7/Z, [x9]\n"
321       "ld1w { z9.s }, p7/Z, [x9, #1, MUL VL]\n"
322       "ld1w { z10.s }, p7/Z, [x9, #2, MUL VL]\n"
323       "zip2 z14.d, z8.d, z8.d\n"
324       "zip1 z8.d, z8.d, z8.d\n"
325       "ld1w { z11.s }, p7/Z, [x9, #3, MUL VL]\n"
326       "ld1w { z12.s }, p7/Z, [x9, #4, MUL VL]\n"
327       "zip2 z15.d, z9.d, z9.d\n"
328       "zip1 z9.d, z9.d, z9.d\n"
329       "ld1w { z13.s }, p7/Z, [x9, #5, MUL VL]\n"
330       "zip2 z16.d, z10.d, z10.d\n"
331       "zip1 z10.d, z10.d, z10.d\n"
332       "addvl x9, x9, #6\n"
333       "zip2 z17.d, z11.d, z11.d\n"
334       "zip1 z11.d, z11.d, z11.d\n"
335       "zip2 z18.d, z12.d, z12.d\n"
336       "zip1 z12.d, z12.d, z12.d\n"
337       "zip2 z19.d, z13.d, z13.d\n"
338       "zip1 z13.d, z13.d, z13.d\n"
339       "b 18f\n"
340       "16:"  // Height 2: no bias
341       "tbz %x[flags], #0, 17f\n"
342       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
343       "add x22, x26, x19, LSL #2\n"
344       "ld1w { z9.s }, p6/Z, [x26]\n"
345       "ld1w { z10.s }, p5/Z, [x26, #1, MUL VL]\n"
346       "ld1w { z11.s }, p4/Z, [x26, #2, MUL VL]\n"
347       "ld1w { z12.s }, p3/Z, [x26, #3, MUL VL]\n"
348       "ld1w { z13.s }, p2/Z, [x26, #4, MUL VL]\n"
349       "ld1w { z20.s }, p1/Z, [x26, #5, MUL VL]\n"
350       "ld1w { z14.s }, p6/Z, [x22]\n"
351       "zip1 z8.d, z9.d, z14.d\n"
352       "zip2 z14.d, z9.d, z14.d\n"
353       "ld1w { z15.s }, p5/Z, [x22, #1, MUL VL]\n"
354       "ld1w { z16.s }, p4/Z, [x22, #2, MUL VL]\n"
355       "zip1 z9.d, z10.d, z15.d\n"
356       "zip2 z15.d, z10.d, z15.d\n"
357       "ld1w { z17.s }, p3/Z, [x22, #3, MUL VL]\n"
358       "ld1w { z18.s }, p2/Z, [x22, #4, MUL VL]\n"
359       "zip1 z10.d, z11.d, z16.d\n"
360       "zip2 z16.d, z11.d, z16.d\n"
361       "ld1w { z19.s }, p1/Z, [x22, #5, MUL VL]\n"
362       "zip1 z11.d, z12.d, z17.d\n"
363       "zip2 z17.d, z12.d, z17.d\n"
364       "zip1 z12.d, z13.d, z18.d\n"
365       "zip2 z18.d, z13.d, z18.d\n"
366       "zip1 z13.d, z20.d, z19.d\n"
367       "zip2 z19.d, z20.d, z19.d\n"
368       "b 18f\n"
369       "17:"  // Height 2: no accumulate
370       "mov z8.b, #0x0\n"
371       "mov z9.b, #0x0\n"
372       "mov z10.b, #0x0\n"
373       "mov z11.b, #0x0\n"
374       "mov z12.b, #0x0\n"
375       "mov z13.b, #0x0\n"
376       "mov z14.b, #0x0\n"
377       "mov z15.b, #0x0\n"
378       "mov z16.b, #0x0\n"
379       "mov z17.b, #0x0\n"
380       "mov z18.b, #0x0\n"
381       "mov z19.b, #0x0\n"
382       "18:"  // Height 2: setup done
383       "mov x25, #0x0\n"
384       "19:"  // Height 2: String loop
385       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
386       "ldr w24, [x19, x25, LSL #0x2]\n"
387       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
388       "tbz %x[flags], #3, 20f\n"
389       "ldr x20, [%x[input_ptr], x25, LSL #0x3]\n"
390       "add x20, x20, x19, LSL #3\n"
391       "ldr x23, [x20, #0x0]\n"
392       "ldr x22, [x20, #0x8]\n"
393       "cbnz x25, 21f\n"
394       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
395       "add x23, x23, x19, LSL #2\n"
396       "add x22, x22, x19, LSL #2\n"
397       "b 21f\n"
398       "20:"  // Height 2: setup direct input
399       "mov x23, %x[input_ptr]\n"
400       "add x22, x23, x19, LSL #2\n"
401       "21:"  // Height 2: input setup done
402       "cmp x24, #0x4\n"
403       "ble 23f\n"
404       "22:"  // Height 2: Multiply loop: Main loop head
405       "whilelt p0.s, XZR, x24\n"
406       "ld1rqw { z0.s }, p0/Z, [x23]\n"
407       "ld1rqw { z1.s }, p0/Z, [x22]\n"
408       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
409       ".inst 0x658abc21  // bfcvt z1.h, p7/M, z1.s\n"
410       "uzp1 z0.h, z0.h, z0.h\n"
411       "ld1h { z4.h }, p7/Z, [x27]\n"
412       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
413       "uzp1 z1.h, z1.h, z1.h\n"
414       "trn1 z0.d, z0.d, z1.d\n"
415       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
416       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
417       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
418       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
419       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
420       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
421       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
422       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
423       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
424       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
425       "addvl x27, x27, #16\n"
426       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
427       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
428       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
429       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
430       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
431       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
432       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
433       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
434       "sub x24, x24, #0x4\n"
435       "cmp x24, #0x4\n"
436       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
437       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
438       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
439       "add x23, x23, #0x10\n"
440       "add x22, x22, #0x10\n"
441       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
442       "addvl x27, x27, #-4\n"
443       "bgt 22b\n"
444       "23:"  // Height 2: Multiply loop: Single iteration only
445       "whilelt p0.s, XZR, x24\n"
446       "ld1rqw { z0.s }, p0/Z, [x23]\n"
447       "ld1rqw { z1.s }, p0/Z, [x22]\n"
448       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
449       ".inst 0x658abc21  // bfcvt z1.h, p7/M, z1.s\n"
450       "uzp1 z0.h, z0.h, z0.h\n"
451       "ld1h { z4.h }, p7/Z, [x27]\n"
452       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
453       "uzp1 z1.h, z1.h, z1.h\n"
454       "trn1 z0.d, z0.d, z1.d\n"
455       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
456       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
457       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
458       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
459       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
460       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
461       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
462       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
463       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
464       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
465       "addvl x27, x27, #16\n"
466       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
467       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
468       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
469       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
470       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
471       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
472       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
473       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
474       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
475       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
476       "addvl x27, x27, #-4\n"
477       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
478       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
479       "24:"  // Height 2: Multiply loop: multiply skip
480       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
481       "add x25, x25, #0x1\n"
482       "cmp x25, x19\n"
483       "bne 19b\n"
484       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
485       "uzp1 z4.d, z8.d, z14.d\n"
486       "uzp2 z8.d, z8.d, z14.d\n"
487       "add x22, x26, x19, LSL #2\n"
488       "uzp1 z14.d, z9.d, z15.d\n"
489       "uzp2 z9.d, z9.d, z15.d\n"
490       "uzp1 z15.d, z10.d, z16.d\n"
491       "uzp2 z10.d, z10.d, z16.d\n"
492       "uzp1 z16.d, z11.d, z17.d\n"
493       "uzp2 z11.d, z11.d, z17.d\n"
494       "uzp1 z17.d, z12.d, z18.d\n"
495       "uzp2 z12.d, z12.d, z18.d\n"
496       "uzp1 z18.d, z13.d, z19.d\n"
497       "uzp2 z13.d, z13.d, z19.d\n"
498       "tbz %x[flags], #1, 25f\n"
499       "add x19, %x[args_ptr], %[offset_max]\n"
500       "ld1rw { z1.s }, p7/Z, [x19]\n"
501       "add x19, %x[args_ptr], %[offset_min]\n"
502       "ld1rw { z0.s }, p7/Z, [x19]\n"
503       "fmin z4.s, p7/M, z4.s, z1.s\n"
504       "fmin z14.s, p7/M, z14.s, z1.s\n"
505       "fmin z15.s, p7/M, z15.s, z1.s\n"
506       "fmin z16.s, p7/M, z16.s, z1.s\n"
507       "fmin z17.s, p7/M, z17.s, z1.s\n"
508       "fmin z18.s, p7/M, z18.s, z1.s\n"
509       "fmin z8.s, p7/M, z8.s, z1.s\n"
510       "fmin z9.s, p7/M, z9.s, z1.s\n"
511       "fmin z10.s, p7/M, z10.s, z1.s\n"
512       "fmin z11.s, p7/M, z11.s, z1.s\n"
513       "fmin z12.s, p7/M, z12.s, z1.s\n"
514       "fmin z13.s, p7/M, z13.s, z1.s\n"
515       "fmax z4.s, p7/M, z4.s, z0.s\n"
516       "fmax z14.s, p7/M, z14.s, z0.s\n"
517       "fmax z15.s, p7/M, z15.s, z0.s\n"
518       "fmax z16.s, p7/M, z16.s, z0.s\n"
519       "fmax z17.s, p7/M, z17.s, z0.s\n"
520       "fmax z18.s, p7/M, z18.s, z0.s\n"
521       "fmax z8.s, p7/M, z8.s, z0.s\n"
522       "fmax z9.s, p7/M, z9.s, z0.s\n"
523       "fmax z10.s, p7/M, z10.s, z0.s\n"
524       "fmax z11.s, p7/M, z11.s, z0.s\n"
525       "fmax z12.s, p7/M, z12.s, z0.s\n"
526       "fmax z13.s, p7/M, z13.s, z0.s\n"
527       "25:"  // Height 2: No activation
528       "st1w { z4.s }, p6, [x26]\n"
529       "st1w { z14.s }, p5, [x26, #1, MUL VL]\n"
530       "st1w { z15.s }, p4, [x26, #2, MUL VL]\n"
531       "st1w { z16.s }, p3, [x26, #3, MUL VL]\n"
532       "st1w { z17.s }, p2, [x26, #4, MUL VL]\n"
533       "st1w { z18.s }, p1, [x26, #5, MUL VL]\n"
534       "addvl x26, x26, #6\n"
535       "st1w { z8.s }, p6, [x22]\n"
536       "st1w { z9.s }, p5, [x22, #1, MUL VL]\n"
537       "st1w { z10.s }, p4, [x22, #2, MUL VL]\n"
538       "st1w { z11.s }, p3, [x22, #3, MUL VL]\n"
539       "st1w { z12.s }, p2, [x22, #4, MUL VL]\n"
540       "st1w { z13.s }, p1, [x22, #5, MUL VL]\n"
541       "26:"  // Height 2: Writeback done
542       "decw x28, ALL, MUL #6\n"
543       "cmp x28, XZR\n"
544       "bgt 15b\n"
545       "b 54f\n"
546       "27:"  // Height 3
547       "mov x9, %x[bias]\n"
548       "ldr x28, [%x[args_ptr], %[offsetof_N]]\n"
549       "ldr x27, [%x[args_ptr], %[offsetof_B_ptr]]\n"
550       "mov x26, %x[output_ptr]\n"
551       "28:"  // Height 3: Column loop
552       "mov x19, #0x0\n"
553       "whilelt p6.s, x19, x28\n"
554       "incw x19\n"
555       "whilelt p5.s, x19, x28\n"
556       "incw x19\n"
557       "whilelt p4.s, x19, x28\n"
558       "incw x19\n"
559       "whilelt p3.s, x19, x28\n"
560       "incw x19\n"
561       "whilelt p2.s, x19, x28\n"
562       "incw x19\n"
563       "whilelt p1.s, x19, x28\n"
564       "cbz x9, 29f\n"
565       "ld1w { z8.s }, p7/Z, [x9]\n"
566       "ld1w { z9.s }, p7/Z, [x9, #1, MUL VL]\n"
567       "ld1w { z10.s }, p7/Z, [x9, #2, MUL VL]\n"
568       "zip2 z14.d, z8.d, z8.d\n"
569       "zip1 z8.d, z8.d, z8.d\n"
570       "ld1w { z11.s }, p7/Z, [x9, #3, MUL VL]\n"
571       "ld1w { z12.s }, p7/Z, [x9, #4, MUL VL]\n"
572       "zip2 z15.d, z9.d, z9.d\n"
573       "zip1 z9.d, z9.d, z9.d\n"
574       "ld1w { z13.s }, p7/Z, [x9, #5, MUL VL]\n"
575       "zip2 z16.d, z10.d, z10.d\n"
576       "zip1 z10.d, z10.d, z10.d\n"
577       "addvl x9, x9, #6\n"
578       "zip2 z17.d, z11.d, z11.d\n"
579       "zip1 z11.d, z11.d, z11.d\n"
580       "zip2 z18.d, z12.d, z12.d\n"
581       "zip1 z12.d, z12.d, z12.d\n"
582       "zip2 z19.d, z13.d, z13.d\n"
583       "zip1 z13.d, z13.d, z13.d\n"
584       "mov z20.d, z8.d\n"
585       "mov z26.d, z14.d\n"
586       "mov z21.d, z9.d\n"
587       "mov z27.d, z15.d\n"
588       "mov z22.d, z10.d\n"
589       "mov z28.d, z16.d\n"
590       "mov z23.d, z11.d\n"
591       "mov z29.d, z17.d\n"
592       "mov z24.d, z12.d\n"
593       "mov z30.d, z18.d\n"
594       "mov z25.d, z13.d\n"
595       "mov z31.d, z19.d\n"
596       "b 31f\n"
597       "29:"  // Height 3: no bias
598       "tbz %x[flags], #0, 30f\n"
599       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
600       "add x22, x26, x19, LSL #2\n"
601       "add x21, x22, x19, LSL #2\n"
602       "ld1w { z9.s }, p6/Z, [x26]\n"
603       "ld1w { z10.s }, p5/Z, [x26, #1, MUL VL]\n"
604       "ld1w { z11.s }, p4/Z, [x26, #2, MUL VL]\n"
605       "ld1w { z12.s }, p3/Z, [x26, #3, MUL VL]\n"
606       "ld1w { z13.s }, p2/Z, [x26, #4, MUL VL]\n"
607       "ld1w { z20.s }, p1/Z, [x26, #5, MUL VL]\n"
608       "ld1w { z14.s }, p6/Z, [x22]\n"
609       "ld1w { z15.s }, p5/Z, [x22, #1, MUL VL]\n"
610       "zip1 z8.d, z9.d, z14.d\n"
611       "zip2 z14.d, z9.d, z14.d\n"
612       "ld1w { z16.s }, p4/Z, [x22, #2, MUL VL]\n"
613       "ld1w { z17.s }, p3/Z, [x22, #3, MUL VL]\n"
614       "zip1 z9.d, z10.d, z15.d\n"
615       "zip2 z15.d, z10.d, z15.d\n"
616       "ld1w { z18.s }, p2/Z, [x22, #4, MUL VL]\n"
617       "ld1w { z19.s }, p1/Z, [x22, #5, MUL VL]\n"
618       "zip1 z10.d, z11.d, z16.d\n"
619       "zip2 z16.d, z11.d, z16.d\n"
620       "ld1w { z21.s }, p6/Z, [x21]\n"
621       "ld1w { z22.s }, p5/Z, [x21, #1, MUL VL]\n"
622       "zip1 z11.d, z12.d, z17.d\n"
623       "zip2 z17.d, z12.d, z17.d\n"
624       "ld1w { z23.s }, p4/Z, [x21, #2, MUL VL]\n"
625       "ld1w { z24.s }, p3/Z, [x21, #3, MUL VL]\n"
626       "zip1 z12.d, z13.d, z18.d\n"
627       "zip2 z18.d, z13.d, z18.d\n"
628       "ld1w { z25.s }, p2/Z, [x21, #4, MUL VL]\n"
629       "ld1w { z4.s }, p1/Z, [x21, #5, MUL VL]\n"
630       "zip1 z13.d, z20.d, z19.d\n"
631       "zip2 z19.d, z20.d, z19.d\n"
632       "zip1 z20.d, z21.d, z26.d\n"
633       "zip2 z26.d, z21.d, z26.d\n"
634       "zip1 z21.d, z22.d, z27.d\n"
635       "zip2 z27.d, z22.d, z27.d\n"
636       "zip1 z22.d, z23.d, z28.d\n"
637       "zip2 z28.d, z23.d, z28.d\n"
638       "zip1 z23.d, z24.d, z29.d\n"
639       "zip2 z29.d, z24.d, z29.d\n"
640       "zip1 z24.d, z25.d, z30.d\n"
641       "zip2 z30.d, z25.d, z30.d\n"
642       "zip1 z25.d, z4.d, z31.d\n"
643       "zip2 z31.d, z4.d, z31.d\n"
644       "b 31f\n"
645       "30:"  // Height 3: no accumulate
646       "mov z8.b, #0x0\n"
647       "mov z9.b, #0x0\n"
648       "mov z10.b, #0x0\n"
649       "mov z11.b, #0x0\n"
650       "mov z12.b, #0x0\n"
651       "mov z13.b, #0x0\n"
652       "mov z14.b, #0x0\n"
653       "mov z15.b, #0x0\n"
654       "mov z16.b, #0x0\n"
655       "mov z17.b, #0x0\n"
656       "mov z18.b, #0x0\n"
657       "mov z19.b, #0x0\n"
658       "mov z20.b, #0x0\n"
659       "mov z21.b, #0x0\n"
660       "mov z22.b, #0x0\n"
661       "mov z23.b, #0x0\n"
662       "mov z24.b, #0x0\n"
663       "mov z25.b, #0x0\n"
664       "mov z26.b, #0x0\n"
665       "mov z27.b, #0x0\n"
666       "mov z28.b, #0x0\n"
667       "mov z29.b, #0x0\n"
668       "mov z30.b, #0x0\n"
669       "mov z31.b, #0x0\n"
670       "31:"  // Height 3: setup done
671       "mov x25, #0x0\n"
672       "32:"  // Height 3: String loop
673       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
674       "ldr w24, [x19, x25, LSL #0x2]\n"
675       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
676       "tbz %x[flags], #3, 33f\n"
677       "ldr x20, [%x[input_ptr], x25, LSL #0x3]\n"
678       "add x20, x20, x19, LSL #3\n"
679       "ldr x23, [x20, #0x0]\n"
680       "ldr x22, [x20, #0x8]\n"
681       "ldr x21, [x20, #0x10]\n"
682       "cbnz x25, 34f\n"
683       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
684       "add x23, x23, x19, LSL #2\n"
685       "add x22, x22, x19, LSL #2\n"
686       "add x21, x21, x19, LSL #2\n"
687       "b 34f\n"
688       "33:"  // Height 3: setup direct input
689       "mov x23, %x[input_ptr]\n"
690       "add x22, x23, x19, LSL #2\n"
691       "add x21, x22, x19, LSL #2\n"
692       "34:"  // Height 3: input setup done
693       "cmp x24, #0x4\n"
694       "ble 36f\n"
695       "35:"  // Height 3: Multiply loop: Main loop head
696       "whilelt p0.s, XZR, x24\n"
697       "ld1rqw { z0.s }, p0/Z, [x23]\n"
698       "ld1rqw { z1.s }, p0/Z, [x22]\n"
699       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
700       "ld1rqw { z2.s }, p0/Z, [x21]\n"
701       ".inst 0x658abc21  // bfcvt z1.h, p7/M, z1.s\n"
702       "uzp1 z0.h, z0.h, z0.h\n"
703       "ld1h { z4.h }, p7/Z, [x27]\n"
704       "uzp1 z1.h, z1.h, z1.h\n"
705       ".inst 0x658abc42  // bfcvt z2.h, p7/M, z2.s\n"
706       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
707       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
708       "trn1 z0.d, z0.d, z1.d\n"
709       "uzp1 z2.h, z2.h, z2.h\n"
710       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
711       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
712       ".inst 0x6464e454  // bfmmla z20.s, z2.h, z4.h\n"
713       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
714       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
715       "sub x24, x24, #0x4\n"
716       ".inst 0x6465e45a  // bfmmla z26.s, z2.h, z5.h\n"
717       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
718       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
719       "cmp x24, #0x4\n"
720       ".inst 0x6466e455  // bfmmla z21.s, z2.h, z6.h\n"
721       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
722       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
723       "add x23, x23, #0x10\n"
724       ".inst 0x6467e45b  // bfmmla z27.s, z2.h, z7.h\n"
725       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
726       "addvl x27, x27, #16\n"
727       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
728       ".inst 0x6464e456  // bfmmla z22.s, z2.h, z4.h\n"
729       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
730       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
731       "add x22, x22, #0x10\n"
732       ".inst 0x6465e45c  // bfmmla z28.s, z2.h, z5.h\n"
733       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
734       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
735       "add x21, x21, #0x10\n"
736       ".inst 0x6466e457  // bfmmla z23.s, z2.h, z6.h\n"
737       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
738       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
739       ".inst 0x6467e45d  // bfmmla z29.s, z2.h, z7.h\n"
740       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
741       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
742       "addvl x27, x27, #-4\n"
743       ".inst 0x6464e458  // bfmmla z24.s, z2.h, z4.h\n"
744       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
745       ".inst 0x6465e45e  // bfmmla z30.s, z2.h, z5.h\n"
746       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
747       ".inst 0x6466e459  // bfmmla z25.s, z2.h, z6.h\n"
748       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
749       ".inst 0x6467e45f  // bfmmla z31.s, z2.h, z7.h\n"
750       "bgt 35b\n"
751       "36:"  // Height 3: Multiply loop: Single iteration only
752       "whilelt p0.s, XZR, x24\n"
753       "ld1rqw { z0.s }, p0/Z, [x23]\n"
754       "ld1rqw { z1.s }, p0/Z, [x22]\n"
755       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
756       "ld1rqw { z2.s }, p0/Z, [x21]\n"
757       ".inst 0x658abc21  // bfcvt z1.h, p7/M, z1.s\n"
758       "uzp1 z0.h, z0.h, z0.h\n"
759       "ld1h { z4.h }, p7/Z, [x27]\n"
760       "uzp1 z1.h, z1.h, z1.h\n"
761       ".inst 0x658abc42  // bfcvt z2.h, p7/M, z2.s\n"
762       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
763       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
764       "trn1 z0.d, z0.d, z1.d\n"
765       "uzp1 z2.h, z2.h, z2.h\n"
766       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
767       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
768       ".inst 0x6464e454  // bfmmla z20.s, z2.h, z4.h\n"
769       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
770       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
771       ".inst 0x6465e45a  // bfmmla z26.s, z2.h, z5.h\n"
772       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
773       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
774       ".inst 0x6466e455  // bfmmla z21.s, z2.h, z6.h\n"
775       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
776       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
777       ".inst 0x6467e45b  // bfmmla z27.s, z2.h, z7.h\n"
778       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
779       "addvl x27, x27, #16\n"
780       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
781       ".inst 0x6464e456  // bfmmla z22.s, z2.h, z4.h\n"
782       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
783       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
784       ".inst 0x6465e45c  // bfmmla z28.s, z2.h, z5.h\n"
785       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
786       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
787       ".inst 0x6466e457  // bfmmla z23.s, z2.h, z6.h\n"
788       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
789       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
790       ".inst 0x6467e45d  // bfmmla z29.s, z2.h, z7.h\n"
791       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
792       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
793       "addvl x27, x27, #-4\n"
794       ".inst 0x6464e458  // bfmmla z24.s, z2.h, z4.h\n"
795       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
796       ".inst 0x6465e45e  // bfmmla z30.s, z2.h, z5.h\n"
797       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
798       ".inst 0x6466e459  // bfmmla z25.s, z2.h, z6.h\n"
799       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
800       ".inst 0x6467e45f  // bfmmla z31.s, z2.h, z7.h\n"
801       "37:"  // Height 3: Multiply loop: multiply skip
802       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
803       "add x25, x25, #0x1\n"
804       "cmp x25, x19\n"
805       "bne 32b\n"
806       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
807       "add x22, x26, x19, LSL #2\n"
808       "uzp1 z4.d, z8.d, z14.d\n"
809       "uzp2 z8.d, z8.d, z14.d\n"
810       "uzp1 z14.d, z9.d, z15.d\n"
811       "uzp2 z9.d, z9.d, z15.d\n"
812       "add x21, x22, x19, LSL #2\n"
813       "uzp1 z15.d, z10.d, z16.d\n"
814       "uzp2 z10.d, z10.d, z16.d\n"
815       "uzp1 z16.d, z11.d, z17.d\n"
816       "uzp2 z11.d, z11.d, z17.d\n"
817       "uzp1 z17.d, z12.d, z18.d\n"
818       "uzp2 z12.d, z12.d, z18.d\n"
819       "uzp1 z18.d, z13.d, z19.d\n"
820       "uzp2 z13.d, z13.d, z19.d\n"
821       "uzp1 z20.d, z20.d, z26.d\n"
822       "uzp1 z21.d, z21.d, z27.d\n"
823       "uzp1 z22.d, z22.d, z28.d\n"
824       "uzp1 z23.d, z23.d, z29.d\n"
825       "uzp1 z24.d, z24.d, z30.d\n"
826       "uzp1 z25.d, z25.d, z31.d\n"
827       "tbz %x[flags], #1, 38f\n"
828       "add x19, %x[args_ptr], %[offset_max]\n"
829       "ld1rw { z1.s }, p7/Z, [x19]\n"
830       "add x19, %x[args_ptr], %[offset_min]\n"
831       "ld1rw { z0.s }, p7/Z, [x19]\n"
832       "fmin z4.s, p7/M, z4.s, z1.s\n"
833       "fmin z14.s, p7/M, z14.s, z1.s\n"
834       "fmin z15.s, p7/M, z15.s, z1.s\n"
835       "fmin z16.s, p7/M, z16.s, z1.s\n"
836       "fmin z17.s, p7/M, z17.s, z1.s\n"
837       "fmin z18.s, p7/M, z18.s, z1.s\n"
838       "fmin z8.s, p7/M, z8.s, z1.s\n"
839       "fmin z9.s, p7/M, z9.s, z1.s\n"
840       "fmin z10.s, p7/M, z10.s, z1.s\n"
841       "fmin z11.s, p7/M, z11.s, z1.s\n"
842       "fmin z12.s, p7/M, z12.s, z1.s\n"
843       "fmin z13.s, p7/M, z13.s, z1.s\n"
844       "fmin z20.s, p7/M, z20.s, z1.s\n"
845       "fmin z21.s, p7/M, z21.s, z1.s\n"
846       "fmin z22.s, p7/M, z22.s, z1.s\n"
847       "fmin z23.s, p7/M, z23.s, z1.s\n"
848       "fmin z24.s, p7/M, z24.s, z1.s\n"
849       "fmin z25.s, p7/M, z25.s, z1.s\n"
850       "fmax z4.s, p7/M, z4.s, z0.s\n"
851       "fmax z14.s, p7/M, z14.s, z0.s\n"
852       "fmax z15.s, p7/M, z15.s, z0.s\n"
853       "fmax z16.s, p7/M, z16.s, z0.s\n"
854       "fmax z17.s, p7/M, z17.s, z0.s\n"
855       "fmax z18.s, p7/M, z18.s, z0.s\n"
856       "fmax z8.s, p7/M, z8.s, z0.s\n"
857       "fmax z9.s, p7/M, z9.s, z0.s\n"
858       "fmax z10.s, p7/M, z10.s, z0.s\n"
859       "fmax z11.s, p7/M, z11.s, z0.s\n"
860       "fmax z12.s, p7/M, z12.s, z0.s\n"
861       "fmax z13.s, p7/M, z13.s, z0.s\n"
862       "fmax z20.s, p7/M, z20.s, z0.s\n"
863       "fmax z21.s, p7/M, z21.s, z0.s\n"
864       "fmax z22.s, p7/M, z22.s, z0.s\n"
865       "fmax z23.s, p7/M, z23.s, z0.s\n"
866       "fmax z24.s, p7/M, z24.s, z0.s\n"
867       "fmax z25.s, p7/M, z25.s, z0.s\n"
868       "38:"  // Height 3: No activation
869       "st1w { z4.s }, p6, [x26]\n"
870       "st1w { z14.s }, p5, [x26, #1, MUL VL]\n"
871       "st1w { z15.s }, p4, [x26, #2, MUL VL]\n"
872       "st1w { z16.s }, p3, [x26, #3, MUL VL]\n"
873       "st1w { z17.s }, p2, [x26, #4, MUL VL]\n"
874       "st1w { z18.s }, p1, [x26, #5, MUL VL]\n"
875       "addvl x26, x26, #6\n"
876       "st1w { z8.s }, p6, [x22]\n"
877       "st1w { z9.s }, p5, [x22, #1, MUL VL]\n"
878       "st1w { z10.s }, p4, [x22, #2, MUL VL]\n"
879       "st1w { z11.s }, p3, [x22, #3, MUL VL]\n"
880       "st1w { z12.s }, p2, [x22, #4, MUL VL]\n"
881       "st1w { z13.s }, p1, [x22, #5, MUL VL]\n"
882       "st1w { z20.s }, p6, [x21]\n"
883       "st1w { z21.s }, p5, [x21, #1, MUL VL]\n"
884       "st1w { z22.s }, p4, [x21, #2, MUL VL]\n"
885       "st1w { z23.s }, p3, [x21, #3, MUL VL]\n"
886       "st1w { z24.s }, p2, [x21, #4, MUL VL]\n"
887       "st1w { z25.s }, p1, [x21, #5, MUL VL]\n"
888       "39:"  // Height 3: Writeback done
889       "decw x28, ALL, MUL #6\n"
890       "cmp x28, XZR\n"
891       "bgt 28b\n"
892       "b 54f\n"
893       "40:"  // Height 4
894       "ldr x20, [%x[args_ptr], %[offsetof_output_offset]]\n"
895       "mov x19, #0x10\n"
896       "mov x9, %x[bias]\n"
897       "ldr x28, [%x[args_ptr], %[offsetof_N]]\n"
898       "ldr x27, [%x[args_ptr], %[offsetof_B_ptr]]\n"
899       "mov x26, %x[output_ptr]\n"
900       "madd %x[output_ptr], x20, x19, %x[output_ptr]\n"
901       "41:"  // Height 4: Column loop
902       "mov x19, #0x0\n"
903       "whilelt p6.s, x19, x28\n"
904       "incw x19\n"
905       "whilelt p5.s, x19, x28\n"
906       "incw x19\n"
907       "whilelt p4.s, x19, x28\n"
908       "incw x19\n"
909       "whilelt p3.s, x19, x28\n"
910       "incw x19\n"
911       "whilelt p2.s, x19, x28\n"
912       "incw x19\n"
913       "whilelt p1.s, x19, x28\n"
914       "cbz x9, 42f\n"
915       "ld1w { z8.s }, p7/Z, [x9]\n"
916       "ld1w { z9.s }, p7/Z, [x9, #1, MUL VL]\n"
917       "ld1w { z10.s }, p7/Z, [x9, #2, MUL VL]\n"
918       "zip2 z14.d, z8.d, z8.d\n"
919       "zip1 z8.d, z8.d, z8.d\n"
920       "ld1w { z11.s }, p7/Z, [x9, #3, MUL VL]\n"
921       "ld1w { z12.s }, p7/Z, [x9, #4, MUL VL]\n"
922       "zip2 z15.d, z9.d, z9.d\n"
923       "zip1 z9.d, z9.d, z9.d\n"
924       "ld1w { z13.s }, p7/Z, [x9, #5, MUL VL]\n"
925       "zip2 z16.d, z10.d, z10.d\n"
926       "zip1 z10.d, z10.d, z10.d\n"
927       "addvl x9, x9, #6\n"
928       "zip2 z17.d, z11.d, z11.d\n"
929       "zip1 z11.d, z11.d, z11.d\n"
930       "zip2 z18.d, z12.d, z12.d\n"
931       "zip1 z12.d, z12.d, z12.d\n"
932       "zip2 z19.d, z13.d, z13.d\n"
933       "zip1 z13.d, z13.d, z13.d\n"
934       "mov z20.d, z8.d\n"
935       "mov z26.d, z14.d\n"
936       "mov z21.d, z9.d\n"
937       "mov z27.d, z15.d\n"
938       "mov z22.d, z10.d\n"
939       "mov z28.d, z16.d\n"
940       "mov z23.d, z11.d\n"
941       "mov z29.d, z17.d\n"
942       "mov z24.d, z12.d\n"
943       "mov z30.d, z18.d\n"
944       "mov z25.d, z13.d\n"
945       "mov z31.d, z19.d\n"
946       "b 44f\n"
947       "42:"  // Height 4: no bias
948       "tbz %x[flags], #0, 43f\n"
949       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
950       "add x22, x26, x19, LSL #2\n"
951       "add x21, x22, x19, LSL #2\n"
952       "add x20, x21, x19, LSL #2\n"
953       "ld1w { z9.s }, p6/Z, [x26]\n"
954       "ld1w { z10.s }, p5/Z, [x26, #1, MUL VL]\n"
955       "ld1w { z11.s }, p4/Z, [x26, #2, MUL VL]\n"
956       "ld1w { z12.s }, p3/Z, [x26, #3, MUL VL]\n"
957       "ld1w { z13.s }, p2/Z, [x26, #4, MUL VL]\n"
958       "ld1w { z20.s }, p1/Z, [x26, #5, MUL VL]\n"
959       "ld1w { z14.s }, p6/Z, [x22]\n"
960       "ld1w { z15.s }, p5/Z, [x22, #1, MUL VL]\n"
961       "zip1 z8.d, z9.d, z14.d\n"
962       "zip2 z14.d, z9.d, z14.d\n"
963       "ld1w { z16.s }, p4/Z, [x22, #2, MUL VL]\n"
964       "ld1w { z17.s }, p3/Z, [x22, #3, MUL VL]\n"
965       "zip1 z9.d, z10.d, z15.d\n"
966       "zip2 z15.d, z10.d, z15.d\n"
967       "ld1w { z18.s }, p2/Z, [x22, #4, MUL VL]\n"
968       "ld1w { z19.s }, p1/Z, [x22, #5, MUL VL]\n"
969       "zip1 z10.d, z11.d, z16.d\n"
970       "zip2 z16.d, z11.d, z16.d\n"
971       "ld1w { z21.s }, p6/Z, [x21]\n"
972       "ld1w { z22.s }, p5/Z, [x21, #1, MUL VL]\n"
973       "zip1 z11.d, z12.d, z17.d\n"
974       "zip2 z17.d, z12.d, z17.d\n"
975       "ld1w { z23.s }, p4/Z, [x21, #2, MUL VL]\n"
976       "ld1w { z24.s }, p3/Z, [x21, #3, MUL VL]\n"
977       "zip1 z12.d, z13.d, z18.d\n"
978       "zip2 z18.d, z13.d, z18.d\n"
979       "ld1w { z25.s }, p2/Z, [x21, #4, MUL VL]\n"
980       "ld1w { z4.s }, p1/Z, [x21, #5, MUL VL]\n"
981       "zip1 z13.d, z20.d, z19.d\n"
982       "zip2 z19.d, z20.d, z19.d\n"
983       "ld1w { z26.s }, p6/Z, [x20]\n"
984       "ld1w { z27.s }, p5/Z, [x20, #1, MUL VL]\n"
985       "zip1 z20.d, z21.d, z26.d\n"
986       "zip2 z26.d, z21.d, z26.d\n"
987       "ld1w { z28.s }, p4/Z, [x20, #2, MUL VL]\n"
988       "ld1w { z29.s }, p3/Z, [x20, #3, MUL VL]\n"
989       "zip1 z21.d, z22.d, z27.d\n"
990       "zip2 z27.d, z22.d, z27.d\n"
991       "ld1w { z30.s }, p2/Z, [x20, #4, MUL VL]\n"
992       "ld1w { z31.s }, p1/Z, [x20, #5, MUL VL]\n"
993       "zip1 z22.d, z23.d, z28.d\n"
994       "zip2 z28.d, z23.d, z28.d\n"
995       "zip1 z23.d, z24.d, z29.d\n"
996       "zip2 z29.d, z24.d, z29.d\n"
997       "zip1 z24.d, z25.d, z30.d\n"
998       "zip2 z30.d, z25.d, z30.d\n"
999       "zip1 z25.d, z4.d, z31.d\n"
1000       "zip2 z31.d, z4.d, z31.d\n"
1001       "b 44f\n"
1002       "43:"  // Height 4: no accumulate
1003       "mov z8.b, #0x0\n"
1004       "mov z9.b, #0x0\n"
1005       "mov z10.b, #0x0\n"
1006       "mov z11.b, #0x0\n"
1007       "mov z12.b, #0x0\n"
1008       "mov z13.b, #0x0\n"
1009       "mov z14.b, #0x0\n"
1010       "mov z15.b, #0x0\n"
1011       "mov z16.b, #0x0\n"
1012       "mov z17.b, #0x0\n"
1013       "mov z18.b, #0x0\n"
1014       "mov z19.b, #0x0\n"
1015       "mov z20.b, #0x0\n"
1016       "mov z21.b, #0x0\n"
1017       "mov z22.b, #0x0\n"
1018       "mov z23.b, #0x0\n"
1019       "mov z24.b, #0x0\n"
1020       "mov z25.b, #0x0\n"
1021       "mov z26.b, #0x0\n"
1022       "mov z27.b, #0x0\n"
1023       "mov z28.b, #0x0\n"
1024       "mov z29.b, #0x0\n"
1025       "mov z30.b, #0x0\n"
1026       "mov z31.b, #0x0\n"
1027       "44:"  // Height 4: setup done
1028       "mov x25, #0x0\n"
1029       "45:"  // Height 4: String loop
1030       "ldr x19, [%x[args_ptr], %[offsetof_string_lengths]]\n"
1031       "ldr w24, [x19, x25, LSL #0x2]\n"
1032       "ldr x19, [%x[args_ptr], %[offsetof_input_offset]]\n"
1033       "tbz %x[flags], #3, 46f\n"
1034       "ldr x20, [%x[input_ptr], x25, LSL #0x3]\n"
1035       "add x20, x20, x19, LSL #3\n"
1036       "ldr x23, [x20, #0x0]\n"
1037       "ldr x22, [x20, #0x8]\n"
1038       "ldr x21, [x20, #0x10]\n"
1039       "ldr x20, [x20, #0x18]\n"
1040       "cbnz x25, 47f\n"
1041       "ldr x19, [%x[args_ptr], %[offsetof_input_initial_col]]\n"
1042       "add x23, x23, x19, LSL #2\n"
1043       "add x22, x22, x19, LSL #2\n"
1044       "add x21, x21, x19, LSL #2\n"
1045       "add x20, x20, x19, LSL #2\n"
1046       "b 47f\n"
1047       "46:"  // Height 4: setup direct input
1048       "mov x23, %x[input_ptr]\n"
1049       "add x22, x23, x19, LSL #2\n"
1050       "add x21, x22, x19, LSL #2\n"
1051       "add x20, x21, x19, LSL #2\n"
1052       "47:"  // Height 4: input setup done
1053       "cmp x24, #0x4\n"
1054       "ble 49f\n"
1055       "48:"  // Height 4: Multiply loop: Main loop head
1056       "whilelt p0.s, XZR, x24\n"
1057       "ld1rqw { z0.s }, p0/Z, [x23]\n"
1058       "ld1rqw { z1.s }, p0/Z, [x22]\n"
1059       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
1060       "ld1rqw { z2.s }, p0/Z, [x21]\n"
1061       "ld1rqw { z3.s }, p0/Z, [x20]\n"
1062       ".inst 0x658abc21  // bfcvt z1.h, p7/M, z1.s\n"
1063       ".inst 0x658abc42  // bfcvt z2.h, p7/M, z2.s\n"
1064       ".inst 0x658abc63  // bfcvt z3.h, p7/M, z3.s\n"
1065       "uzp1 z0.h, z0.h, z0.h\n"
1066       "ld1h { z4.h }, p7/Z, [x27]\n"
1067       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
1068       "uzp1 z1.h, z1.h, z1.h\n"
1069       "uzp1 z2.h, z2.h, z2.h\n"
1070       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
1071       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
1072       "uzp1 z3.h, z3.h, z3.h\n"
1073       "trn1 z0.d, z0.d, z1.d\n"
1074       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
1075       "sub x24, x24, #0x4\n"
1076       "trn1 z2.d, z2.d, z3.d\n"
1077       ".inst 0x6464e454  // bfmmla z20.s, z2.h, z4.h\n"
1078       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
1079       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
1080       ".inst 0x6465e45a  // bfmmla z26.s, z2.h, z5.h\n"
1081       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
1082       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
1083       "cmp x24, #0x4\n"
1084       ".inst 0x6466e455  // bfmmla z21.s, z2.h, z6.h\n"
1085       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
1086       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
1087       "add x23, x23, #0x10\n"
1088       ".inst 0x6467e45b  // bfmmla z27.s, z2.h, z7.h\n"
1089       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
1090       "addvl x27, x27, #16\n"
1091       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
1092       ".inst 0x6464e456  // bfmmla z22.s, z2.h, z4.h\n"
1093       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
1094       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
1095       "add x22, x22, #0x10\n"
1096       ".inst 0x6465e45c  // bfmmla z28.s, z2.h, z5.h\n"
1097       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
1098       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
1099       "add x21, x21, #0x10\n"
1100       ".inst 0x6466e457  // bfmmla z23.s, z2.h, z6.h\n"
1101       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
1102       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
1103       "add x20, x20, #0x10\n"
1104       ".inst 0x6467e45d  // bfmmla z29.s, z2.h, z7.h\n"
1105       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
1106       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
1107       "addvl x27, x27, #-4\n"
1108       ".inst 0x6464e458  // bfmmla z24.s, z2.h, z4.h\n"
1109       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
1110       ".inst 0x6465e45e  // bfmmla z30.s, z2.h, z5.h\n"
1111       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
1112       ".inst 0x6466e459  // bfmmla z25.s, z2.h, z6.h\n"
1113       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
1114       ".inst 0x6467e45f  // bfmmla z31.s, z2.h, z7.h\n"
1115       "bgt 48b\n"
1116       "49:"  // Height 4: Multiply loop: Single iteration only
1117       "whilelt p0.s, XZR, x24\n"
1118       "ld1rqw { z0.s }, p0/Z, [x23]\n"
1119       "ld1rqw { z1.s }, p0/Z, [x22]\n"
1120       ".inst 0x658abc00  // bfcvt z0.h, p7/M, z0.s\n"
1121       "ld1rqw { z2.s }, p0/Z, [x21]\n"
1122       "ld1rqw { z3.s }, p0/Z, [x20]\n"
1123       ".inst 0x658abc21  // bfcvt z1.h, p7/M, z1.s\n"
1124       ".inst 0x658abc42  // bfcvt z2.h, p7/M, z2.s\n"
1125       ".inst 0x658abc63  // bfcvt z3.h, p7/M, z3.s\n"
1126       "uzp1 z0.h, z0.h, z0.h\n"
1127       "ld1h { z4.h }, p7/Z, [x27]\n"
1128       "ld1h { z5.h }, p7/Z, [x27, #1, MUL VL]\n"
1129       "uzp1 z1.h, z1.h, z1.h\n"
1130       "uzp1 z2.h, z2.h, z2.h\n"
1131       "ld1h { z6.h }, p7/Z, [x27, #2, MUL VL]\n"
1132       "ld1h { z7.h }, p7/Z, [x27, #3, MUL VL]\n"
1133       "uzp1 z3.h, z3.h, z3.h\n"
1134       "trn1 z0.d, z0.d, z1.d\n"
1135       ".inst 0x6464e408  // bfmmla z8.s, z0.h, z4.h\n"
1136       "trn1 z2.d, z2.d, z3.d\n"
1137       ".inst 0x6464e454  // bfmmla z20.s, z2.h, z4.h\n"
1138       ".inst 0x6465e40e  // bfmmla z14.s, z0.h, z5.h\n"
1139       "ld1h { z4.h }, p7/Z, [x27, #4, MUL VL]\n"
1140       ".inst 0x6465e45a  // bfmmla z26.s, z2.h, z5.h\n"
1141       ".inst 0x6466e409  // bfmmla z9.s, z0.h, z6.h\n"
1142       "ld1h { z5.h }, p7/Z, [x27, #5, MUL VL]\n"
1143       ".inst 0x6466e455  // bfmmla z21.s, z2.h, z6.h\n"
1144       ".inst 0x6467e40f  // bfmmla z15.s, z0.h, z7.h\n"
1145       "ld1h { z6.h }, p7/Z, [x27, #6, MUL VL]\n"
1146       ".inst 0x6467e45b  // bfmmla z27.s, z2.h, z7.h\n"
1147       "ld1h { z7.h }, p7/Z, [x27, #7, MUL VL]\n"
1148       "addvl x27, x27, #16\n"
1149       ".inst 0x6464e40a  // bfmmla z10.s, z0.h, z4.h\n"
1150       ".inst 0x6464e456  // bfmmla z22.s, z2.h, z4.h\n"
1151       ".inst 0x6465e410  // bfmmla z16.s, z0.h, z5.h\n"
1152       "ld1h { z4.h }, p7/Z, [x27, #-8, MUL VL]\n"
1153       ".inst 0x6465e45c  // bfmmla z28.s, z2.h, z5.h\n"
1154       ".inst 0x6466e40b  // bfmmla z11.s, z0.h, z6.h\n"
1155       "ld1h { z5.h }, p7/Z, [x27, #-7, MUL VL]\n"
1156       ".inst 0x6466e457  // bfmmla z23.s, z2.h, z6.h\n"
1157       ".inst 0x6467e411  // bfmmla z17.s, z0.h, z7.h\n"
1158       "ld1h { z6.h }, p7/Z, [x27, #-6, MUL VL]\n"
1159       ".inst 0x6467e45d  // bfmmla z29.s, z2.h, z7.h\n"
1160       "ld1h { z7.h }, p7/Z, [x27, #-5, MUL VL]\n"
1161       ".inst 0x6464e40c  // bfmmla z12.s, z0.h, z4.h\n"
1162       "addvl x27, x27, #-4\n"
1163       ".inst 0x6464e458  // bfmmla z24.s, z2.h, z4.h\n"
1164       ".inst 0x6465e412  // bfmmla z18.s, z0.h, z5.h\n"
1165       ".inst 0x6465e45e  // bfmmla z30.s, z2.h, z5.h\n"
1166       ".inst 0x6466e40d  // bfmmla z13.s, z0.h, z6.h\n"
1167       ".inst 0x6466e459  // bfmmla z25.s, z2.h, z6.h\n"
1168       ".inst 0x6467e413  // bfmmla z19.s, z0.h, z7.h\n"
1169       ".inst 0x6467e45f  // bfmmla z31.s, z2.h, z7.h\n"
1170       "50:"  // Height 4: Multiply loop: multiply skip
1171       "ldr w19, [%x[args_ptr], %[offsetof_num_strings]]\n"
1172       "add x25, x25, #0x1\n"
1173       "cmp x25, x19\n"
1174       "bne 45b\n"
1175       "ldr x19, [%x[args_ptr], %[offsetof_output_offset]]\n"
1176       "add x22, x26, x19, LSL #2\n"
1177       "add x21, x22, x19, LSL #2\n"
1178       "uzp1 z4.d, z8.d, z14.d\n"
1179       "uzp2 z8.d, z8.d, z14.d\n"
1180       "uzp1 z14.d, z9.d, z15.d\n"
1181       "add x20, x21, x19, LSL #2\n"
1182       "uzp2 z9.d, z9.d, z15.d\n"
1183       "uzp1 z15.d, z10.d, z16.d\n"
1184       "uzp2 z10.d, z10.d, z16.d\n"
1185       "uzp1 z16.d, z11.d, z17.d\n"
1186       "uzp2 z11.d, z11.d, z17.d\n"
1187       "uzp1 z17.d, z12.d, z18.d\n"
1188       "uzp2 z12.d, z12.d, z18.d\n"
1189       "uzp1 z18.d, z13.d, z19.d\n"
1190       "uzp2 z13.d, z13.d, z19.d\n"
1191       "uzp1 z19.d, z20.d, z26.d\n"
1192       "uzp2 z20.d, z20.d, z26.d\n"
1193       "uzp1 z26.d, z21.d, z27.d\n"
1194       "uzp2 z21.d, z21.d, z27.d\n"
1195       "uzp1 z27.d, z22.d, z28.d\n"
1196       "uzp2 z22.d, z22.d, z28.d\n"
1197       "uzp1 z28.d, z23.d, z29.d\n"
1198       "uzp2 z23.d, z23.d, z29.d\n"
1199       "uzp1 z29.d, z24.d, z30.d\n"
1200       "uzp2 z24.d, z24.d, z30.d\n"
1201       "uzp1 z30.d, z25.d, z31.d\n"
1202       "uzp2 z25.d, z25.d, z31.d\n"
1203       "tbz %x[flags], #1, 51f\n"
1204       "add x19, %x[args_ptr], %[offset_max]\n"
1205       "ld1rw { z1.s }, p7/Z, [x19]\n"
1206       "add x19, %x[args_ptr], %[offset_min]\n"
1207       "ld1rw { z0.s }, p7/Z, [x19]\n"
1208       "fmin z4.s, p7/M, z4.s, z1.s\n"
1209       "fmin z14.s, p7/M, z14.s, z1.s\n"
1210       "fmin z15.s, p7/M, z15.s, z1.s\n"
1211       "fmin z16.s, p7/M, z16.s, z1.s\n"
1212       "fmin z17.s, p7/M, z17.s, z1.s\n"
1213       "fmin z18.s, p7/M, z18.s, z1.s\n"
1214       "fmin z8.s, p7/M, z8.s, z1.s\n"
1215       "fmin z9.s, p7/M, z9.s, z1.s\n"
1216       "fmin z10.s, p7/M, z10.s, z1.s\n"
1217       "fmin z11.s, p7/M, z11.s, z1.s\n"
1218       "fmin z12.s, p7/M, z12.s, z1.s\n"
1219       "fmin z13.s, p7/M, z13.s, z1.s\n"
1220       "fmin z19.s, p7/M, z19.s, z1.s\n"
1221       "fmin z26.s, p7/M, z26.s, z1.s\n"
1222       "fmin z27.s, p7/M, z27.s, z1.s\n"
1223       "fmin z28.s, p7/M, z28.s, z1.s\n"
1224       "fmin z29.s, p7/M, z29.s, z1.s\n"
1225       "fmin z30.s, p7/M, z30.s, z1.s\n"
1226       "fmin z20.s, p7/M, z20.s, z1.s\n"
1227       "fmin z21.s, p7/M, z21.s, z1.s\n"
1228       "fmin z22.s, p7/M, z22.s, z1.s\n"
1229       "fmin z23.s, p7/M, z23.s, z1.s\n"
1230       "fmin z24.s, p7/M, z24.s, z1.s\n"
1231       "fmin z25.s, p7/M, z25.s, z1.s\n"
1232       "fmax z4.s, p7/M, z4.s, z0.s\n"
1233       "fmax z14.s, p7/M, z14.s, z0.s\n"
1234       "fmax z15.s, p7/M, z15.s, z0.s\n"
1235       "fmax z16.s, p7/M, z16.s, z0.s\n"
1236       "fmax z17.s, p7/M, z17.s, z0.s\n"
1237       "fmax z18.s, p7/M, z18.s, z0.s\n"
1238       "fmax z8.s, p7/M, z8.s, z0.s\n"
1239       "fmax z9.s, p7/M, z9.s, z0.s\n"
1240       "fmax z10.s, p7/M, z10.s, z0.s\n"
1241       "fmax z11.s, p7/M, z11.s, z0.s\n"
1242       "fmax z12.s, p7/M, z12.s, z0.s\n"
1243       "fmax z13.s, p7/M, z13.s, z0.s\n"
1244       "fmax z19.s, p7/M, z19.s, z0.s\n"
1245       "fmax z26.s, p7/M, z26.s, z0.s\n"
1246       "fmax z27.s, p7/M, z27.s, z0.s\n"
1247       "fmax z28.s, p7/M, z28.s, z0.s\n"
1248       "fmax z29.s, p7/M, z29.s, z0.s\n"
1249       "fmax z30.s, p7/M, z30.s, z0.s\n"
1250       "fmax z20.s, p7/M, z20.s, z0.s\n"
1251       "fmax z21.s, p7/M, z21.s, z0.s\n"
1252       "fmax z22.s, p7/M, z22.s, z0.s\n"
1253       "fmax z23.s, p7/M, z23.s, z0.s\n"
1254       "fmax z24.s, p7/M, z24.s, z0.s\n"
1255       "fmax z25.s, p7/M, z25.s, z0.s\n"
1256       "51:"  // Height 4: No activation
1257       "st1w { z4.s }, p6, [x26]\n"
1258       "st1w { z14.s }, p5, [x26, #1, MUL VL]\n"
1259       "st1w { z15.s }, p4, [x26, #2, MUL VL]\n"
1260       "st1w { z16.s }, p3, [x26, #3, MUL VL]\n"
1261       "st1w { z17.s }, p2, [x26, #4, MUL VL]\n"
1262       "st1w { z18.s }, p1, [x26, #5, MUL VL]\n"
1263       "addvl x26, x26, #6\n"
1264       "st1w { z8.s }, p6, [x22]\n"
1265       "st1w { z9.s }, p5, [x22, #1, MUL VL]\n"
1266       "st1w { z10.s }, p4, [x22, #2, MUL VL]\n"
1267       "st1w { z11.s }, p3, [x22, #3, MUL VL]\n"
1268       "st1w { z12.s }, p2, [x22, #4, MUL VL]\n"
1269       "st1w { z13.s }, p1, [x22, #5, MUL VL]\n"
1270       "st1w { z19.s }, p6, [x21]\n"
1271       "st1w { z26.s }, p5, [x21, #1, MUL VL]\n"
1272       "st1w { z27.s }, p4, [x21, #2, MUL VL]\n"
1273       "st1w { z28.s }, p3, [x21, #3, MUL VL]\n"
1274       "st1w { z29.s }, p2, [x21, #4, MUL VL]\n"
1275       "st1w { z30.s }, p1, [x21, #5, MUL VL]\n"
1276       "st1w { z20.s }, p6, [x20]\n"
1277       "st1w { z21.s }, p5, [x20, #1, MUL VL]\n"
1278       "st1w { z22.s }, p4, [x20, #2, MUL VL]\n"
1279       "st1w { z23.s }, p3, [x20, #3, MUL VL]\n"
1280       "st1w { z24.s }, p2, [x20, #4, MUL VL]\n"
1281       "st1w { z25.s }, p1, [x20, #5, MUL VL]\n"
1282       "52:"  // Height 4: Writeback done
1283       "decw x28, ALL, MUL #6\n"
1284       "cmp x28, XZR\n"
1285       "bgt 41b\n"
1286       "subs %x[M], %x[M], #0x4\n"
1287       "beq 54f\n"
1288       "ldr x20, [%x[args_ptr], %[offsetof_input_offset]]\n"
1289       "tbz %x[flags], #3, 53f\n"
1290       "add x20, x20, #0x4\n"
1291       "str x20, [%x[args_ptr], %[offsetof_input_offset]]\n"
1292       "b 1b\n"
1293       "53:"  // Update direct input
1294       "mov x19, #0x10\n"
1295       "madd %x[input_ptr], x19, x20, %x[input_ptr]\n"
1296       "b 1b\n"
1297       "54:"  // Exit
1298 
1299       : [M] "+&r" (M), [input_ptr] "+&r" (input_ptr), [output_ptr] "+&r" (output_ptr)
1300       : [args_ptr] "r" (&ka), [bias] "r" (bias), [flags] "r" (flags), [offset_max] "I" (offsetof(KernelArgs, maxval)), [offset_min] "I" (offsetof(KernelArgs, minval)), [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))
1301       : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "x9", "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"
1302     );
1303 }
1304 
1305 } // namespace arm_gemm
1306 #endif // __ARM_FEATURE_SVE
1307