aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/kernels/lut/generic/sve2/u8.cpp
blob: ee8572703ecc0b0e8f7291fcafe08dc8dc483785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
/*
 * Copyright (c) 2022-2023 Arm Limited.
 *
 * SPDX-License-Identifier: MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#include "src/cpu/kernels/lut/list.h"

#ifdef __aarch64__
#ifdef ARM_COMPUTE_ENABLE_SVE

namespace arm_compute
{
namespace cpu
{
void lut_u8_sve2(
    const uint8_t *table, size_t num_strings, size_t string_length, const uint8_t *const *input, uint8_t *const *output)
{
    __asm__ __volatile__(
        "ptrue p0.b\n"
        "cntd x25\n"
        "addvl %x[table], %x[table], #8\n"
        "ld1b { z16.b }, p0/Z, [%x[table], #-8, MUL VL]\n"
        "tbnz x25, #5, 1f\n"
        "ld1b { z17.b }, p0/Z, [%x[table], #-7, MUL VL]\n"
        "tbnz x25, #4, 1f\n"
        "ld1b { z18.b }, p0/Z, [%x[table], #-6, MUL VL]\n"
        "ld1b { z19.b }, p0/Z, [%x[table], #-5, MUL VL]\n"
        "tbnz x25, #3, 1f\n"
        "ld1b { z20.b }, p0/Z, [%x[table], #-4, MUL VL]\n"
        "ld1b { z21.b }, p0/Z, [%x[table], #-3, MUL VL]\n"
        "ld1b { z22.b }, p0/Z, [%x[table], #-2, MUL VL]\n"
        "ld1b { z23.b }, p0/Z, [%x[table], #-1, MUL VL]\n"
        "tbnz x25, #2, 1f\n"
        "ld1b { z24.b }, p0/Z, [%x[table]]\n"
        "ld1b { z25.b }, p0/Z, [%x[table], #1, MUL VL]\n"
        "ld1b { z26.b }, p0/Z, [%x[table], #2, MUL VL]\n"
        "ld1b { z27.b }, p0/Z, [%x[table], #3, MUL VL]\n"
        "ld1b { z28.b }, p0/Z, [%x[table], #4, MUL VL]\n"
        "ld1b { z29.b }, p0/Z, [%x[table], #5, MUL VL]\n"
        "ld1b { z30.b }, p0/Z, [%x[table], #6, MUL VL]\n"
        "ld1b { z31.b }, p0/Z, [%x[table], #7, MUL VL]\n"
        "1:" // Table load done
        "mov x24, #0x0\n"
        "2:" // string loop
        "ldr x23, [%x[input], x24, LSL #0x3]\n"
        "ldr x22, [%x[output], x24, LSL #0x3]\n"
        "tbnz x25, #5, 14f\n"
        "tbnz x25, #4, 11f\n"
        "tbnz x25, #3, 8f\n"
        "tbnz x25, #2, 5f\n"
        "mov z12.b, #0x10\n"
        "mov x21, %x[string_length]\n"
        "ptrue p5.b\n"
        "ptrue p4.b\n"
        "ptrue p3.b\n"
        "ptrue p2.b\n"
        "ptrue p1.b\n"
        "ptrue p0.b\n"
        "3:" // 16 rounds: width loop
        "addvl x20, x21, #-6\n"
        "cmp x20, XZR\n"
        "bge 4f\n"
        "mov x20, #0x0\n"
        "addvl x20, x20, #1\n"
        "whilelt p5.b, XZR, x21\n"
        "whilelt p4.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p3.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p2.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p1.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p0.b, x20, x21\n"
        "4:" // 16 rounds: predicate OK
        "ld1b { z11.b }, p5/Z, [x23]\n"
        "ld1b { z10.b }, p4/Z, [x23, #1, MUL VL]\n"
        "tbl z9.b, { z16.b }, z11.b\n"
        "ld1b { z8.b }, p3/Z, [x23, #2, MUL VL]\n"
        "ld1b { z7.b }, p2/Z, [x23, #3, MUL VL]\n"
        "sub z11.b, z11.b, z12.b\n"
        "ld1b { z6.b }, p1/Z, [x23, #4, MUL VL]\n"
        "ld1b { z5.b }, p0/Z, [x23, #5, MUL VL]\n"
        "tbl z4.b, { z16.b }, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        "tbl z3.b, { z16.b }, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        "tbl z2.b, { z16.b }, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        "tbl z1.b, { z16.b }, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        "tbl z0.b, { z16.b }, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e29 // tbx z9.b, z17.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e24 // tbx z4.b, z17.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e23 // tbx z3.b, z17.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e22 // tbx z2.b, z17.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e21 // tbx z1.b, z17.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e20 // tbx z0.b, z17.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e49 // tbx z9.b, z18.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e44 // tbx z4.b, z18.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e43 // tbx z3.b, z18.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e42 // tbx z2.b, z18.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e41 // tbx z1.b, z18.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e40 // tbx z0.b, z18.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e69 // tbx z9.b, z19.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e64 // tbx z4.b, z19.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e63 // tbx z3.b, z19.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e62 // tbx z2.b, z19.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e61 // tbx z1.b, z19.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e60 // tbx z0.b, z19.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e89 // tbx z9.b, z20.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e84 // tbx z4.b, z20.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e83 // tbx z3.b, z20.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e82 // tbx z2.b, z20.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e81 // tbx z1.b, z20.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e80 // tbx z0.b, z20.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2ea9 // tbx z9.b, z21.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2ea4 // tbx z4.b, z21.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282ea3 // tbx z3.b, z21.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272ea2 // tbx z2.b, z21.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262ea1 // tbx z1.b, z21.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252ea0 // tbx z0.b, z21.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2ec9 // tbx z9.b, z22.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2ec4 // tbx z4.b, z22.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282ec3 // tbx z3.b, z22.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272ec2 // tbx z2.b, z22.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262ec1 // tbx z1.b, z22.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252ec0 // tbx z0.b, z22.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2ee9 // tbx z9.b, z23.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2ee4 // tbx z4.b, z23.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282ee3 // tbx z3.b, z23.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272ee2 // tbx z2.b, z23.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262ee1 // tbx z1.b, z23.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252ee0 // tbx z0.b, z23.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2f09 // tbx z9.b, z24.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2f04 // tbx z4.b, z24.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282f03 // tbx z3.b, z24.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272f02 // tbx z2.b, z24.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262f01 // tbx z1.b, z24.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252f00 // tbx z0.b, z24.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2f29 // tbx z9.b, z25.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2f24 // tbx z4.b, z25.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282f23 // tbx z3.b, z25.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272f22 // tbx z2.b, z25.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262f21 // tbx z1.b, z25.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252f20 // tbx z0.b, z25.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2f49 // tbx z9.b, z26.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2f44 // tbx z4.b, z26.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282f43 // tbx z3.b, z26.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272f42 // tbx z2.b, z26.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262f41 // tbx z1.b, z26.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252f40 // tbx z0.b, z26.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2f69 // tbx z9.b, z27.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2f64 // tbx z4.b, z27.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282f63 // tbx z3.b, z27.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272f62 // tbx z2.b, z27.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262f61 // tbx z1.b, z27.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252f60 // tbx z0.b, z27.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2f89 // tbx z9.b, z28.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2f84 // tbx z4.b, z28.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282f83 // tbx z3.b, z28.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272f82 // tbx z2.b, z28.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262f81 // tbx z1.b, z28.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252f80 // tbx z0.b, z28.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2fa9 // tbx z9.b, z29.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2fa4 // tbx z4.b, z29.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282fa3 // tbx z3.b, z29.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272fa2 // tbx z2.b, z29.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262fa1 // tbx z1.b, z29.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252fa0 // tbx z0.b, z29.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "addvl x21, x21, #-6\n"
        ".inst 0x052b2fc9 // tbx z9.b, z30.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2fc4 // tbx z4.b, z30.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282fc3 // tbx z3.b, z30.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272fc2 // tbx z2.b, z30.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262fc1 // tbx z1.b, z30.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252fc0 // tbx z0.b, z30.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "cmp x21, XZR\n"
        ".inst 0x052b2fe9 // tbx z9.b, z31.b, z11.b\n"
        ".inst 0x052a2fe4 // tbx z4.b, z31.b, z10.b\n"
        ".inst 0x05282fe3 // tbx z3.b, z31.b, z8.b\n"
        "st1b { z9.b }, p5, [x22]\n"
        ".inst 0x05272fe2 // tbx z2.b, z31.b, z7.b\n"
        ".inst 0x05262fe1 // tbx z1.b, z31.b, z6.b\n"
        "st1b { z4.b }, p4, [x22, #1, MUL VL]\n"
        ".inst 0x05252fe0 // tbx z0.b, z31.b, z5.b\n"
        "st1b { z3.b }, p3, [x22, #2, MUL VL]\n"
        "addvl x23, x23, #6\n"
        "st1b { z2.b }, p2, [x22, #3, MUL VL]\n"
        "st1b { z1.b }, p1, [x22, #4, MUL VL]\n"
        "st1b { z0.b }, p0, [x22, #5, MUL VL]\n"
        "addvl x22, x22, #6\n"
        "bgt 3b\n"
        "b 17f\n"
        "5:" // 256 bits
        "mov z12.b, #0x20\n"
        "mov x21, %x[string_length]\n"
        "ptrue p5.b\n"
        "ptrue p4.b\n"
        "ptrue p3.b\n"
        "ptrue p2.b\n"
        "ptrue p1.b\n"
        "ptrue p0.b\n"
        "6:" // 8 rounds: width loop
        "addvl x20, x21, #-6\n"
        "cmp x20, XZR\n"
        "bge 7f\n"
        "mov x20, #0x0\n"
        "addvl x20, x20, #1\n"
        "whilelt p5.b, XZR, x21\n"
        "whilelt p4.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p3.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p2.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p1.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p0.b, x20, x21\n"
        "7:" // 8 rounds: predicate OK
        "ld1b { z11.b }, p5/Z, [x23]\n"
        "ld1b { z10.b }, p4/Z, [x23, #1, MUL VL]\n"
        "tbl z9.b, { z16.b }, z11.b\n"
        "ld1b { z8.b }, p3/Z, [x23, #2, MUL VL]\n"
        "ld1b { z7.b }, p2/Z, [x23, #3, MUL VL]\n"
        "sub z11.b, z11.b, z12.b\n"
        "ld1b { z6.b }, p1/Z, [x23, #4, MUL VL]\n"
        "ld1b { z5.b }, p0/Z, [x23, #5, MUL VL]\n"
        "tbl z4.b, { z16.b }, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        "tbl z3.b, { z16.b }, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        "tbl z2.b, { z16.b }, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        "tbl z1.b, { z16.b }, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        "tbl z0.b, { z16.b }, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e29 // tbx z9.b, z17.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e24 // tbx z4.b, z17.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e23 // tbx z3.b, z17.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e22 // tbx z2.b, z17.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e21 // tbx z1.b, z17.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e20 // tbx z0.b, z17.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e49 // tbx z9.b, z18.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e44 // tbx z4.b, z18.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e43 // tbx z3.b, z18.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e42 // tbx z2.b, z18.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e41 // tbx z1.b, z18.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e40 // tbx z0.b, z18.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e69 // tbx z9.b, z19.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e64 // tbx z4.b, z19.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e63 // tbx z3.b, z19.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e62 // tbx z2.b, z19.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e61 // tbx z1.b, z19.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e60 // tbx z0.b, z19.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e89 // tbx z9.b, z20.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e84 // tbx z4.b, z20.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e83 // tbx z3.b, z20.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e82 // tbx z2.b, z20.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e81 // tbx z1.b, z20.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e80 // tbx z0.b, z20.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2ea9 // tbx z9.b, z21.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2ea4 // tbx z4.b, z21.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282ea3 // tbx z3.b, z21.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272ea2 // tbx z2.b, z21.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262ea1 // tbx z1.b, z21.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252ea0 // tbx z0.b, z21.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "addvl x21, x21, #-6\n"
        ".inst 0x052b2ec9 // tbx z9.b, z22.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2ec4 // tbx z4.b, z22.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282ec3 // tbx z3.b, z22.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272ec2 // tbx z2.b, z22.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262ec1 // tbx z1.b, z22.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252ec0 // tbx z0.b, z22.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "cmp x21, XZR\n"
        ".inst 0x052b2ee9 // tbx z9.b, z23.b, z11.b\n"
        ".inst 0x052a2ee4 // tbx z4.b, z23.b, z10.b\n"
        ".inst 0x05282ee3 // tbx z3.b, z23.b, z8.b\n"
        "st1b { z9.b }, p5, [x22]\n"
        ".inst 0x05272ee2 // tbx z2.b, z23.b, z7.b\n"
        ".inst 0x05262ee1 // tbx z1.b, z23.b, z6.b\n"
        "st1b { z4.b }, p4, [x22, #1, MUL VL]\n"
        ".inst 0x05252ee0 // tbx z0.b, z23.b, z5.b\n"
        "st1b { z3.b }, p3, [x22, #2, MUL VL]\n"
        "addvl x23, x23, #6\n"
        "st1b { z2.b }, p2, [x22, #3, MUL VL]\n"
        "st1b { z1.b }, p1, [x22, #4, MUL VL]\n"
        "st1b { z0.b }, p0, [x22, #5, MUL VL]\n"
        "addvl x22, x22, #6\n"
        "bgt 6b\n"
        "b 17f\n"
        "8:" // 512 bits
        "mov z12.b, #0x40\n"
        "mov x21, %x[string_length]\n"
        "ptrue p5.b\n"
        "ptrue p4.b\n"
        "ptrue p3.b\n"
        "ptrue p2.b\n"
        "ptrue p1.b\n"
        "ptrue p0.b\n"
        "9:" // 4 rounds: width loop
        "addvl x20, x21, #-6\n"
        "cmp x20, XZR\n"
        "bge 10f\n"
        "mov x20, #0x0\n"
        "addvl x20, x20, #1\n"
        "whilelt p5.b, XZR, x21\n"
        "whilelt p4.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p3.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p2.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p1.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p0.b, x20, x21\n"
        "10:" // 4 rounds: predicate OK
        "ld1b { z11.b }, p5/Z, [x23]\n"
        "ld1b { z10.b }, p4/Z, [x23, #1, MUL VL]\n"
        "tbl z9.b, { z16.b }, z11.b\n"
        "ld1b { z8.b }, p3/Z, [x23, #2, MUL VL]\n"
        "ld1b { z7.b }, p2/Z, [x23, #3, MUL VL]\n"
        "sub z11.b, z11.b, z12.b\n"
        "ld1b { z6.b }, p1/Z, [x23, #4, MUL VL]\n"
        "ld1b { z5.b }, p0/Z, [x23, #5, MUL VL]\n"
        "tbl z4.b, { z16.b }, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        "tbl z3.b, { z16.b }, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        "tbl z2.b, { z16.b }, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        "tbl z1.b, { z16.b }, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        "tbl z0.b, { z16.b }, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        ".inst 0x052b2e29 // tbx z9.b, z17.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e24 // tbx z4.b, z17.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e23 // tbx z3.b, z17.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e22 // tbx z2.b, z17.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e21 // tbx z1.b, z17.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e20 // tbx z0.b, z17.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "addvl x21, x21, #-6\n"
        ".inst 0x052b2e49 // tbx z9.b, z18.b, z11.b\n"
        "sub z11.b, z11.b, z12.b\n"
        ".inst 0x052a2e44 // tbx z4.b, z18.b, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        ".inst 0x05282e43 // tbx z3.b, z18.b, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        ".inst 0x05272e42 // tbx z2.b, z18.b, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        ".inst 0x05262e41 // tbx z1.b, z18.b, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        ".inst 0x05252e40 // tbx z0.b, z18.b, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "cmp x21, XZR\n"
        ".inst 0x052b2e69 // tbx z9.b, z19.b, z11.b\n"
        ".inst 0x052a2e64 // tbx z4.b, z19.b, z10.b\n"
        ".inst 0x05282e63 // tbx z3.b, z19.b, z8.b\n"
        "st1b { z9.b }, p5, [x22]\n"
        ".inst 0x05272e62 // tbx z2.b, z19.b, z7.b\n"
        ".inst 0x05262e61 // tbx z1.b, z19.b, z6.b\n"
        "st1b { z4.b }, p4, [x22, #1, MUL VL]\n"
        ".inst 0x05252e60 // tbx z0.b, z19.b, z5.b\n"
        "st1b { z3.b }, p3, [x22, #2, MUL VL]\n"
        "addvl x23, x23, #6\n"
        "st1b { z2.b }, p2, [x22, #3, MUL VL]\n"
        "st1b { z1.b }, p1, [x22, #4, MUL VL]\n"
        "st1b { z0.b }, p0, [x22, #5, MUL VL]\n"
        "addvl x22, x22, #6\n"
        "bgt 9b\n"
        "b 17f\n"
        "11:" // 1024 bits
        "mov z12.b, #0x80\n"
        "mov x21, %x[string_length]\n"
        "ptrue p5.b\n"
        "ptrue p4.b\n"
        "ptrue p3.b\n"
        "ptrue p2.b\n"
        "ptrue p1.b\n"
        "ptrue p0.b\n"
        "12:" // 2 rounds: width loop
        "addvl x20, x21, #-6\n"
        "cmp x20, XZR\n"
        "bge 13f\n"
        "mov x20, #0x0\n"
        "addvl x20, x20, #1\n"
        "whilelt p5.b, XZR, x21\n"
        "whilelt p4.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p3.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p2.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p1.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p0.b, x20, x21\n"
        "13:" // 2 rounds: predicate OK
        "ld1b { z11.b }, p5/Z, [x23]\n"
        "ld1b { z10.b }, p4/Z, [x23, #1, MUL VL]\n"
        "addvl x21, x21, #-6\n"
        "ld1b { z8.b }, p3/Z, [x23, #2, MUL VL]\n"
        "ld1b { z7.b }, p2/Z, [x23, #3, MUL VL]\n"
        "tbl z9.b, { z16.b }, z11.b\n"
        "ld1b { z6.b }, p1/Z, [x23, #4, MUL VL]\n"
        "ld1b { z5.b }, p0/Z, [x23, #5, MUL VL]\n"
        "sub z11.b, z11.b, z12.b\n"
        "tbl z4.b, { z16.b }, z10.b\n"
        "sub z10.b, z10.b, z12.b\n"
        "tbl z3.b, { z16.b }, z8.b\n"
        "sub z8.b, z8.b, z12.b\n"
        "tbl z2.b, { z16.b }, z7.b\n"
        "sub z7.b, z7.b, z12.b\n"
        "tbl z1.b, { z16.b }, z6.b\n"
        "sub z6.b, z6.b, z12.b\n"
        "tbl z0.b, { z16.b }, z5.b\n"
        "sub z5.b, z5.b, z12.b\n"
        "cmp x21, XZR\n"
        ".inst 0x052b2e29 // tbx z9.b, z17.b, z11.b\n"
        ".inst 0x052a2e24 // tbx z4.b, z17.b, z10.b\n"
        ".inst 0x05282e23 // tbx z3.b, z17.b, z8.b\n"
        "st1b { z9.b }, p5, [x22]\n"
        ".inst 0x05272e22 // tbx z2.b, z17.b, z7.b\n"
        ".inst 0x05262e21 // tbx z1.b, z17.b, z6.b\n"
        "st1b { z4.b }, p4, [x22, #1, MUL VL]\n"
        ".inst 0x05252e20 // tbx z0.b, z17.b, z5.b\n"
        "st1b { z3.b }, p3, [x22, #2, MUL VL]\n"
        "addvl x23, x23, #6\n"
        "st1b { z2.b }, p2, [x22, #3, MUL VL]\n"
        "st1b { z1.b }, p1, [x22, #4, MUL VL]\n"
        "st1b { z0.b }, p0, [x22, #5, MUL VL]\n"
        "addvl x22, x22, #6\n"
        "bgt 12b\n"
        "b 17f\n"
        "14:" // 2048 bits
        "mov x21, %x[string_length]\n"
        "ptrue p5.b\n"
        "ptrue p4.b\n"
        "ptrue p3.b\n"
        "ptrue p2.b\n"
        "ptrue p1.b\n"
        "ptrue p0.b\n"
        "15:" // 1 rounds: width loop
        "addvl x20, x21, #-6\n"
        "cmp x20, XZR\n"
        "bge 16f\n"
        "mov x20, #0x0\n"
        "addvl x20, x20, #1\n"
        "whilelt p5.b, XZR, x21\n"
        "whilelt p4.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p3.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p2.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p1.b, x20, x21\n"
        "addvl x20, x20, #1\n"
        "whilelt p0.b, x20, x21\n"
        "16:" // 1 rounds: predicate OK
        "addvl x21, x21, #-6\n"
        "ld1b { z11.b }, p5/Z, [x23]\n"
        "ld1b { z10.b }, p4/Z, [x23, #1, MUL VL]\n"
        "ld1b { z8.b }, p3/Z, [x23, #2, MUL VL]\n"
        "ld1b { z7.b }, p2/Z, [x23, #3, MUL VL]\n"
        "cmp x21, XZR\n"
        "ld1b { z6.b }, p1/Z, [x23, #4, MUL VL]\n"
        "ld1b { z5.b }, p0/Z, [x23, #5, MUL VL]\n"
        "tbl z9.b, { z16.b }, z11.b\n"
        "tbl z4.b, { z16.b }, z10.b\n"
        "tbl z3.b, { z16.b }, z8.b\n"
        "st1b { z9.b }, p5, [x22]\n"
        "tbl z2.b, { z16.b }, z7.b\n"
        "tbl z1.b, { z16.b }, z6.b\n"
        "st1b { z4.b }, p4, [x22, #1, MUL VL]\n"
        "tbl z0.b, { z16.b }, z5.b\n"
        "st1b { z3.b }, p3, [x22, #2, MUL VL]\n"
        "addvl x23, x23, #6\n"
        "st1b { z2.b }, p2, [x22, #3, MUL VL]\n"
        "st1b { z1.b }, p1, [x22, #4, MUL VL]\n"
        "st1b { z0.b }, p0, [x22, #5, MUL VL]\n"
        "addvl x22, x22, #6\n"
        "bgt 15b\n"
        "17:" // SVE body done
        "add x24, x24, #0x1\n"
        "cmp x24, %x[num_strings]\n"
        "bne 2b\n"
        : [table] "+&r"(table)
        : [input] "r"(input), [num_strings] "r"(num_strings), [output] "r"(output), [string_length] "r"(string_length)
        : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "x20", "x21", "x22", "x23", "x24", "x25", "z0", "z1",
          "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z16", "z17", "z18", "z19", "z20", "z21",
          "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31");
}

} // namespace cpu
} // namespace arm_compute

#endif // ARM_COMPUTE_ENABLE_SVE
#endif // __aarch64__