aboutsummaryrefslogtreecommitdiff
path: root/test/armv8/a64.rs
blob: 8b40a205e6c359792abf9f217762c6459a0861f3 (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
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
use yaxpeax_arch::{Arch, Decoder, LengthedInstruction};
use yaxpeax_arm::armv8::a64::{ARMv8, Instruction, Operand, Opcode, SizeCode, ShiftStyle};
use yaxpeax_arm::armv8::a64::DecodeError;

use std::fmt;

fn test_decode(data: [u8; 4], expected: Instruction) {
    let mut reader = yaxpeax_arch::U8Reader::new(&data[..]);
    let instr = <ARMv8 as Arch>::Decoder::default().decode(&mut reader).unwrap();
    assert!(
        instr == expected,
        "decode error for {:02x}{:02x}{:02x}{:02x}:\n  decoded: {:?}\n expected: {:?}\n",
        data[0], data[1], data[2], data[3],
        instr, expected
    );
}

fn test_err(data: [u8; 4], err: DecodeError) {
    let mut reader = yaxpeax_arch::U8Reader::new(&data[..]);
    let result = <ARMv8 as Arch>::Decoder::default().decode(&mut reader);
    assert_eq!(
        result, Err(err),
        "expected IncompleteDecoder error for {:02x}{:02x}{:02x}{:02x}:\n  decoded: {:?}\n",
        data[0], data[1], data[2], data[3],
        result,
    );
}

fn test_display(data: [u8; 4], expected: &'static str) {
    let mut reader = yaxpeax_arch::U8Reader::new(&data[..]);
    let instr = <ARMv8 as Arch>::Decoder::default().decode(&mut reader).unwrap();
    let text = format!("{}", instr);
    assert!(
        text == expected,
        "display error for {:02x}{:02x}{:02x}{:02x}:\n  decoded: {:?}\n displayed: {}\n expected: {}\n",
        data[0], data[1], data[2], data[3],
        instr,
        text, expected
    );
}

#[test]
fn test_neon() {
    // currently, NEON is incompletely implemented in yaxpeax-arm.
    test_err([0x00, 0x01, 0x27, 0x1e], DecodeError::IncompleteDecoder);
    test_display([0xe0, 0x03, 0x13, 0xaa], "mov x0, x19");
}

#[test]
fn test_unpredictable() {
    // could be stx/ldx but Lo1 is `x1` and invalid.
    test_err([0x00, 0x00, 0x20, 0x08], DecodeError::InvalidOpcode);
    test_err([0x00, 0xfc, 0x00, 0x12], DecodeError::InvalidOperand);
}

#[test]
fn test_display_misc() {
    test_display(
        [0xc0, 0x03, 0x5f, 0xd6],
        "ret"
    );
    test_display(
        [0x1f, 0x20, 0x03, 0xd5],
        "nop"
    );
}

#[test]
fn test_decode_str_ldr() {
    test_decode(
        [0x31, 0x03, 0x40, 0xf9],
        Instruction {
            opcode: Opcode::LDR,
            operands: [
                Operand::Register(SizeCode::X, 17),
                Operand::RegOffset(25, 0),
                Operand::Nothing,
                Operand::Nothing,
            ]
        }
    );
    test_decode(
        [0xf5, 0x5b, 0x00, 0xf9],
        Instruction {
            opcode: Opcode::STR,
            operands: [
                Operand::Register(SizeCode::X, 21),
                Operand::RegOffset(31, 0xb0),
                Operand::Nothing,
                Operand::Nothing,
            ]
        }
    );
    test_decode(
        [0x60, 0x02, 0x0a, 0x39],
        Instruction {
            opcode: Opcode::STRB,
            operands: [
                Operand::Register(SizeCode::W, 0),
                Operand::RegOffset(19, 0x280),
                Operand::Nothing,
                Operand::Nothing,
            ]
        }
    );
    test_decode(
        [0xfd, 0x7b, 0xbe, 0xa9],
        Instruction {
            opcode: Opcode::STP,
            operands: [
                Operand::Register(SizeCode::X, 29),
                Operand::Register(SizeCode::X, 30),
                Operand::RegPreIndex(31, -0x20, true),
                Operand::Nothing,
            ]
        }
    );
}

#[test]
fn test_decode_misc() {
    test_decode(
        [0x22, 0x39, 0x04, 0xb0],
        Instruction {
            opcode: Opcode::ADRP,
            operands: [
                Operand::Register(SizeCode::X, 2),
                Operand::Immediate(0x8725000),
                Operand::Nothing,
                Operand::Nothing
            ]
        }
    );
    test_display(
        [0x1d, 0x00, 0x80, 0xd2],
        "movz x29, 0x0"
    );
    test_display(
        [0x13, 0x00, 0x80, 0xd2],
        "movz x19, 0x0"
    );
    test_display(
        [0x1d, 0xff, 0xff, 0xd2],
        "movz x29, 0xfff8, lsl 48"
    );
    test_display(
        [0x22, 0x39, 0x04, 0xb0],
        "adrp x2, 0x8725000"
    );
}

#[ignore]
#[test]
fn test_display_ldr() {
    test_display(
        [0xff, 0xff, 0x00, 0x1c],
        "ldr s31, $+0x1ffc"
    );
    test_display(
        [0xff, 0xff, 0x00, 0x5c],
        "ldr d31, $+0x1ffc"
    );
    test_display(
        [0xff, 0xff, 0x00, 0x9c],
        "ldr q31, $+0x1ffc"
    );
    test_display(
        [0xff, 0xff, 0x00, 0xdc],
        "invalid"
    );
    test_display(
        [0x88, 0xff, 0x00, 0x18],
        "ldr w8, $+0x1ff0"
    );
    test_display(
        [0x88, 0xff, 0x00, 0x58],
        "ldr x8, $+0x1ff0"
    );
    test_display(
        [0x88, 0xff, 0x00, 0x98],
        "ldrsw x8, $+0x1ff0"
    );
    /* TODO:
    test_display(
        [0x88, 0xff, 0x00, 0xd8],
        "prfm plil1keep, 0x1ff0"
    );
    */
}

#[test]
fn test_decode_mov() {
    test_decode(
        [0x20, 0x00, 0x80, 0x52],
        Instruction {
            opcode: Opcode::MOVZ,
            operands: [
                Operand::Register(SizeCode::W, 0),
                Operand::ImmShift(1, 0),
                Operand::Nothing,
                Operand::Nothing
            ]
        }
    );
}

#[test]
fn test_decode_branch() {
    test_decode(
        [0x41, 0x00, 0x00, 0xb4],
        Instruction {
            opcode: Opcode::CBZ,
            operands: [
                Operand::Register(SizeCode::X, 1),
                Operand::Offset(8),
                Operand::Nothing,
                Operand::Nothing
            ]
        }
    );
    test_decode(
        [0x62, 0x00, 0x00, 0xb4],
        Instruction {
            opcode: Opcode::CBZ,
            operands: [
                Operand::Register(SizeCode::X, 2),
                Operand::Offset(12),
                Operand::Nothing,
                Operand::Nothing
            ]
        }
    );
    test_decode(
        [0x40, 0x00, 0x1f, 0xd6],
        Instruction {
            opcode: Opcode::BR,
            operands: [
                Operand::Register(SizeCode::X, 2),
                Operand::Nothing,
                Operand::Nothing,
                Operand::Nothing
            ]
        }
    );
}

#[test]
fn test_decode_arithmetic() {
    test_decode(
        [0x21, 0xfc, 0x41, 0x8b],
        Instruction {
            opcode: Opcode::ADD,
            operands: [
                Operand::Register(SizeCode::X, 1),
                Operand::Register(SizeCode::X, 1),
                Operand::RegShift(ShiftStyle::LSR, 63, SizeCode::X, 1),
                Operand::Nothing
            ]
        }
    );
    test_decode(
        [0x21, 0xfc, 0x43, 0x93],
        Instruction {
            opcode: Opcode::SBFM,
            operands: [
                Operand::Register(SizeCode::X, 1),
                Operand::Register(SizeCode::X, 1),
                Operand::Immediate(3),
                Operand::Immediate(63)
            ]
        }
    );
    test_decode(
        [0x3f, 0x38, 0x00, 0xf1],
        Instruction {
            opcode: Opcode::SUBS,
            operands: [
                Operand::Register(SizeCode::X, 31),
                Operand::RegisterOrSP(SizeCode::X, 1),
                Operand::Immediate(0xe),
                Operand::Nothing,
            ]
        }
    );
}

#[test]
fn test_decode_mul() {
}

#[test]
fn test_decode_ccm() {
    test_display([0x00, 0xa8, 0x42, 0x3a], "ccmn w0, 0x2, 0x0, ge");
    test_display([0x00, 0xa8, 0x42, 0xfa], "ccmp x0, 0x2, 0x0, ge");
    test_display([0x00, 0xa0, 0x42, 0xfa], "ccmp x0, x2, 0x0, ge");
    test_display([0x85, 0x80, 0x42, 0xfa], "ccmp x4, x2, 0x5, hi");
}

#[test]
fn test_decode_data_processing_one_source() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x14, 0x02, 0xc0, 0x5a], "rbit w20, w16"),
        ([0x14, 0x06, 0xc0, 0x5a], "rev16 w20, w16"),
        ([0x14, 0x12, 0xc0, 0x5a], "clz w20, w16"),
        ([0x14, 0x12, 0xc0, 0x5a], "clz w20, w16"),
        ([0x14, 0x16, 0xc0, 0x5a], "cls w20, w16"),
        ([0x14, 0x16, 0xc0, 0xda], "cls x20, x16"),
        ([0x14, 0x0a, 0xc0, 0xda], "rev32 x20, x16"),
    ];

    for (bytes, instr) in TESTS {
        test_display(*bytes, instr);
    }

    test_err([0x14, 0x0e, 0xc0, 0x5a], DecodeError::InvalidOpcode);
}

#[test]
fn test_decode_data_processing_three_source() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x11, 0x01, 0x0f, 0x1b], "madd w17, w8, w15, w0"),
        ([0x11, 0x81, 0x0f, 0x1b], "msub w17, w8, w15, w0"),
        ([0x11, 0x81, 0x0f, 0x9b], "msub x17, x8, x15, x0"),
        ([0x11, 0x89, 0x0f, 0x9b], "msub x17, x8, x15, x2"),

        ([0x11, 0x09, 0x2f, 0x9b], "smaddl x17, w8, w15, x2"),
        ([0x11, 0x89, 0x2f, 0x9b], "smsubl x17, w8, w15, x2"),
        ([0x11, 0x09, 0x4f, 0x9b], "smulh x17, w8, w15, x2"),
        ([0x11, 0x09, 0xaf, 0x9b], "umaddl x17, w8, w15, x2"),
        ([0x11, 0x89, 0xaf, 0x9b], "umsubl x17, w8, w15, x2"),
        ([0x11, 0x09, 0xcf, 0x9b], "umulh x17, x8, x15"),
    ];

    for (bytes, instr) in TESTS {
        test_display(*bytes, instr);
    }

    test_err([0x11, 0x81, 0x0f, 0x3b], DecodeError::InvalidOpcode);
}

#[test]
fn test_decode_chrome_entrypoint() {
    // 1400 instructions from the entrypoint of a chrome binary, sorted by
    // instruction word for no good reason.

    test_display(
        [0x00, 0x00, 0x00, 0x00],
        "invalid"
    );
    test_display(
        [0x00, 0x00, 0x20, 0xd4],
        "brk 0x0"
    );
    test_display(
        [0x00, 0x00, 0x80, 0x12],
        "movn w0, 0x0"
    );
    test_display(
        [0x00, 0x01, 0x3f, 0xd6],
        "blr x8"
    );
    test_display(
        [0x00, 0x02, 0x00, 0x36],
        "tbz w0, 0x0, $+0x40"
    );
    test_display(
        [0x00, 0x03, 0x00, 0x35],
        "cbnz w0, $+0x60"
    );
    test_display(
        [0x00, 0x04, 0x00, 0x36],
        "tbz w0, 0x0, $+0x80"
    );
    test_display(
        [0x00, 0x04, 0x40, 0xf9],
        "ldr x0, [x0, 0x8]"
    );
    test_display(
        [0x00, 0x07, 0x00, 0x34],
        "cbz w0, $+0xe0"
    );
    test_display(
        [0x00, 0x08, 0x47, 0xf9],
        "ldr x0, [x0, 0xe10]"
    );
    test_display(
        [0x00, 0x0b, 0x80, 0x52],
        "movz w0, 0x58"
    );
    test_display(
        [0x00, 0x14, 0x42, 0xf9],
        "ldr x0, [x0, 0x428]"
    );
    test_display(
        [0x00, 0x1b, 0x80, 0x52],
        "movz w0, 0xd8"
    );
    test_display(
        [0x00, 0x20, 0x40, 0xf9],
        "ldr x0, [x0, 0x40]"
    );
    test_display(
        [0x00, 0x24, 0x47, 0xf9],
        "ldr x0, [x0, 0xe48]"
    );
    test_display(
        [0x00, 0x2b, 0x03, 0x90],
        "adrp x0, 0x6560000"
    );
    test_display(
        [0x00, 0x34, 0x42, 0xf9],
        "ldr x0, [x0, 0x468]"
    );
    test_display(
        [0x00, 0x39, 0x04, 0xb0],
        "adrp x0, 0x8721000"
    );
    test_display(
        [0x00, 0x3b, 0x04, 0xb0],
        "adrp x0, 0x8761000"
    );
    test_display(
        [0x00, 0x3c, 0x43, 0xf9],
        "ldr x0, [x0, 0x678]"
    );
    test_display(
        [0x00, 0x44, 0x44, 0xf9],
        "ldr x0, [x0, 0x888]"
    );
    test_display(
        [0x00, 0x50, 0x14, 0x91],
        "add x0, x0, 0x514"
    );
    test_display(
        [0x00, 0x54, 0x44, 0xf9],
        "ldr x0, [x0, 0x8a8]"
    );
    test_display(
        [0x00, 0x58, 0x42, 0xf9],
        "ldr x0, [x0, 0x4b0]"
    );
    test_display(
        [0x00, 0x5c, 0x44, 0xf9],
        "ldr x0, [x0, 0x8b8]"
    );
    test_display(
        [0x00, 0x60, 0x1e, 0x91],
        "add x0, x0, 0x798"
    );
    test_display(
        [0x00, 0x70, 0x47, 0xf9],
        "ldr x0, [x0, 0xee0]"
    );
    test_display(
        [0x00, 0x80, 0x1e, 0x91],
        "add x0, x0, 0x7a0"
    );
    test_display(
        [0x00, 0x80, 0x44, 0xf9],
        "ldr x0, [x0, 0x900]"
    );
    test_display(
        [0x00, 0x84, 0x47, 0xf9],
        "ldr x0, [x0, 0xf08]"
    );
    test_display(
        [0x00, 0xac, 0x40, 0xf9],
        "ldr x0, [x0, 0x158]"
    );
    test_display(
        [0x00, 0xc0, 0x09, 0x91],
        "add x0, x0, 0x270"
    );
    test_display(
        [0x00, 0xc4, 0x45, 0xf9],
        "ldr x0, [x0, 0xb88]"
    );
    test_display(
        [0x00, 0xcc, 0x41, 0xf9],
        "ldr x0, [x0, 0x398]"
    );
    test_display(
        [0x00, 0xdc, 0x35, 0x91],
        "add x0, x0, 0xd77"
    );
    test_display(
        [0x00, 0xf4, 0x47, 0xf9],
        "ldr x0, [x0, 0xfe8]"
    );
    test_display(
        [0x01, 0x00, 0x00, 0x14],
        "b $+0x4"
    );
    test_display(
        [0x01, 0x00, 0x40, 0xf9],
        "ldr x1, [x0]"
    );
    test_display(
        [0x01, 0x05, 0x40, 0xf9],
        "ldr x1, [x8, 0x8]"
    );
    test_display(
        [0x01, 0xfb, 0x4b, 0x95],
        "bl $+0x52fec04"
    );
    test_display(
        [0x02, 0x00, 0x00, 0x14],
        "b $+0x8"
    );
    test_display(
        [0x02, 0x00, 0x00, 0x90],
        "adrp x2, 0x0"
    );
    test_display(
        [0x02, 0x00, 0x80, 0x92],
        "movn x2, 0x0"
    );
    test_display(
        [0x02, 0x04, 0xf8, 0x97],
        "bl $+0x7e01008"
    );
    test_display(
        [0x02, 0x2c, 0x80, 0x52],
        "movz w2, 0x160"
    );
    test_display(
        [0x08, 0x00, 0x40, 0xf9],
        "ldr x8, [x0]"
    );
    test_display(
        [0x08, 0x01, 0x40, 0xf9],
        "ldr x8, [x8]"
    );
    test_display(
        [0x08, 0x05, 0x40, 0xf9],
        "ldr x8, [x8, 0x8]"
    );
    test_display(
        [0x08, 0x06, 0xf8, 0x97],
        "bl $+0x7e01820"
    );
    test_display(
        [0x08, 0x09, 0x40, 0xf9],
        "ldr x8, [x8, 0x10]"
    );
    test_display(
        [0x08, 0x1d, 0x40, 0x92],
        "and x8, x8, 0xff"
    );
    test_display(
        [0x08, 0x1f, 0x00, 0x13],
        "sxtb w8, w24"
    );
    test_display(
        [0x08, 0x21, 0x0a, 0x91],
        "add x8, x8, 0x288"
    );
    test_display(
        [0x08, 0x41, 0x00, 0x91],
        "add x8, x8, 0x10"
    );
    test_display(
        [0x08, 0x41, 0x40, 0xf9],
        "ldr x8, [x8, 0x80]"
    );
    test_display(
        [0x08, 0x81, 0x0a, 0x91],
        "add x8, x8, 0x2a0"
    );
    test_display(
        [0x08, 0xa1, 0x11, 0x91],
        "add x8, x8, 0x468"
    );
    test_display(
        [0x08, 0xc1, 0x1e, 0x91],
        "add x8, x8, 0x7b0"
    );
    test_display(
        [0x08, 0xdd, 0x46, 0xf9],
        "ldr x8, [x8, 0xdb8]"
    );
    test_display(
        [0x08, 0xe1, 0x0e, 0x91],
        "add x8, x8, 0x3b8"
    );
    test_display(
        [0x08, 0xf2, 0xff, 0x36],
        "tbz w8, 0x1f, $+0x3fe40"
    );
    test_display(
        [0x09, 0x1f, 0x00, 0x13],
        "sxtb w9, w24"
    );
    test_display(
        [0x09, 0x5d, 0xc0, 0x39],
        "ldrsb w9, [x8, 0x17]"
    );
    test_display(
        [0x0a, 0x2d, 0x40, 0xa9],
        "ldp x10, x11, [x8]"
    );
    test_display(
        [0x0a, 0xf0, 0x8e, 0x94],
        "bl $+0x23bc028"
    );
    test_display(
        [0x13, 0x3b, 0x04, 0xb0],
        "adrp x19, 0x8761000"
    );
    test_display(
        [0x13, 0xfd, 0xdf, 0xc8],
        "ldar x19, [x8]"
    );
    test_display(
        [0x14, 0x05, 0x00, 0xb4],
        "cbz x20, $+0xa0"
    );
    test_display(
        [0x15, 0x05, 0x88, 0x1a],
        "cinc w21, w8, ne"
    );
    test_display(
        [0x17, 0xed, 0x7c, 0x92],
        "and x23, x8, 0xfffffffffffffff0"
    );
    test_display(
        [0x1d, 0x00, 0x80, 0xd2],
        "movz x29, 0x0"
    );
    test_display(
        [0x1e, 0x00, 0x80, 0xd2],
        "movz x30, 0x0"
    );
    test_display(
        [0x1f, 0x00, 0x00, 0x71],
        "cmp w0, 0x0"
    );
    test_display(
        [0x1f, 0x00, 0x14, 0xeb],
        "cmp x0, x20"
    );
    test_display(
        [0x1f, 0x01, 0x00, 0x71],
        "cmp w8, 0x0"
    );
    test_display(
        [0x1f, 0x01, 0x00, 0xf1],
        "cmp x8, 0x0"
    );
    test_display(
        [0x1f, 0x01, 0x09, 0xeb],
        "cmp x8, x9"
    );
    test_display(
        [0x1f, 0x01, 0x0c, 0xeb],
        "cmp x8, x12"
    );
    test_display(
        [0x1f, 0x03, 0x00, 0x71],
        "cmp w24, 0x0"
    );
    test_display(
        [0x1f, 0x0d, 0x00, 0xf1],
        "cmp x8, 0x3"
    );
    test_display(
        [0x1f, 0x20, 0x03, 0xd5],
        "nop"
    );
    test_display(
        [0x20, 0x00, 0x1f, 0xd6],
        "br x1"
    );
    test_display(
        [0x20, 0x00, 0x3f, 0xd6],
        "blr x1"
    );
    test_display(
        [0x20, 0x00, 0x80, 0x52],
        "movz w0, 0x1"
    );
    test_display(
        [0x20, 0xb1, 0x8a, 0x9a],
        "csel x0, x9, x10, lt"
    );
    test_display(
        [0x20, 0xb1, 0x94, 0x9a],
        "csel x0, x9, x20, lt"
    );
    test_display(
        [0x20, 0xb1, 0x95, 0x9a],
        "csel x0, x9, x21, lt"
    );
    test_display(
        [0x21, 0x00, 0x00, 0xcb],
        "sub x1, x1, x0"
    );
    test_display(
        [0x21, 0x01, 0x00, 0x54],
        "b.ne $+0x24"
    );
    test_display(
        [0x21, 0x01, 0x00, 0x54],
        "b.ne $+0x24"
    );
    test_display(
        [0x21, 0x04, 0x36, 0x91],
        "add x1, x1, 0xd81"
    );
    test_display(
        [0x21, 0x10, 0x34, 0x91],
        "add x1, x1, 0xd04"
    );
    test_display(
        [0x21, 0x1c, 0x00, 0x91],
        "add x1, x1, 0x7"
    );
    test_display(
        [0x21, 0x1c, 0x45, 0xf9],
        "ldr x1, [x1, 0xa38]"
    );
    test_display(
        [0x21, 0x1c, 0x46, 0xf9],
        "ldr x1, [x1, 0xc38]"
    );
    test_display(
        [0x21, 0x34, 0x42, 0xf9],
        "ldr x1, [x1, 0x468]"
    );
    test_display(
        [0x21, 0x3c, 0x36, 0x91],
        "add x1, x1, 0xd8f"
    );
    test_display(
        [0x21, 0x90, 0x36, 0x91],
        "add x1, x1, 0xda4"
    );
    test_display(
        [0x21, 0x98, 0x41, 0xf9],
        "ldr x1, [x1, 0x330]"
    );
    test_display(
        [0x21, 0xb4, 0x34, 0x91],
        "add x1, x1, 0xd2d"
    );
    test_display(
        [0x21, 0xc4, 0x40, 0xf9],
        "ldr x1, [x1, 0x188]"
    );
    test_display(
        [0x21, 0xc4, 0x45, 0xf9],
        "ldr x1, [x1, 0xb88]"
    );
    test_display(
        [0x21, 0xd8, 0x40, 0xf9],
        "ldr x1, [x1, 0x1b0]"
    );
    test_display(
        [0x21, 0xd8, 0x47, 0xf9],
        "ldr x1, [x1, 0xfb0]"
    );
    test_display(
        [0x21, 0xe4, 0x40, 0xf9],
        "ldr x1, [x1, 0x1c8]"
    );
    test_display(
        [0x21, 0xf4, 0x36, 0x91],
        "add x1, x1, 0xdbd"
    );
    test_display(
        [0x21, 0xfc, 0x41, 0x8b],
        "add x1, x1, x1, lsr 63"
    );
    test_display(
        [0x21, 0xfc, 0x41, 0x93],
        "asr x1, x1, 0x1"
    );
    test_display(
        [0x21, 0xfc, 0x43, 0x93],
        "asr x1, x1, 0x3"
    );
    test_display(
        [0x21, 0xfc, 0x44, 0xf9],
        "ldr x1, [x1, 0x9f8]"
    );
    test_display(
        [0x22, 0x09, 0x80, 0x52],
        "movz w2, 0x49"
    );
    test_display(
        [0x22, 0xb1, 0x96, 0x9a],
        "csel x2, x9, x22, lt"
    );
    test_display(
        [0x23, 0xb1, 0x96, 0x9a],
        "csel x3, x9, x22, lt"
    );
    test_display(
        [0x24, 0x01, 0x80, 0x52],
        "movz w4, 0x9"
    );
    test_display(
        [0x26, 0x00, 0x00, 0x14],
        "b $+0x98"
    );
    test_display(
        [0x28, 0x02, 0x00, 0x54],
        "b.hi $+0x44"
    );
    test_display(
        [0x28, 0x11, 0x08, 0x8b],
        "add x8, x9, x8, lsl 4"
    );
    test_display(
        [0x28, 0xb1, 0x88, 0x9a],
        "csel x8, x9, x8, lt"
    );
    test_display(
        [0x29, 0x01, 0x40, 0xf9],
        "ldr x9, [x9]"
    );
    test_display(
        [0x29, 0x1d, 0x40, 0x92],
        "and x9, x9, 0xff"
    );
    test_display(
        [0x29, 0xa1, 0x21, 0x91],
        "add x9, x9, 0x868"
    );
    test_display(
        [0x29, 0xc5, 0x46, 0xf9],
        "ldr x9, [x9, 0xd88]"
    );
    test_display(
        [0x29, 0xdd, 0x46, 0xf9],
        "ldr x9, [x9, 0xdb8]"
    );
    test_display(
        [0x2b, 0x1d, 0x00, 0x13],
        "sxtb w11, w9"
    );
    test_display(
        [0x2b, 0xb1, 0x88, 0x9a],
        "csel x11, x9, x8, lt"
    );
    test_display(
        [0x34, 0xb1, 0x94, 0x9a],
        "csel x20, x9, x20, lt"
    );
    test_display(
        [0x35, 0x01, 0x40, 0xb9],
        "ldr w21, [x9]"
    );
    test_display(
        [0x35, 0x03, 0x00, 0xb5],
        "cbnz x21, $+0x64"
    );
    test_display(
        [0x35, 0xb1, 0x95, 0x9a],
        "csel x21, x9, x21, lt"
    );
    test_display(
        [0x3f, 0x01, 0x00, 0x71],
        "cmp w9, 0x0"
    );
    test_display(
        [0x3f, 0x01, 0x08, 0xeb],
        "cmp x9, x8"
    );
    test_display(
        [0x3f, 0x38, 0x00, 0xf1],
        "cmp x1, 0xe"
    );
    test_display(
        [0x40, 0x00, 0x1f, 0xd6],
        "br x2"
    );
    test_display(
        [0x40, 0x21, 0x00, 0x91],
        "add x0, x10, 0x8"
    );
    test_display(
        [0x40, 0x7d, 0x80, 0x52],
        "movz w0, 0x3ea"
    );
    test_display(
        [0x41, 0x01, 0x00, 0x54],
        "b.ne $+0x28"
    );
    test_display(
        [0x41, 0xb1, 0x88, 0x9a],
        "csel x1, x10, x8, lt"
    );
    test_display(
        [0x42, 0x00, 0x1b, 0x91],
        "add x2, x2, 0x6c0"
    );
    test_display(
        [0x42, 0x40, 0x1a, 0x91],
        "add x2, x2, 0x690"
    );
    test_display(
        [0x42, 0x50, 0x41, 0xf9],
        "ldr x2, [x2, 0x2a0]"
    );
    test_display(
        [0x42, 0x7d, 0x80, 0x52],
        "movz w2, 0x3ea"
    );
    test_display(
        [0x42, 0xc0, 0x1b, 0x91],
        "add x2, x2, 0x6f0"
    );
    test_display(
        [0x42, 0xe4, 0x44, 0xf9],
        "ldr x2, [x2, 0x9c8]"
    );
    test_display(
        [0x48, 0xb1, 0x89, 0x9a],
        "csel x8, x10, x9, lt"
    );
    test_display(
        [0x49, 0xb1, 0x89, 0x9a],
        "csel x9, x10, x9, lt"
    );
    test_display(
        [0x4a, 0x1d, 0x00, 0x13],
        "sxtb w10, w10"
    );
    test_display(
        [0x4c, 0xb1, 0x89, 0x9a],
        "csel x12, x10, x9, lt"
    );
    test_display(
        [0x5f, 0x01, 0x00, 0x71],
        "cmp w10, 0x0"
    );
    test_display(
        [0x60, 0x02, 0x00, 0xb9],
        "str w0, [x19]"
    );
    test_display(
        [0x60, 0x02, 0x0a, 0x39],
        "strb w0, [x19, 0x280]"
    );
    test_display(
        [0x60, 0x02, 0x4a, 0x39],
        "ldrb w0, [x19, 0x280]"
    );
    test_display(
        [0x60, 0x22, 0x00, 0x91],
        "add x0, x19, 0x8"
    );
    test_display(
        [0x60, 0x36, 0x40, 0xf9],
        "ldr x0, [x19, 0x68]"
    );
    test_display(
        [0x60, 0x3e, 0x40, 0xf9],
        "ldr x0, [x19, 0x78]"
    );
    test_display(
        [0x61, 0x02, 0x00, 0x12],
        "and w1, w19, 0x1"
    );
    test_display(
        [0x61, 0xb1, 0x88, 0x9a],
        "csel x1, x11, x8, lt"
    );
    test_display(
        [0x62, 0xb1, 0x89, 0x9a],
        "csel x2, x11, x9, lt"
    );
    test_display(
        [0x63, 0x14, 0x42, 0xf9],
        "ldr x3, [x3, 0x428]"
    );
    test_display(
        [0x63, 0x18, 0x16, 0x91],
        "add x3, x3, 0x586"
    );
    test_display(
        [0x63, 0x24, 0x47, 0xf9],
        "ldr x3, [x3, 0xe48]"
    );
    test_display(
        [0x63, 0x44, 0x44, 0xf9],
        "ldr x3, [x3, 0x888]"
    );
    test_display(
        [0x63, 0x5c, 0x21, 0x91],
        "add x3, x3, 0x857"
    );
    test_display(
        [0x63, 0x5c, 0x44, 0xf9],
        "ldr x3, [x3, 0x8b8]"
    );
    test_display(
        [0x63, 0x80, 0x44, 0xf9],
        "ldr x3, [x3, 0x900]"
    );
    test_display(
        [0x63, 0x84, 0x47, 0xf9],
        "ldr x3, [x3, 0xf08]"
    );
    test_display(
        [0x63, 0x88, 0x09, 0x91],
        "add x3, x3, 0x262"
    );
    test_display(
        [0x63, 0xbc, 0x44, 0xf9],
        "ldr x3, [x3, 0x978]"
    );
    test_display(
        [0x63, 0xc4, 0x45, 0xf9],
        "ldr x3, [x3, 0xb88]"
    );
    test_display(
        [0x63, 0xcc, 0x41, 0xf9],
        "ldr x3, [x3, 0x398]"
    );
    test_display(
        [0x63, 0xf4, 0x47, 0xf9],
        "ldr x3, [x3, 0xfe8]"
    );
    test_display(
        [0x68, 0x00, 0xf8, 0x36],
        "tbz w8, 0x1f, $+0x3000c"
    );
    test_display(
        [0x68, 0x01, 0xf8, 0x37],
        "tbnz w8, 0x1f, $+0x3002c"
    );
    test_display(
        [0x68, 0x02, 0x00, 0xf9],
        "str x8, [x19]"
    );
    test_display(
        [0x68, 0x1d, 0x00, 0x13],
        "sxtb w8, w11"
    );
    test_display(
        [0x74, 0x3a, 0x00, 0xf9],
        "str x20, [x19, 0x70]"
    );
    test_display(
        [0x74, 0x3a, 0x40, 0xf9],
        "ldr x20, [x19, 0x70]"
    );
    test_display(
        [0x74, 0x5e, 0x40, 0x39],
        "ldrb w20, [x19, 0x17]"
    );
    test_display(
        [0x75, 0x06, 0x40, 0xf9],
        "ldr x21, [x19, 0x8]"
    );
    test_display(
        [0x75, 0x36, 0x00, 0xf9],
        "str x21, [x19, 0x68]"
    );
    test_display(
        [0x75, 0x36, 0x40, 0xf9],
        "ldr x21, [x19, 0x68]"
    );
    test_display(
        [0x75, 0x3a, 0x40, 0xf9],
        "ldr x21, [x19, 0x70]"
    );
    test_display(
        [0x76, 0x5e, 0x40, 0x39],
        "ldrb w22, [x19, 0x17]"
    );
    test_display(
        [0x7f, 0x01, 0x00, 0x71],
        "cmp w11, 0x0"
    );
    test_display(
        [0x7f, 0x06, 0x00, 0xf1],
        "cmp x19, 0x1"
    );
    test_display(
        [0x7f, 0x1d, 0x00, 0xf1],
        "cmp x11, 0x7"
    );
    test_display(
        [0x80, 0x22, 0x00, 0x91],
        "add x0, x20, 0x8"
    );
    test_display(
        [0x80, 0x3a, 0x40, 0xf9],
        "ldr x0, [x20, 0x70]"
    );
    test_display(
        [0x81, 0x01, 0x00, 0x54],
        "b.ne $+0x30"
    );
    test_display(
        [0x82, 0x02, 0x80, 0x52],
        "movz w2, 0x14"
    );
    test_display(
        [0x84, 0x48, 0x46, 0xf9],
        "ldr x4, [x4, 0xc90]"
    );
    test_display(
        [0x88, 0x02, 0x00, 0xf9],
        "str x8, [x20]"
    );
    test_display(
        [0x88, 0x02, 0x40, 0xf9],
        "ldr x8, [x20]"
    );
    test_display(
        [0x89, 0x5e, 0x40, 0x39],
        "ldrb w9, [x20, 0x17]"
    );
    test_display(
        [0x8a, 0x06, 0x40, 0xf9],
        "ldr x10, [x20, 0x8]"
    );
    test_display(
        [0x93, 0x22, 0x00, 0x91],
        "add x19, x20, 0x8"
    );
    test_display(
        [0x93, 0xfe, 0xdf, 0xc8],
        "ldar x19, [x20]"
    );
    test_display(
        [0x94, 0x00, 0xf8, 0x36],
        "tbz w20, 0x1f, $+0x30010"
    );
    test_display(
        [0x94, 0x22, 0x0a, 0x91],
        "add x20, x20, 0x288"
    );
    test_display(
        [0x94, 0x82, 0x0a, 0x91],
        "add x20, x20, 0x2a0"
    );
    test_display(
        [0x94, 0xa2, 0x11, 0x91],
        "add x20, x20, 0x468"
    );
    test_display(
        [0x96, 0x1e, 0x00, 0x13],
        "sxtb w22, w20"
    );
    test_display(
        [0xa0, 0x03, 0x19, 0xf8],
        "stur x0, [x29, -0x70]"
    );
    test_display(
        [0xa0, 0x03, 0x1a, 0xf8],
        "stur x0, [x29, -0x60]"
    );
    test_display(
        [0xa0, 0x03, 0x58, 0xf8],
        "ldur x0, [x29, -0x80]"
    );
    test_display(
        [0xa0, 0x03, 0x5a, 0xf8],
        "ldur x0, [x29, -0x60]"
    );
    test_display(
        [0xa0, 0x09, 0x40, 0xd4],
        "hlt 0x4d"
    );
    test_display(
        [0xa0, 0x22, 0x00, 0x91],
        "add x0, x21, 0x8"
    );
    test_display(
        [0xa0, 0x23, 0x01, 0xd1],
        "sub x0, x29, 0x48"
    );
    test_display(
        [0xa0, 0x3e, 0x40, 0xf9],
        "ldr x0, [x21, 0x78]"
    );
    test_display(
        [0xa0, 0x83, 0x1a, 0xf8],
        "stur x0, [x29, -0x58]"
    );
    test_display(
        [0xa0, 0x83, 0x58, 0xf8],
        "ldur x0, [x29, -0x78]"
    );
    test_display(
        [0xa0, 0x83, 0x5b, 0xf8],
        "ldur x0, [x29, -0x48]"
    );
    test_display(
        [0xa0, 0xe3, 0x01, 0xd1],
        "sub x0, x29, 0x78"
    );
    test_display(
        [0xa1, 0x23, 0x01, 0xd1],
        "sub x1, x29, 0x48"
    );
    test_display(
        [0xa1, 0x7e, 0x80, 0x52],
        "movz w1, 0x3f5"
    );
    test_display(
        [0xa1, 0x83, 0x01, 0xd1],
        "sub x1, x29, 0x60"
    );
    test_display(
        [0xa1, 0xe3, 0x01, 0xd1],
        "sub x1, x29, 0x78"
    );
    test_display(
        [0xa2, 0x00, 0x00, 0x54],
        "b.hs $+0x14"
    );
    test_display(
        [0xa2, 0x01, 0x80, 0x52],
        "movz w2, 0xd"
    );
    test_display(
        [0xa2, 0x04, 0x80, 0x52],
        "movz w2, 0x25"
    );
    test_display(
        [0xa2, 0x23, 0x01, 0xd1],
        "sub x2, x29, 0x48"
    );
    test_display(
        [0xa2, 0x23, 0x80, 0x52],
        "movz w2, 0x11d"
    );
    test_display(
        [0xa3, 0xe3, 0x01, 0xd1],
        "sub x3, x29, 0x78"
    );
    test_display(
        [0xa8, 0x03, 0x02, 0xd1],
        "sub x8, x29, 0x80"
    );
    test_display(
        [0xa8, 0x23, 0x01, 0xd1],
        "sub x8, x29, 0x48"
    );
    test_display(
        [0xa8, 0x3e, 0x00, 0xf9],
        "str x8, [x21, 0x78]"
    );
    test_display(
        [0xa8, 0x42, 0x00, 0x91],
        "add x8, x21, 0x10"
    );
    test_display(
        [0xa8, 0x73, 0x5b, 0x38],
        "ldurb w8, [x29, -0x49]"
    );
    test_display(
        [0xa8, 0x73, 0xdb, 0x38],
        "ldursb w8, [x29, -0x49]"
    );
    test_display(
        [0xa8, 0x83, 0x01, 0xd1],
        "sub x8, x29, 0x60"
    );
    test_display(
        [0xa8, 0x83, 0x19, 0xf8],
        "stur x8, [x29, -0x68]"
    );
    test_display(
        [0xa8, 0x83, 0x1b, 0xf8],
        "stur x8, [x29, -0x48]"
    );
    test_display(
        [0xa8, 0x83, 0x1c, 0xf8],
        "stur x8, [x29, -0x38]"
    );
    test_display(
        [0xa8, 0x83, 0x1d, 0xf8],
        "stur x8, [x29, -0x28]"
    );
    test_display(
        [0xa8, 0x83, 0x5b, 0xf8],
        "ldur x8, [x29, -0x48]"
    );
    test_display(
        [0xa8, 0x83, 0x5c, 0xf8],
        "ldur x8, [x29, -0x38]"
    );
    test_display(
        [0xa8, 0x83, 0x5d, 0xf8],
        "ldur x8, [x29, -0x28]"
    );
    test_display(
        [0xa8, 0xf3, 0x5c, 0x38],
        "ldurb w8, [x29, -0x31]"
    );
    test_display(
        [0xa8, 0xf3, 0xd9, 0x38],
        "ldursb w8, [x29, -0x61]"
    );
    test_display(
        [0xa8, 0xf3, 0xdc, 0x38],
        "ldursb w8, [x29, -0x31]"
    );
    test_display(
        [0xa9, 0x03, 0x5c, 0xf8],
        "ldur x9, [x29, -0x40]"
    );
    test_display(
        [0xa9, 0x83, 0x5a, 0xf8],
        "ldur x9, [x29, -0x58]"
    );
    test_display(
        [0xa9, 0xab, 0x78, 0xa9],
        "ldp x9, x10, [x29, -0x78]"
    );
    test_display(
        [0xa9, 0xaf, 0x78, 0xa9],
        "ldp x9, x11, [x29, -0x78]"
    );
    test_display(
        [0xa9, 0x00, 0x00, 0x54],
        "b.ls $+0x14"
    );
    test_display(
        [0xaa, 0xe3, 0x01, 0xd1],
        "sub x10, x29, 0x78"
    );
    test_display(
        [0xa9, 0xb2, 0x94, 0x9a],
        "csel x9, x21, x20, lt"
    );
    test_display(
        [0xb4, 0x22, 0x03, 0x51],
        "sub w20, w21, 0xc8"
    );
    test_display(
        [0xb4, 0x92, 0x01, 0x51],
        "sub w20, w21, 0x64"
    );
    test_display(
        [0xb5, 0x56, 0x44, 0xf9],
        "ldr x21, [x21, 0x8a8]"
    );
    test_display(
        [0xb5, 0x83, 0x18, 0xf8],
        "stur x21, [x29, -0x78]"
    );
    test_display(
        [0xb5, 0xda, 0x47, 0xf9],
        "ldr x21, [x21, 0xfb0]"
    );
    test_display(
        [0xb5, 0xe3, 0x01, 0xd1],
        "sub x21, x29, 0x78"
    );
    test_display(
        [0xb5, 0xf3, 0x19, 0x38],
        "sturb w21, [x29, -0x61]"
    );
    test_display(
        [0xb6, 0xd7, 0x38, 0xa9],
        "stp x22, x21, [x29, -0x78]"
    );
    test_display(
        [0xb6, 0xe3, 0x01, 0xd1],
        "sub x22, x29, 0x78"
    );
    test_display(
        [0xbf, 0x5e, 0x00, 0xf1],
        "cmp x21, 0x17"
    );
    test_display(
        [0xc0, 0x03, 0x5f, 0xd6],
        "ret"
    );
    test_display(
        [0xc0, 0x09, 0x40, 0xd4],
        "hlt 0x4e"
    );
    test_display(
        [0xc0, 0x42, 0x00, 0x91],
        "add x0, x22, 0x10"
    );
    test_display(
        [0xc0, 0x7e, 0x80, 0x52],
        "movz w0, 0x3f6"
    );
    test_display(
        [0xc0, 0x80, 0x80, 0x52],
        "movz w0, 0x406"
    );
    test_display(
        [0xc2, 0x47, 0x80, 0x52],
        "movz w2, 0x23e"
    );
    test_display(
        [0xc9, 0x1e, 0x00, 0x13],
        "sxtb w9, w22"
    );
    test_display(
        [0xd6, 0x16, 0x43, 0xf9],
        "ldr x22, [x22, 0x628]"
    );
    test_display(
        [0xdf, 0x6a, 0x35, 0x38],
        "strb wzr, [x22, x21]"
    );
    test_display(
        [0xe0, 0x03, 0x00, 0x32],
        "orr w0, wzr, 0x1"
    );
    test_display(
        [0xe0, 0x03, 0x00, 0x91],
        "mov x0, sp"
    );
    test_display(
        [0xe0, 0x03, 0x1f, 0x32],
        "orr w0, wzr, 0x2"
    );
    test_display(
        [0xe0, 0x07, 0x00, 0x32],
        "orr w0, wzr, 0x3"
    );
    test_display(
        [0xe0, 0x07, 0x00, 0xf9],
        "str x0, [sp, 0x8]"
    );
    test_display(
        [0xe0, 0x07, 0x40, 0xf9],
        "ldr x0, [sp, 0x8]"
    );
    test_display(
        [0xe0, 0x09, 0x40, 0xd4],
        "hlt 0x4f"
    );
    test_display(
        [0xe0, 0x0b, 0x00, 0xf9],
        "str x0, [sp, 0x10]"
    );
    test_display(
        [0xe0, 0x0f, 0x00, 0x32],
        "orr w0, wzr, 0xf"
    );
    test_display(
        [0xe0, 0x0f, 0x40, 0xf9],
        "ldr x0, [sp, 0x18]"
    );
    test_display(
        [0xe0, 0x13, 0x40, 0xf9],
        "ldr x0, [sp, 0x20]"
    );
    test_display(
        [0xe0, 0x17, 0x00, 0xf9],
        "str x0, [sp, 0x28]"
    );
    test_display(
        [0xe0, 0x17, 0x9f, 0x1a],
        "cset w0, eq"
    );
    test_display(
        [0xe0, 0x1b, 0x40, 0xf9],
        "ldr x0, [sp, 0x30]"
    );
    test_display(
        [0xe0, 0x1f, 0x40, 0xf9],
        "ldr x0, [sp, 0x38]"
    );
    test_display(
        [0xe0, 0x22, 0x00, 0x91],
        "add x0, x23, 0x8"
    );
    test_display(
        [0xe0, 0x23, 0x00, 0x91],
        "add x0, sp, 0x8"
    );
    test_display(
        [0xe0, 0x23, 0x00, 0xf9],
        "str x0, [sp, 0x40]"
    );
    test_display(
        [0xe0, 0x27, 0x40, 0xf9],
        "ldr x0, [sp, 0x48]"
    );
    test_display(
        [0xe0, 0x33, 0x40, 0xf9],
        "ldr x0, [sp, 0x60]"
    );
    test_display(
        [0xe0, 0x63, 0x00, 0x91],
        "add x0, sp, 0x18"
    );
    test_display(
        [0xe0, 0x83, 0x00, 0x91],
        "add x0, sp, 0x20"
    );
    test_display(
        [0xe0, 0x83, 0x01, 0x91],
        "add x0, sp, 0x60"
    );
    test_display(
        [0xe0, 0xa3, 0x00, 0x91],
        "add x0, sp, 0x28"
    );
    test_display(
        [0xe0, 0xe3, 0x00, 0x91],
        "add x0, sp, 0x38"
    );
    test_display(
        [0xe0, 0xe3, 0x01, 0x91],
        "add x0, sp, 0x78"
    );
    test_display(
        [0xe1, 0x03, 0x1f, 0x32],
        "orr w1, wzr, 0x2"
    );
    test_display(
        [0xe1, 0x03, 0x40, 0xf9],
        "ldr x1, [sp]"
    );
    test_display(
        [0xe1, 0x23, 0x00, 0x91],
        "add x1, sp, 0x8"
    );
    test_display(
        [0xe1, 0x63, 0x00, 0x91],
        "add x1, sp, 0x18"
    );
    test_display(
        [0xe1, 0x83, 0x00, 0x91],
        "add x1, sp, 0x20"
    );
    test_display(
        [0xe1, 0xe3, 0x00, 0x91],
        "add x1, sp, 0x38"
    );
    test_display(
        [0xe1, 0xe3, 0x01, 0x91],
        "add x1, sp, 0x78"
    );
    test_display(
        [0xe2, 0x07, 0x1d, 0x32],
        "orr w2, wzr, 0x18"
    );
    test_display(
        [0xe2, 0x23, 0x00, 0x91],
        "add x2, sp, 0x8"
    );
    test_display(
        [0xe2, 0xe3, 0x00, 0x91],
        "add x2, sp, 0x38"
    );
    test_display(
        [0xe3, 0x03, 0x00, 0x32],
        "orr w3, wzr, 0x1"
    );
    test_display(
        [0xe3, 0x03, 0x1f, 0x32],
        "orr w3, wzr, 0x2"
    );
    test_display(
        [0xe4, 0x07, 0x00, 0x32],
        "orr w4, wzr, 0x3"
    );
    test_display(
        [0xe4, 0x0b, 0x00, 0x32],
        "orr w4, wzr, 0x7"
    );
    test_display(
        [0xe6, 0x03, 0x00, 0x91],
        "mov x6, sp"
    );
    test_display(
        [0xe8, 0x01, 0xf8, 0x37],
        "tbnz w8, 0x1f, $+0x3003c"
    );
    test_display(
        [0xe8, 0x02, 0x41, 0xb2],
        "orr x8, x23, 0x8000000000000000"
    );
    test_display(
        [0xe8, 0x03, 0x00, 0x32],
        "orr w8, wzr, 0x1"
    );
    test_display(
        [0xe8, 0x0f, 0x00, 0xf9],
        "str x8, [sp, 0x18]"
    );
    test_display(
        [0xe8, 0x1f, 0x40, 0xf9],
        "ldr x8, [sp, 0x38]"
    );
    test_display(
        [0xe8, 0x1f, 0xc1, 0x39],
        "ldrsb w8, [sp, 0x47]"
    );
    test_display(
        [0xe8, 0x23, 0x00, 0x91],
        "add x8, sp, 0x8"
    );
    test_display(
        [0xe8, 0x3f, 0x41, 0x39],
        "ldrb w8, [sp, 0x4f]"
    );
    test_display(
        [0xe8, 0x3f, 0xc1, 0x39],
        "ldrsb w8, [sp, 0x4f]"
    );
    test_display(
        [0xe8, 0x63, 0x00, 0x91],
        "add x8, sp, 0x18"
    );
    test_display(
        [0xe8, 0x7f, 0xc0, 0x39],
        "ldrsb w8, [sp, 0x1f]"
    );
    test_display(
        [0xe8, 0x7f, 0xc1, 0x39],
        "ldrsb w8, [sp, 0x5f]"
    );
    test_display(
        [0xe8, 0x83, 0x00, 0x91],
        "add x8, sp, 0x20"
    );
    test_display(
        [0xe8, 0x83, 0x01, 0x91],
        "add x8, sp, 0x60"
    );
    test_display(
        [0xe8, 0xbf, 0xc0, 0x39],
        "ldrsb w8, [sp, 0x2f]"
    );
    test_display(
        [0xe8, 0xdf, 0x41, 0x39],
        "ldrb w8, [sp, 0x77]"
    );
    test_display(
        [0xe8, 0xdf, 0xc0, 0x39],
        "ldrsb w8, [sp, 0x37]"
    );
    test_display(
        [0xe8, 0xdf, 0xc1, 0x39],
        "ldrsb w8, [sp, 0x77]"
    );
    test_display(
        [0xe8, 0xe3, 0x00, 0x91],
        "add x8, sp, 0x38"
    );
    test_display(
        [0xe8, 0xe3, 0x01, 0x91],
        "add x8, sp, 0x78"
    );
    test_display(
        [0xe9, 0x03, 0x01, 0x32],
        "orr w9, wzr, 0x80000000"
    );
    test_display(
        [0xe9, 0x07, 0x40, 0xf9],
        "ldr x9, [sp, 0x8]"
    );
    test_display(
        [0xe9, 0x13, 0x40, 0xf9],
        "ldr x9, [sp, 0x20]"
    );
    test_display(
        [0xe9, 0x1f, 0x40, 0xf9],
        "ldr x9, [sp, 0x38]"
    );
    test_display(
        [0xe9, 0x23, 0x40, 0xf9],
        "ldr x9, [sp, 0x40]"
    );
    test_display(
        [0xe9, 0x37, 0x40, 0xf9],
        "ldr x9, [sp, 0x68]"
    );
    test_display(
        [0xe9, 0xa3, 0x00, 0xb9],
        "str w9, [sp, 0xa0]"
    );
    test_display(
        [0xe9, 0xb2, 0x96, 0x9a],
        "csel x9, x23, x22, lt"
    );
    test_display(
        [0xe9, 0xdf, 0x41, 0x39],
        "ldrb w9, [sp, 0x77]"
    );
    test_display(
        [0xea, 0x37, 0x40, 0xf9],
        "ldr x10, [sp, 0x68]"
    );
    test_display(
        [0xea, 0x63, 0x00, 0x91],
        "add x10, sp, 0x18"
    );
    test_display(
        [0xf3, 0x03, 0x00, 0x91],
        "mov x19, sp"
    );
    test_display(
        [0xf3, 0x0b, 0x40, 0xf9],
        "ldr x19, [sp, 0x10]"
    );
    test_display(
        [0xf3, 0x1b, 0x00, 0xf9],
        "str x19, [sp, 0x30]"
    );
    test_display(
        [0xf3, 0x5b, 0x00, 0xf9],
        "str x19, [sp, 0xb0]"
    );
    test_display(
        [0xf3, 0x5b, 0x40, 0xf9],
        "ldr x19, [sp, 0xb0]"
    );
    test_display(
        [0xf4, 0x07, 0x9f, 0x1a],
        "cset w20, ne"
    );
    test_display(
        [0xf4, 0x0b, 0x00, 0xb9],
        "str w20, [sp, 0x8]"
    );
    test_display(
        [0xf4, 0x4f, 0x01, 0xa9],
        "stp x20, x19, [sp, 0x10]"
    );
    test_display(
        [0xf4, 0x4f, 0x02, 0xa9],
        "stp x20, x19, [sp, 0x20]"
    );
    test_display(
        [0xf4, 0x4f, 0x0c, 0xa9],
        "stp x20, x19, [sp, 0xc0]"
    );
    test_display(
        [0xf4, 0x4f, 0x10, 0xa9],
        "stp x20, x19, [sp, 0x100]"
    );
    test_display(
        [0xf4, 0x4f, 0x16, 0xa9],
        "stp x20, x19, [sp, 0x160]"
    );
    test_display(
        [0xf4, 0x4f, 0x19, 0xa9],
        "stp x20, x19, [sp, 0x190]"
    );
    test_display(
        [0xf4, 0x4f, 0x41, 0xa9],
        "ldp x20, x19, [sp, 0x10]"
    );
    test_display(
        [0xf4, 0x4f, 0x42, 0xa9],
        "ldp x20, x19, [sp, 0x20]"
    );
    test_display(
        [0xf4, 0x4f, 0x4c, 0xa9],
        "ldp x20, x19, [sp, 0xc0]"
    );
    test_display(
        [0xf4, 0x4f, 0x50, 0xa9],
        "ldp x20, x19, [sp, 0x100]"
    );
    test_display(
        [0xf4, 0x4f, 0x56, 0xa9],
        "ldp x20, x19, [sp, 0x160]"
    );
    test_display(
        [0xf4, 0x4f, 0x59, 0xa9],
        "ldp x20, x19, [sp, 0x190]"
    );
    test_display(
        [0xf4, 0x4f, 0xbe, 0xa9],
        "stp x20, x19, [sp, -0x20]!"
    );
    test_display(
        [0xf4, 0x4f, 0xc2, 0xa8],
        "ldp x20, x19, [sp], 0x20"
    );
    test_display(
        [0xf4, 0xb2, 0x96, 0x9a],
        "csel x20, x23, x22, lt"
    );
    test_display(
        [0xf4, 0xe3, 0x00, 0x91],
        "add x20, sp, 0x38"
    );
    test_display(
        [0xf5, 0x03, 0x00, 0x32],
        "orr w21, wzr, 0x1"
    );
    test_display(
        [0xf5, 0x03, 0x00, 0xf9],
        "str x21, [sp]"
    );
    test_display(
        [0xf5, 0x03, 0x1f, 0x32],
        "orr w21, wzr, 0x2"
    );
    test_display(
        [0xf5, 0x07, 0x00, 0xf9],
        "str x21, [sp, 0x8]"
    );
    test_display(
        [0xf5, 0x07, 0x43, 0xf8],
        "ldr x21, [sp], 0x30"
    );
    test_display(
        [0xf5, 0x0f, 0x1d, 0xf8],
        "str x21, [sp, -0x30]!"
    );
    test_display(
        [0xf5, 0x13, 0x00, 0xf9],
        "str x21, [sp, 0x20]"
    );
    test_display(
        [0xf5, 0x5b, 0x00, 0xf9],
        "str x21, [sp, 0xb0]"
    );
    test_display(
        [0xf5, 0x5b, 0x40, 0xf9],
        "ldr x21, [sp, 0xb0]"
    );
    test_display(
        [0xf5, 0x83, 0x00, 0x91],
        "add x21, sp, 0x20"
    );
    test_display(
        [0xf5, 0xa3, 0x00, 0x91],
        "add x21, sp, 0x28"
    );
    test_display(
        [0xf6, 0x1f, 0x00, 0xf9],
        "str x22, [sp, 0x38]"
    );
    test_display(
        [0xf6, 0x23, 0x00, 0x91],
        "add x22, sp, 0x8"
    );
    test_display(
        [0xf6, 0x57, 0x0f, 0xa9],
        "stp x22, x21, [sp, 0xf0]"
    );
    test_display(
        [0xf6, 0x57, 0x15, 0xa9],
        "stp x22, x21, [sp, 0x150]"
    );
    test_display(
        [0xf6, 0x57, 0x18, 0xa9],
        "stp x22, x21, [sp, 0x180]"
    );
    test_display(
        [0xf6, 0x57, 0x4f, 0xa9],
        "ldp x22, x21, [sp, 0xf0]"
    );
    test_display(
        [0xf6, 0x57, 0x55, 0xa9],
        "ldp x22, x21, [sp, 0x150]"
    );
    test_display(
        [0xf6, 0x57, 0x58, 0xa9],
        "ldp x22, x21, [sp, 0x180]"
    );
    test_display(
        [0xf6, 0x57, 0xbd, 0xa9],
        "stp x22, x21, [sp, -0x30]!"
    );
    test_display(
        [0xf6, 0x57, 0xc3, 0xa8],
        "ldp x22, x21, [sp], 0x30"
    );
    test_display(
        [0xf6, 0xe3, 0x00, 0x91],
        "add x22, sp, 0x38"
    );
    test_display(
        [0xf7, 0xe3, 0x00, 0x91],
        "add x23, sp, 0x38"
    );
    test_display(
        [0xf8, 0x5f, 0x14, 0xa9],
        "stp x24, x23, [sp, 0x140]"
    );
    test_display(
        [0xf8, 0x5f, 0x54, 0xa9],
        "ldp x24, x23, [sp, 0x140]"
    );
    test_display(
        [0xfc, 0x5f, 0x0e, 0xa9],
        "stp x28, x23, [sp, 0xe0]"
    );
    test_display(
        [0xfc, 0x5f, 0x17, 0xa9],
        "stp x28, x23, [sp, 0x170]"
    );
    test_display(
        [0xfc, 0x5f, 0x4e, 0xa9],
        "ldp x28, x23, [sp, 0xe0]"
    );
    test_display(
        [0xfc, 0x5f, 0x57, 0xa9],
        "ldp x28, x23, [sp, 0x170]"
    );
    test_display(
        [0xfc, 0x9b, 0x00, 0xf9],
        "str x28, [sp, 0x130]"
    );
    test_display(
        [0xfd, 0x03, 0x00, 0x91],
        "mov x29, sp"
    );
    test_display(
        [0xfd, 0x03, 0x03, 0x91],
        "add x29, sp, 0xc0"
    );
    test_display(
        [0xfd, 0x43, 0x00, 0x91],
        "add x29, sp, 0x10"
    );
    test_display(
        [0xfd, 0x43, 0x03, 0x91],
        "add x29, sp, 0xd0"
    );
    test_display(
        [0xfd, 0x43, 0x04, 0x91],
        "add x29, sp, 0x110"
    );
    test_display(
        [0xfd, 0x7b, 0x01, 0xa9],
        "stp x29, x30, [sp, 0x10]"
    );
    test_display(
        [0xfd, 0x7b, 0x02, 0xa9],
        "stp x29, x30, [sp, 0x20]"
    );
    test_display(
        [0xfd, 0x7b, 0x03, 0xa9],
        "stp x29, x30, [sp, 0x30]"
    );
    test_display(
        [0xfd, 0x7b, 0x0c, 0xa9],
        "stp x29, x30, [sp, 0xc0]"
    );
    test_display(
        [0xfd, 0x7b, 0x0d, 0xa9],
        "stp x29, x30, [sp, 0xd0]"
    );
    test_display(
        [0xfd, 0x7b, 0x11, 0xa9],
        "stp x29, x30, [sp, 0x110]"
    );
    test_display(
        [0xfd, 0x7b, 0x17, 0xa9],
        "stp x29, x30, [sp, 0x170]"
    );
    test_display(
        [0xfd, 0x7b, 0x1a, 0xa9],
        "stp x29, x30, [sp, 0x1a0]"
    );
    test_display(
        [0xfd, 0x7b, 0x41, 0xa9],
        "ldp x29, x30, [sp, 0x10]"
    );
    test_display(
        [0xfd, 0x7b, 0x42, 0xa9],
        "ldp x29, x30, [sp, 0x20]"
    );
    test_display(
        [0xfd, 0x7b, 0x43, 0xa9],
        "ldp x29, x30, [sp, 0x30]"
    );
    test_display(
        [0xfd, 0x7b, 0x4c, 0xa9],
        "ldp x29, x30, [sp, 0xc0]"
    );
    test_display(
        [0xfd, 0x7b, 0x4d, 0xa9],
        "ldp x29, x30, [sp, 0xd0]"
    );
    test_display(
        [0xfd, 0x7b, 0x51, 0xa9],
        "ldp x29, x30, [sp, 0x110]"
    );
    test_display(
        [0xfd, 0x7b, 0x57, 0xa9],
        "ldp x29, x30, [sp, 0x170]"
    );
    test_display(
        [0xfd, 0x7b, 0x5a, 0xa9],
        "ldp x29, x30, [sp, 0x1a0]"
    );
    test_display(
        [0xfd, 0x7b, 0xbe, 0xa9],
        "stp x29, x30, [sp, -0x20]!"
    );
    test_display(
        [0xfd, 0x7b, 0xbf, 0xa9],
        "stp x29, x30, [sp, -0x10]!"
    );
    test_display(
        [0xfd, 0x7b, 0xc1, 0xa8],
        "ldp x29, x30, [sp], 0x10"
    );
    test_display(
        [0xfd, 0x7b, 0xc2, 0xa8],
        "ldp x29, x30, [sp], 0x20"
    );
    test_display(
        [0xfd, 0x83, 0x00, 0x91],
        "add x29, sp, 0x20"
    );
    test_display(
        [0xfd, 0x83, 0x06, 0x91],
        "add x29, sp, 0x1a0"
    );
    test_display(
        [0xfd, 0xc3, 0x00, 0x91],
        "add x29, sp, 0x30"
    );
    test_display(
        [0xfd, 0xc3, 0x05, 0x91],
        "add x29, sp, 0x170"
    );
    test_display(
        [0xff, 0x1f, 0x00, 0xf9],
        "str xzr, [sp, 0x38]"
    );
    test_display(
        [0xe3, 0x07, 0x00, 0x32],
        "orr w3, wzr, 0x3"
    );
    test_display(
        [0xff, 0xff, 0x01, 0xa9],
        "stp xzr, xzr, [sp, 0x18]"
    );
    test_display(
        [0x7f, 0x02, 0x00, 0xb9],
        "str wzr, [x19]"
    );
    test_display(
        [0x7f, 0x36, 0x00, 0xf9],
        "str xzr, [x19, 0x68]"
    );
    test_display(
        [0x7f, 0x3a, 0x00, 0xf9],
        "str xzr, [x19, 0x70]"
    );
    test_display(
        [0x7f, 0x3e, 0x00, 0xf9],
        "str xzr, [x19, 0x78]"
    );
    test_display(
        [0x9f, 0x3e, 0x00, 0xf9],
        "str xzr, [x20, 0x78]"
    );
    test_display(
        [0x9f, 0xfe, 0x06, 0xa9],
        "stp xzr, xzr, [x20, 0x68]"
    );
    test_display(
        [0xbf, 0x03, 0x18, 0xf8],
        "stur xzr, [x29, -0x80]"
    );
    test_display(
        [0xbf, 0x42, 0x00, 0xb1],
        "cmn x21, 0x10"
    );
    test_display(
        [0xbf, 0x83, 0x19, 0xf8],
        "stur xzr, [x29, -0x68]"
    );
    test_display(
        [0xbf, 0xff, 0x38, 0xa9],
        "stp xzr, xzr, [x29, -0x78]"
    );
    test_display(
        [0xff, 0x03, 0x01, 0x91],
        "add sp, sp, 0x40"
    );
    test_display(
        [0xff, 0x03, 0x01, 0xd1],
        "sub sp, sp, 0x40"
    );
    test_display(
        [0xff, 0x03, 0x06, 0x91],
        "add sp, sp, 0x180"
    );
    test_display(
        [0xff, 0x03, 0x06, 0xd1],
        "sub sp, sp, 0x180"
    );
    test_display(
        [0xff, 0x43, 0x01, 0xd1],
        "sub sp, sp, 0x50"
    );
    test_display(
        [0xff, 0x43, 0x03, 0x91],
        "add sp, sp, 0xd0"
    );
    test_display(
        [0xff, 0x43, 0x03, 0xd1],
        "sub sp, sp, 0xd0"
    );
    test_display(
        [0xff, 0x83, 0x03, 0x91],
        "add sp, sp, 0xe0"
    );
    test_display(
        [0xff, 0x83, 0x03, 0xd1],
        "sub sp, sp, 0xe0"
    );
    test_display(
        [0xff, 0x83, 0x04, 0x91],
        "add sp, sp, 0x120"
    );
    test_display(
        [0xff, 0x83, 0x04, 0xd1],
        "sub sp, sp, 0x120"
    );
    test_display(
        [0xff, 0xc3, 0x00, 0x91],
        "add sp, sp, 0x30"
    );
    test_display(
        [0xff, 0xc3, 0x00, 0xd1],
        "sub sp, sp, 0x30"
    );
    test_display(
        [0xff, 0xc3, 0x06, 0x91],
        "add sp, sp, 0x1b0"
    );
    test_display(
        [0xff, 0xc3, 0x06, 0xd1],
        "sub sp, sp, 0x1b0"
    );
    test_display(
        [0xe0, 0x03, 0x01, 0xaa],
        "mov x0, x1"
    );
    test_display(
        [0xf4, 0x03, 0x00, 0x2a],
        "mov w20, w0"
    );
    test_display(
        [0xe1, 0x03, 0x1f, 0xaa],
        "mov x1, xzr"
    );
    test_display(
        [0xe2, 0x03, 0x1f, 0xaa],
        "mov x2, xzr"
    );
    test_display(
        [0xe3, 0x03, 0x1f, 0xaa],
        "mov x3, xzr"
    );
    test_display(
        [0xe0, 0x03, 0x13, 0x2a],
        "mov w0, w19"
    );
    test_display(
        [0xe0, 0x03, 0x13, 0xaa],
        "mov x0, x19"
    );
    test_display(
        [0xe0, 0x03, 0x14, 0x2a],
        "mov w0, w20"
    );
    test_display(
        [0xe0, 0x03, 0x14, 0xaa],
        "mov x0, x20"
    );
    test_display(
        [0xe0, 0x03, 0x15, 0xaa],
        "mov x0, x21"
    );
    test_display(
        [0xe0, 0x03, 0x16, 0xaa],
        "mov x0, x22"
    );
    test_display(
        [0xe0, 0x03, 0x17, 0xaa],
        "mov x0, x23"
    );
    test_display(
        [0xe0, 0x03, 0x1f, 0x2a],
        "mov w0, wzr"
    );
    test_display(
        [0xe1, 0x03, 0x00, 0xaa],
        "mov x1, x0"
    );
    test_display(
        [0xe1, 0x03, 0x13, 0xaa],
        "mov x1, x19"
    );
    test_display(
        [0xe1, 0x03, 0x14, 0x2a],
        "mov w1, w20"
    );
    test_display(
        [0xe1, 0x03, 0x14, 0xaa],
        "mov x1, x20"
    );
    test_display(
        [0xe1, 0x03, 0x15, 0x2a],
        "mov w1, w21"
    );
    test_display(
        [0xe1, 0x03, 0x15, 0xaa],
        "mov x1, x21"
    );
    test_display(
        [0xe1, 0x03, 0x16, 0xaa],
        "mov x1, x22"
    );
    test_display(
        [0xe2, 0x03, 0x1f, 0x2a],
        "mov w2, wzr"
    );
    test_display(
        [0xe4, 0x03, 0x00, 0x2a],
        "mov w4, w0"
    );
    test_display(
        [0xe8, 0x03, 0x1f, 0xaa],
        "mov x8, xzr"
    );
    test_display(
        [0xea, 0x03, 0x08, 0x2a],
        "mov w10, w8"
    );
    test_display(
        [0xeb, 0x03, 0x09, 0x2a],
        "mov w11, w9"
    );
    test_display(
        [0xf3, 0x03, 0x00, 0x2a],
        "mov w19, w0"
    );
    test_display(
        [0xf4, 0x03, 0x15, 0x2a],
        "mov w20, w21"
    );
    test_display(
        [0xf4, 0x03, 0x1f, 0x2a],
        "mov w20, wzr"
    );
    test_display(
        [0xf5, 0x03, 0x1f, 0x2a],
        "mov w21, wzr"
    );
    test_display(
        [0xf6, 0x03, 0x14, 0x2a],
        "mov w22, w20"
    );
    test_display(
        [0xf8, 0x03, 0x16, 0x2a],
        "mov w24, w22"
    );
    test_display(
        [0xe2, 0x03, 0x15, 0xaa],
        "mov x2, x21"
    );
    test_display(
        [0xe3, 0x03, 0x14, 0xaa],
        "mov x3, x20"
    );
    test_display(
        [0xe4, 0x03, 0x08, 0xaa],
        "mov x4, x8"
    );
    test_display(
        [0xe4, 0x03, 0x14, 0xaa],
        "mov x4, x20"
    );
    test_display(
        [0xe5, 0x03, 0x00, 0xaa],
        "mov x5, x0"
    );
    test_display(
        [0xe8, 0x03, 0x00, 0xaa],
        "mov x8, x0"
    );
    test_display(
        [0xf3, 0x03, 0x00, 0xaa],
        "mov x19, x0"
    );
    test_display(
        [0xf3, 0x03, 0x01, 0x2a],
        "mov w19, w1"
    );
    test_display(
        [0xf3, 0x03, 0x01, 0xaa],
        "mov x19, x1"
    );
    test_display(
        [0xf3, 0x03, 0x02, 0xaa],
        "mov x19, x2"
    );
    test_display(
        [0xf3, 0x0b, 0x00, 0xf9],
        "str x19, [sp, 0x10]"
    );
    test_display(
        [0xf4, 0x03, 0x00, 0xaa],
        "mov x20, x0"
    );
    test_display(
        [0xf4, 0x03, 0x01, 0xaa],
        "mov x20, x1"
    );
    test_display(
        [0xf5, 0x03, 0x00, 0xaa],
        "mov x21, x0"
    );
    test_display(
        [0xf6, 0x03, 0x00, 0xaa],
        "mov x22, x0"
    );
    test_display(
        [0xf7, 0x03, 0x00, 0xaa],
        "mov x23, x0"
    );
}

static INSTRUCTION_BYTES: [u8; 4 * 61] = [
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x20, 0xd4,
    0x00, 0x00, 0x80, 0x12,
    0x00, 0x01, 0x3f, 0xd6,
    0x00, 0x02, 0x00, 0x36,
    0x00, 0x03, 0x00, 0x35,
    0x00, 0x04, 0x00, 0x36,
    0x00, 0x04, 0x40, 0xf9,
    0x00, 0x07, 0x00, 0x34,
    0x00, 0x08, 0x47, 0xf9,
    0x00, 0x0b, 0x80, 0x52,
    0x00, 0x14, 0x42, 0xf9,
    0x00, 0x1b, 0x80, 0x52,
    0x00, 0x20, 0x40, 0xf9,
    0x00, 0x24, 0x47, 0xf9,
    0x00, 0x2b, 0x03, 0x90,
    0x00, 0x34, 0x42, 0xf9,
    0x00, 0x39, 0x04, 0xb0,
    0x00, 0x3b, 0x04, 0xb0,
    0x00, 0x3c, 0x43, 0xf9,
    0x00, 0x44, 0x44, 0xf9,
    0x00, 0x50, 0x14, 0x91,
    0x00, 0x54, 0x44, 0xf9,
    0x00, 0x58, 0x42, 0xf9,
    0x00, 0x5c, 0x44, 0xf9,
    0x00, 0x60, 0x1e, 0x91,
    0x00, 0x70, 0x47, 0xf9,
    0x00, 0x80, 0x1e, 0x91,
    0x00, 0x80, 0x44, 0xf9,
    0x00, 0x84, 0x47, 0xf9,
    0x00, 0xac, 0x40, 0xf9,
    0x00, 0xc0, 0x09, 0x91,
    0x00, 0xc4, 0x45, 0xf9,
    0x00, 0xcc, 0x41, 0xf9,
    0x00, 0xdc, 0x35, 0x91,
    0x00, 0xf4, 0x47, 0xf9,
    0x01, 0x00, 0x00, 0x14,
    0x01, 0x00, 0x40, 0xf9,
    0x01, 0x05, 0x40, 0xf9,
    0x01, 0xfb, 0x4b, 0x95,
    0x02, 0x00, 0x00, 0x14,
    0x02, 0x00, 0x00, 0x90,
    0x02, 0x00, 0x80, 0x92,
    0x02, 0x04, 0xf8, 0x97,
    0x02, 0x2c, 0x80, 0x52,
    0x08, 0x00, 0x40, 0xf9,
    0x08, 0x01, 0x40, 0xf9,
    0x08, 0x05, 0x40, 0xf9,
    0x08, 0x06, 0xf8, 0x97,
    0x08, 0x09, 0x40, 0xf9,
    0x08, 0x1d, 0x40, 0x92,
    0x08, 0x1f, 0x00, 0x13,
    0x08, 0x21, 0x0a, 0x91,
    0x08, 0x41, 0x00, 0x91,
    0x08, 0x41, 0x40, 0xf9,
    0x08, 0x81, 0x0a, 0x91,
    0x08, 0xa1, 0x11, 0x91,
    0x08, 0xc1, 0x1e, 0x91,
    0x08, 0xdd, 0x46, 0xf9,
    0x08, 0xe1, 0x0e, 0x91,
    0x08, 0xf2, 0xff, 0x36,
];

#[test]
fn test_decode_span() {
    let mut i = 0u64;
    while i < INSTRUCTION_BYTES.len() as u64 {
        let mut reader = yaxpeax_arch::U8Reader::new(&INSTRUCTION_BYTES[i as usize..]);
        let instr = <ARMv8 as Arch>::Decoder::default().decode(&mut reader).unwrap();
        println!(
            "Decoded {:02x}{:02x}{:02x}{:02x}: {}", //{:?}\n  {}",
            INSTRUCTION_BYTES[i as usize],
            INSTRUCTION_BYTES[i as usize + 1],
            INSTRUCTION_BYTES[i as usize + 2],
            INSTRUCTION_BYTES[i as usize + 3],
//            instr,
            instr);
        i += instr.len();
    }
}

/*
use test::Bencher;
#[bench]
pub fn bench_60000_instrs(b: &mut Bencher) {
    b.iter(|| {
        for i in (0..1000) {
            let mut iter = INSTRUCTION_BYTES.iter().map(|x| *x);
            let decoder = <ARMv8 as Arch>::Decoder::default();
            let mut result = Instruction::default();
            loop {
                match decoder.decode_into(&mut result, &mut iter) {
                    Ok(result) => {
                        test::black_box(&result);
                    },
                    Err(_) => {
                        break;
                    }
                }
            }
        }
    });
}
*/

enum ErrorDesc {
    IncorrectDecode([u8; 4], String, String),
    FailedDecode([u8; 4], String, DecodeError),
}

impl fmt::Display for ErrorDesc {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            ErrorDesc::IncorrectDecode(bytes, expected, actual) => {
                writeln!(f, "  decoded incorrect instruction from {:02x}{:02x}{:02x}{:02x}", bytes[0], bytes[1], bytes[2], bytes[3])?;
                writeln!(f, "    expected \"{}\"", expected)?;
                writeln!(f, "    got      \"{}\"", actual)?;
            },
            ErrorDesc::FailedDecode(bytes, expected, err) => {
                writeln!(f, "  decode error for {:02x}{:02x}{:02x}{:02x}", bytes[0], bytes[1], bytes[2], bytes[3])?;
                writeln!(f, "    expected \"{}\"", expected)?;
                writeln!(f, "    got      \"{:?}\"", err)?;
            },
        }

        Ok(())
    }
}

fn run_tests(cases: &[([u8; 4], &'static str)]) -> Vec<ErrorDesc> {
    let decoder = <ARMv8 as Arch>::Decoder::default();

    let mut errors = Vec::new();

    for (bytes, text) in cases {
        let mut reader = yaxpeax_arch::U8Reader::new(&bytes[..]);
        match decoder.decode(&mut reader) {
            Ok(result) => {
                if &result.to_string() != text {
                    errors.push(ErrorDesc::IncorrectDecode(*bytes, text.to_string(), result.to_string()));
                }
            },
            Err(err) => {
                errors.push(ErrorDesc::FailedDecode(*bytes, text.to_string(), err));
            }
        }
    }

    errors
}

#[test]
fn test_openblas_arithmetic() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x61, 0x06, 0x13, 0x0b], "add w1, w19, w19, lsl 1"),
        ([0x05, 0x07, 0x13, 0x0b], "add w5, w24, w19, lsl 1"),
        ([0x08, 0x7d, 0x48, 0x0b], "add w8, w8, w8, lsr 31"),
        ([0x00, 0x04, 0x00, 0x11], "add w0, w0, 0x1"),
        ([0x00, 0x04, 0x01, 0x11], "add w0, w0, 0x41"),
        ([0x5b, 0xff, 0x01, 0x11], "add w27, w26, 0x7f"),
        ([0x02, 0xfc, 0x3f, 0x11], "add w2, w0, 0xfff"),
        ([0x00, 0x00, 0x60, 0x11], "add w0, w0, 0x800000"),
        ([0x0a, 0x0c, 0x00, 0x31], "adds w10, w0, 0x3"),
        ([0x82, 0x00, 0x00, 0x8b], "add x2, x4, x0"),
        ([0x00, 0x35, 0x00, 0x8b], "add x0, x8, x0, lsl 13"),
        ([0x00, 0x00, 0x01, 0x8b], "add x0, x0, x1"),
        ([0xde, 0x03, 0x12, 0x8b], "add x30, x30, x18"),
        ([0x03, 0x04, 0x12, 0x8b], "add x3, x0, x18, lsl 1"),
        ([0x56, 0x06, 0x12, 0x8b], "add x22, x18, x18, lsl 1"),
        ([0x12, 0x08, 0x12, 0x8b], "add x18, x0, x18, lsl 2"),
        ([0x32, 0x08, 0x12, 0x8b], "add x18, x1, x18, lsl 2"),
        ([0x92, 0x13, 0x12, 0x8b], "add x18, x28, x18, lsl 4"),
        ([0x4f, 0x14, 0x12, 0x8b], "add x15, x2, x18, lsl 5"),
        ([0x42, 0x18, 0x12, 0x8b], "add x2, x2, x18, lsl 6"),
        ([0xc6, 0x1c, 0x12, 0x8b], "add x6, x6, x18, lsl 7"),
        ([0x62, 0xce, 0x21, 0x8b], "add x2, x19, w1, sxtw 3"),
        ([0x87, 0xd3, 0x21, 0x8b], "add x7, x28, w1, sxtw 4"),
        ([0x2a, 0x41, 0x22, 0x8b], "add x10, x9, w2, uxtw 0"),
        ([0x18, 0x4f, 0x22, 0x8b], "add x24, x24, w2, uxtw 3"),
        ([0x82, 0x4f, 0x22, 0x8b], "add x2, x28, w2, uxtw 3"),
        ([0xe2, 0x50, 0x22, 0x8b], "add x2, x7, w2, uxtw 4"),
        ([0x20, 0x04, 0x84, 0x8b], "add x0, x1, x4, asr 1"),
        ([0x14, 0x04, 0x94, 0x8b], "add x20, x0, x20, asr 1"),
        ([0xe6, 0x62, 0x00, 0x91], "add x6, x23, 0x18"),
        ([0x00, 0x80, 0x04, 0x91], "add x0, x0, 0x120"),
        ([0xf8, 0x63, 0x06, 0x91], "add x24, sp, 0x198"),
        ([0xb7, 0xfc, 0x3f, 0x91], "add x23, x5, 0xfff"),
        ([0x5a, 0xff, 0x3f, 0x91], "add x26, x26, 0xfff"),
        ([0x7b, 0xff, 0x3f, 0x91], "add x27, x27, 0xfff"),
        ([0x9c, 0xff, 0x3f, 0x91], "add x28, x28, 0xfff"),
        ([0xc6, 0x08, 0x40, 0x91], "add x6, x6, 0x2000"),
        ([0xe8, 0x13, 0x40, 0x91], "add x8, sp, 0x4000"),
        ([0xe2, 0x43, 0x40, 0x91], "add x2, sp, 0x10000"),
        ([0xff, 0x0f, 0x42, 0x91], "add sp, sp, 0x83000"),
        ([0xe1, 0x13, 0x42, 0x91], "add x1, sp, 0x84000"),
        ([0xff, 0x13, 0x42, 0x91], "add sp, sp, 0x84000"),
        ([0x63, 0x02, 0x60, 0x91], "add x3, x19, 0x800000"),
        ([0x03, 0x03, 0x60, 0x91], "add x3, x24, 0x800000"),
        ([0x14, 0x00, 0x13, 0xab], "adds x20, x0, x19"),
        ([0x37, 0x01, 0x1c, 0xab], "adds x23, x9, x28"),
        ([0x0b, 0x08, 0x00, 0x4b], "sub w11, w0, w0, lsl 2"),
        ([0x00, 0x00, 0x01, 0x4b], "sub w0, w0, w1"),
        ([0xfc, 0x03, 0x08, 0x4b], "neg w28, w8"),
        ([0x00, 0x04, 0x08, 0x4b], "sub w0, w0, w8, lsl 1"),
        ([0x81, 0x09, 0x0c, 0x4b], "sub w1, w12, w12, lsl 2"),
        ([0xe0, 0x02, 0x0d, 0x4b], "sub w0, w23, w13"),
        ([0xfb, 0x03, 0x15, 0x4b], "neg w27, w21"),
        ([0x63, 0x04, 0x15, 0x4b], "sub w3, w3, w21, lsl 1"),
        ([0xfc, 0x03, 0x1c, 0x4b], "neg w28, w28"),
        ([0x00, 0x04, 0x1c, 0x4b], "sub w0, w0, w28, lsl 1"),
        ([0x00, 0x7c, 0x81, 0x4b], "sub w0, w0, w1, asr 31"),
        ([0x6e, 0x7c, 0x8e, 0x4b], "sub w14, w3, w14, asr 31"),
        ([0x4c, 0x04, 0x00, 0x51], "sub w12, w2, 0x1"),
        ([0x67, 0x0f, 0x00, 0x51], "sub w7, w27, 0x3"),
        ([0x04, 0x11, 0x00, 0x51], "sub w4, w8, 0x4"),
        ([0x42, 0x1c, 0x00, 0x51], "sub w2, w2, 0x7"),
        ([0xc5, 0x20, 0x00, 0x51], "sub w5, w6, 0x8"),
        ([0x08, 0x25, 0x00, 0x51], "sub w8, w8, 0x9"),
        ([0x00, 0x2c, 0x00, 0x51], "sub w0, w0, 0xb"),
        ([0x00, 0x30, 0x00, 0x51], "sub w0, w0, 0xc"),
        ([0x2d, 0x30, 0x00, 0x51], "sub w13, w1, 0xc"),
        ([0x21, 0x34, 0x00, 0x51], "sub w1, w1, 0xd"),
        ([0xb8, 0x46, 0x00, 0x51], "sub w24, w21, 0x11"),
        ([0xe0, 0x84, 0x01, 0x51], "sub w0, w7, 0x61"),
        ([0x0c, 0x01, 0x00, 0x6b], "subs w12, w8, w0"),
        ([0xe2, 0x03, 0x00, 0x6b], "negs w2, w0"),
        ([0x21, 0x04, 0x00, 0x71], "subs w1, w1, 0x1"),
        ([0x25, 0x04, 0x00, 0x71], "subs w5, w1, 0x1"),
        ([0x2c, 0x04, 0x00, 0x71], "subs w12, w1, 0x1"),
        ([0x3a, 0x04, 0x00, 0x71], "subs w26, w1, 0x1"),
        ([0xe3, 0x13, 0x02, 0xcb], "neg x3, x2, lsl 4"),
        ([0xeb, 0x0f, 0x03, 0xcb], "neg x11, x3, lsl 3"),
        ([0x75, 0x08, 0x02, 0xcb], "sub x21, x3, x2, lsl 2"),
        ([0xa3, 0x00, 0x03, 0xcb], "sub x3, x5, x3"),
        ([0x81, 0x08, 0x03, 0xcb], "sub x1, x4, x3, lsl 2"),
        ([0x70, 0x12, 0x15, 0xcb], "sub x16, x19, x21, lsl 4"),
        ([0xc6, 0x40, 0x20, 0xcb], "sub x6, x6, w0, uxtw 0"),
        ([0x24, 0x50, 0x20, 0xcb], "sub x4, x1, w0, uxtw 4"),
        ([0x8a, 0xc1, 0x20, 0xcb], "sub x10, x12, w0, sxtw 0"),
        ([0xbb, 0xcc, 0x20, 0xcb], "sub x27, x5, w0, sxtw 3"),
        ([0xd6, 0x04, 0x00, 0xd1], "sub x22, x6, 0x1"),
        ([0xc7, 0x40, 0x10, 0xd1], "sub x7, x6, 0x410"),
        ([0x7b, 0x43, 0x10, 0xd1], "sub x27, x27, 0x410"),
        ([0xff, 0xc3, 0x27, 0xd1], "sub sp, sp, 0x9f0"),
        ([0xec, 0x03, 0x42, 0xd1], "sub x12, sp, 0x80000"),
        ([0x97, 0x02, 0x1b, 0xeb], "subs x23, x20, x27"),
        ([0x98, 0x02, 0x1b, 0xeb], "subs x24, x20, x27"),
        ([0x6b, 0x05, 0x00, 0xf1], "subs x11, x11, 0x1"),
        ([0x5a, 0x07, 0x00, 0xf1], "subs x26, x26, 0x1"),
        ([0x08, 0x09, 0x00, 0xf1], "subs x8, x8, 0x2"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_bitwise() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x94, 0x7c, 0x01, 0x13], "asr w20, w4, 0x1"),
        ([0x0a, 0x7d, 0x02, 0x13], "asr w10, w8, 0x2"),
        ([0x00, 0x7c, 0x0c, 0x13], "asr w0, w0, 0xc"),
        ([0x20, 0x04, 0x81, 0x13], "ror w0, w1, 0x1"),
        ([0x61, 0x21, 0xc0, 0x1a], "lsl w1, w11, w0"),
        ([0x00, 0x20, 0xc1, 0x1a], "lsl w0, w0, w1"),
        ([0x94, 0x22, 0xc1, 0x1a], "lsl w20, w20, w1"),
        ([0x63, 0x20, 0xc2, 0x1a], "lsl w3, w3, w2"),
        ([0x03, 0x7c, 0x01, 0x53], "lsr w3, w0, 0x1"),
        ([0x23, 0x7c, 0x02, 0x53], "lsr w3, w1, 0x2"),
        ([0x00, 0x7c, 0x06, 0x53], "lsr w0, w0, 0x6"),
        ([0x42, 0x7c, 0x07, 0x53], "lsr w2, w2, 0x7"),
        ([0x00, 0x4c, 0x14, 0x53], "lsl w0, w0, 0xc"),
        ([0xe0, 0x56, 0x16, 0x53], "lsl w0, w23, 0xa"),
        ([0x20, 0x7c, 0x18, 0x53], "lsr w0, w1, 0x18"),
        ([0x35, 0x6c, 0x1c, 0x53], "lsl w21, w1, 0x4"),
        ([0x2c, 0x70, 0x1d, 0x53], "lsl w12, w1, 0x3"),
        ([0xa8, 0x74, 0x1e, 0x53], "lsl w8, w5, 0x2"),
        ([0x23, 0x7b, 0x1f, 0x53], "lsl w3, w25, 0x1"),
        ([0x04, 0x7f, 0x1f, 0x53], "lsr w4, w24, 0x1f"),
        ([0x05, 0xfe, 0x41, 0xd3], "lsr x5, x16, 0x1"),
        ([0x22, 0x3c, 0x44, 0xd3], "ubfx x2, x1, 0x4, 0xc"),
        ([0xb5, 0xfe, 0x46, 0xd3], "lsr x21, x21, 0x6"),
        ([0xe7, 0xfc, 0x60, 0xd3], "lsr x7, x7, 0x20"),
        ([0x21, 0xfc, 0x61, 0xd3], "lsr x1, x1, 0x21"),
        ([0x00, 0xfc, 0x63, 0xd3], "lsr x0, x0, 0x23"),
        ([0xa6, 0xd4, 0x76, 0xd3], "lsl x6, x5, 0xa"),
        ([0x03, 0x08, 0x7a, 0xd3], "ubfiz x3, x0, 0x6, 0x3"),
        ([0xa1, 0x7e, 0x79, 0x93], "sbfiz x1, x21, 0x7, 0x20"),
        ([0x01, 0x7c, 0x7a, 0x93], "sbfiz x1, x0, 0x6, 0x20"),
        ([0x9a, 0x7c, 0x7d, 0x93], "sbfiz x26, x4, 0x3, 0x20"),
        ([0xc3, 0x0f, 0x7a, 0xd3], "ubfiz x3, x30, 0x6, 0x4"),
        ([0x01, 0xe4, 0x7a, 0xd3], "lsl x1, x0, 0x6"),
        ([0x65, 0xe8, 0x7b, 0xd3], "lsl x5, x3, 0x5"),
        ([0x79, 0xf3, 0x7d, 0xd3], "lsl x25, x27, 0x3"),
        ([0x81, 0x7d, 0x7f, 0xd3], "ubfiz x1, x12, 0x1, 0x20"),
        ([0x0e, 0xf8, 0x7f, 0xd3], "lsl x14, x0, 0x1"),
        ([0xe9, 0x22, 0xce, 0x9a], "lsl x9, x23, x14"),
        ([0xca, 0xff, 0x7f, 0xd3], "lsr x10, x30, 0x3f"),
        ([0xd3, 0x7f, 0x40, 0x93], "sxtw x19, w30"),
        ([0x00, 0xfc, 0x62, 0x93], "asr x0, x0, 0x22"),
        ([0x20, 0x00, 0x00, 0x0a], "and w0, w1, w0"),
        ([0x28, 0x00, 0x00, 0x0a], "and w8, w1, w0"),
        ([0x29, 0x00, 0x00, 0x0a], "and w9, w1, w0"),
        ([0xb5, 0x02, 0x22, 0x0a], "bic w21, w21, w2"),
        ([0x00, 0x2c, 0x00, 0x12], "and w0, w0, 0xfff"),
        ([0x42, 0x2c, 0x00, 0x12], "and w2, w2, 0xfff"),
        ([0x00, 0x00, 0x01, 0x12], "and w0, w0, 0x80000000"),
        ([0x21, 0x00, 0x01, 0x12], "and w1, w1, 0x80000000"),
        ([0x10, 0x00, 0x18, 0x12], "and w16, w0, 0x100"),
        ([0x11, 0x00, 0x18, 0x12], "and w17, w0, 0x100"),
        ([0x06, 0x79, 0x1a, 0x12], "and w6, w8, 0xffffffdf"),
        ([0x08, 0x79, 0x1a, 0x12], "and w8, w8, 0xffffffdf"),
        ([0x02, 0x70, 0x1d, 0x12], "and w2, w0, 0xfffffff8"),
        ([0x00, 0x74, 0x1e, 0x12], "and w0, w0, 0xfffffffc"),
        ([0x02, 0x74, 0x1e, 0x12], "and w2, w0, 0xfffffffc"),
        ([0x00, 0x78, 0x1e, 0x12], "and w0, w0, 0xfffffffd"),
        ([0x02, 0x78, 0x1e, 0x12], "and w2, w0, 0xfffffffd"),
        ([0xc6, 0x78, 0x1e, 0x12], "and w6, w6, 0xfffffffd"),
        ([0x10, 0x7a, 0x1e, 0x12], "and w16, w16, 0xfffffffd"),
        ([0x39, 0x7b, 0x1f, 0x12], "and w25, w25, 0xfffffffe"),
        ([0x63, 0x00, 0x05, 0x6a], "ands w3, w3, w5"),
        ([0x00, 0x04, 0x00, 0x72], "ands w0, w0, 0x3"),
        ([0xc6, 0x04, 0x00, 0x72], "ands w6, w6, 0x3"),
        ([0x00, 0x78, 0x1e, 0x72], "ands w0, w0, 0xfffffffd"),
        ([0x21, 0x78, 0x1e, 0x72], "ands w1, w1, 0xfffffffd"),
        ([0x40, 0x00, 0x00, 0x8a], "and x0, x2, x0"),
        ([0x84, 0x00, 0x1c, 0x8a], "and x4, x4, x28"),
        ([0x01, 0x00, 0x40, 0x92], "and x1, x0, 0x1"),
        ([0x02, 0x00, 0x40, 0x92], "and x2, x0, 0x1"),
        ([0xa5, 0xf0, 0x7d, 0x92], "and x5, x5, 0xfffffffffffffff8"),
        ([0x00, 0x03, 0x7e, 0x92], "and x0, x24, 0x4"),
        ([0xc1, 0x06, 0x7e, 0x92], "and x1, x22, 0xc"),
        ([0x42, 0xf4, 0x7e, 0x92], "and x2, x2, 0xfffffffffffffffc"),
        ([0x01, 0x00, 0x7f, 0x92], "and x1, x0, 0x2"),
        ([0xe0, 0x01, 0x7f, 0x92], "and x0, x15, 0x2"),
        ([0x75, 0x02, 0x7f, 0x92], "and x21, x19, 0x2"),
        ([0x76, 0x02, 0x7f, 0x92], "and x22, x19, 0x2"),
        ([0x8e, 0x02, 0x7f, 0x92], "and x14, x20, 0x2"),
        ([0x9a, 0x02, 0x7f, 0x92], "and x26, x20, 0x2"),
        ([0x9b, 0x02, 0x7f, 0x92], "and x27, x20, 0x2"),
        ([0xc1, 0x06, 0x7f, 0x92], "and x1, x22, 0x6"),
        ([0x00, 0x07, 0x7f, 0x92], "and x0, x24, 0x6"),
        ([0x01, 0x08, 0x7f, 0x92], "and x1, x0, 0xe"),
        ([0xc1, 0x0a, 0x7f, 0x92], "and x1, x22, 0xe"),
        ([0x6b, 0xfa, 0x7f, 0x92], "and x11, x19, 0xfffffffffffffffe"),
        ([0x80, 0xfb, 0x7f, 0x92], "and x0, x28, 0xfffffffffffffffe"),
        ([0x0c, 0x04, 0x40, 0xf2], "ands x12, x0, 0x3"),
        ([0x88, 0x0a, 0x40, 0xf2], "ands x8, x20, 0x7"),
        ([0x01, 0x10, 0x40, 0xf2], "ands x1, x0, 0x1f"),
        ([0x05, 0x10, 0x40, 0xf2], "ands x5, x0, 0x1f"),
        ([0x0c, 0x10, 0x40, 0xf2], "ands x12, x0, 0x1f"),
        ([0x48, 0x10, 0x40, 0xf2], "ands x8, x2, 0x1f"),
        ([0x05, 0x14, 0x40, 0xf2], "ands x5, x0, 0x3f"),
        ([0x48, 0x18, 0x40, 0xf2], "ands x8, x2, 0x7f"),
        ([0x02, 0xe8, 0x7b, 0xf2], "ands x2, x0, 0xffffffffffffffe0"),
        ([0x07, 0xf4, 0x7e, 0xf2], "ands x7, x0, 0xfffffffffffffffc"),
        ([0x20, 0x00, 0x00, 0x4a], "eor w0, w1, w0"),
        ([0x99, 0x02, 0x04, 0x4a], "eor w25, w20, w4"),
        ([0xa6, 0x00, 0x00, 0x52], "eor w6, w5, 0x1"),
        ([0x48, 0x01, 0x08, 0xca], "eor x8, x10, x8"),
        ([0xe7, 0xf0, 0x7d, 0xd2], "eor x7, x7, 0xfffffffffffffff8"),
        ([0x81, 0x12, 0x17, 0x2a], "orr w1, w20, w23, lsl 4"),
        ([0x29, 0x03, 0x1c, 0x2a], "orr w9, w25, w28"),
        ([0x73, 0x7d, 0x4d, 0x2a], "orr w19, w11, w13, lsr 31"),
        ([0x00, 0x7c, 0x54, 0x2a], "orr w0, w0, w20, lsr 31"),
        ([0x20, 0x00, 0x00, 0x32], "orr w0, w1, 0x1"),
        ([0x80, 0x02, 0x00, 0x32], "orr w0, w20, 0x1"),
        ([0x12, 0x00, 0x11, 0x32], "orr w18, w0, 0x8000"),
        ([0x1e, 0x00, 0x11, 0x32], "orr w30, w0, 0x8000"),
        ([0x08, 0x01, 0x1c, 0x32], "orr w8, w8, 0x10"),
        ([0x81, 0x02, 0x1c, 0x32], "orr w1, w20, 0x10"),
        ([0x82, 0x02, 0x1c, 0x32], "orr w2, w20, 0x10"),
        ([0x94, 0x02, 0x1c, 0x32], "orr w20, w20, 0x10"),
        ([0x20, 0x00, 0x1e, 0x32], "orr w0, w1, 0x4"),
        ([0x73, 0x02, 0x1e, 0x32], "orr w19, w19, 0x4"),
        ([0x80, 0x02, 0x1e, 0x32], "orr w0, w20, 0x4"),
        ([0x94, 0x02, 0x1e, 0x32], "orr w20, w20, 0x4"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_simd_loadstore() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x00, 0xd8, 0x21, 0x5e], "scvtf s0, s0"),
        ([0x82, 0xd8, 0x61, 0x5e], "scvtf d2, d4"),
        ([0x01, 0x00, 0x62, 0x9e], "scvtf d1, x0"),
        ([0x03, 0x00, 0x62, 0x9e], "scvtf d3, x0"),
        ([0x69, 0x03, 0x62, 0x9e], "scvtf d9, x27"),
        ([0x88, 0x03, 0x62, 0x9e], "scvtf d8, x28"),
        ([0x22, 0x00, 0x22, 0x1e], "scvtf s2, w1"),
        ([0xac, 0x02, 0x22, 0x1e], "scvtf s12, w21"),
        ([0x00, 0x00, 0x62, 0x1e], "scvtf d0, w0"),
        ([0x8a, 0x03, 0x62, 0x1e], "scvtf d10, w28"),
        ([0x03, 0xe4, 0x00, 0x2f], "movi d3, 0x0"),
        ([0x88, 0x28, 0x00, 0x0c], "st1 {v8.2s, v9.2s, v10.2s, v11.2s}, [x4]"),
        ([0x80, 0x2c, 0x00, 0x0c], "st1 {v0.1d, v1.1d, v2.1d, v3.1d}, [x4]"),
        ([0x84, 0x2c, 0x00, 0x0c], "st1 {v4.1d, v5.1d, v6.1d, v7.1d}, [x4]"),
        ([0x80, 0x2d, 0x00, 0x0c], "st1 {v0.1d, v1.1d, v2.1d, v3.1d}, [x12]"),
        ([0x20, 0x2e, 0x00, 0x0c], "st1 {v0.1d, v1.1d, v2.1d, v3.1d}, [x17]"),
        ([0x24, 0x2e, 0x00, 0x0c], "st1 {v4.1d, v5.1d, v6.1d, v7.1d}, [x17]"),
        ([0x60, 0x78, 0x00, 0x0c], "st1 {v0.2s}, [x3]"),
        ([0x62, 0x78, 0x00, 0x0c], "st1 {v2.2s}, [x3]"),
        ([0x88, 0x79, 0x00, 0x0c], "st1 {v8.2s}, [x12]"),
        ([0xac, 0x79, 0x00, 0x0c], "st1 {v12.2s}, [x13]"),
        ([0xc8, 0x79, 0x00, 0x0c], "st1 {v8.2s}, [x14]"),
        ([0xa0, 0x89, 0x00, 0x0c], "st2 {v0.2s, v1.2s}, [x13]"),
        ([0xa4, 0x89, 0x00, 0x0c], "st2 {v4.2s, v5.2s}, [x13]"),
        ([0x88, 0xa9, 0x00, 0x0c], "st1 {v8.2s, v9.2s}, [x12]"),
        ([0xa0, 0xa9, 0x00, 0x0c], "st1 {v0.2s, v1.2s}, [x13]"),
        ([0xa2, 0xa9, 0x00, 0x0c], "st1 {v2.2s, v3.2s}, [x13]"),
        ([0xac, 0xa9, 0x00, 0x0c], "st1 {v12.2s, v13.2s}, [x13]"),
        ([0xc4, 0xa9, 0x00, 0x0c], "st1 {v4.2s, v5.2s}, [x14]"),
        ([0xc6, 0xa9, 0x00, 0x0c], "st1 {v6.2s, v7.2s}, [x14]"),
        ([0xc8, 0xa9, 0x00, 0x0c], "st1 {v8.2s, v9.2s}, [x14]"),
        ([0x88, 0x79, 0x40, 0x0c], "ld1 {v8.2s}, [x12]"),
        ([0xac, 0x79, 0x40, 0x0c], "ld1 {v12.2s}, [x13]"),
        ([0x68, 0x89, 0x40, 0x0c], "ld2 {v8.2s, v9.2s}, [x11]"),
        ([0x6a, 0x89, 0x40, 0x0c], "ld2 {v10.2s, v11.2s}, [x11]"),
        ([0xa4, 0x89, 0x40, 0x0c], "ld2 {v4.2s, v5.2s}, [x13]"),
        ([0xa2, 0xa9, 0x40, 0x0c], "ld1 {v2.2s, v3.2s}, [x13]"),
        ([0xac, 0xa9, 0x40, 0x0c], "ld1 {v12.2s, v13.2s}, [x13]"),
        ([0xa5, 0x79, 0x9f, 0x0c], "st1 {v5.2s}, [x13], 0x8"),
        ([0x45, 0x79, 0xc2, 0x0c], "ld1 {v5.2s}, [x10], x2"),
        ([0x20, 0x78, 0xdf, 0x0c], "ld1 {v0.2s}, [x1], 0x8"),
        ([0xcc, 0x85, 0x00, 0x0d], "st1 {v12.d}[0], [x14]"),
        ([0xa8, 0x91, 0x00, 0x0d], "st1 {v8.s}[1], [x13]"),
        ([0xa0, 0x81, 0x20, 0x0d], "st2 {v0.s, v1.s}[0], [x13]"),
        ([0x88, 0x81, 0x40, 0x0d], "ld1 {v8.s}[0], [x12]"),
        ([0xa8, 0x91, 0x40, 0x0d], "ld1 {v8.s}[1], [x13]"),
        ([0xa0, 0x85, 0x60, 0x0d], "ld2 {v0.d, v1.d}[0], [x13]"),
        ([0x43, 0x81, 0x82, 0x0d], "st1 {v3.s}[0], [x10], x2"),
        ([0x64, 0x90, 0x9f, 0x0d], "st1 {v4.s}[1], [x3], 0x4"),
        ([0x22, 0x84, 0xc2, 0x0d], "ld1 {v2.d}[0], [x1], x2"),
        ([0x61, 0x80, 0xc4, 0x0d], "ld1 {v1.s}[0], [x3], x4"),
        ([0x24, 0xc9, 0xdf, 0x0d], "ld1r {v4.2s}, [x9], 0x4"), // TODO: could use a test for "ld1r {v4.2s}, [x9]"
        ([0x88, 0x28, 0x00, 0x4c], "st1 {v8.4s, v9.4s, v10.4s, v11.4s}, [x4]"),
        ([0x60, 0x2d, 0x00, 0x4c], "st1 {v0.2d, v1.2d, v2.2d, v3.2d}, [x11]"),
        ([0x9c, 0x2e, 0x00, 0x4c], "st1 {v28.2d, v29.2d, v30.2d, v31.2d}, [x20]"),
        ([0x60, 0x7c, 0x00, 0x4c], "st1 {v0.2d}, [x3]"),
        ([0x62, 0x7c, 0x00, 0x4c], "st1 {v2.2d}, [x3]"),
        ([0x88, 0x7d, 0x00, 0x4c], "st1 {v8.2d}, [x12]"),
        ([0xac, 0x7d, 0x00, 0x4c], "st1 {v12.2d}, [x13]"),
        ([0xc8, 0x7d, 0x00, 0x4c], "st1 {v8.2d}, [x14]"),
        ([0xe6, 0x8d, 0x00, 0x4c], "st2 {v6.2d, v7.2d}, [x15]"),
        ([0x00, 0xa3, 0x00, 0x4c], "st1 {v0.16b, v1.16b}, [x24]"),
        ([0x60, 0xa3, 0x00, 0x4c], "st1 {v0.16b, v1.16b}, [x27]"),
        ([0x00, 0xa9, 0x00, 0x4c], "st1 {v0.4s, v1.4s}, [x8]"),
        ([0x44, 0xad, 0x00, 0x4c], "st1 {v4.2d, v5.2d}, [x10]"),
        ([0x66, 0xad, 0x00, 0x4c], "st1 {v6.2d, v7.2d}, [x11]"),
        ([0xc8, 0xad, 0x00, 0x4c], "st1 {v8.2d, v9.2d}, [x14]"),
        ([0xec, 0xad, 0x00, 0x4c], "st1 {v12.2d, v13.2d}, [x15]"),
        ([0x21, 0x28, 0x40, 0x4c], "ld1 {v1.4s, v2.4s, v3.4s, v4.4s}, [x1]"),
        ([0x22, 0x2c, 0x40, 0x4c], "ld1 {v2.2d, v3.2d, v4.2d, v5.2d}, [x1]"),
        ([0x61, 0x2c, 0x40, 0x4c], "ld1 {v1.2d, v2.2d, v3.2d, v4.2d}, [x3]"),
        ([0xb0, 0x2c, 0x40, 0x4c], "ld1 {v16.2d, v17.2d, v18.2d, v19.2d}, [x5]"),
        ([0x80, 0x2d, 0x40, 0x4c], "ld1 {v0.2d, v1.2d, v2.2d, v3.2d}, [x12]"),
        ([0xa4, 0x2d, 0x40, 0x4c], "ld1 {v4.2d, v5.2d, v6.2d, v7.2d}, [x13]"),
        ([0x68, 0x79, 0x40, 0x4c], "ld1 {v8.4s}, [x11]"),
        ([0x6c, 0x79, 0x40, 0x4c], "ld1 {v12.4s}, [x11]"),
        ([0x00, 0x7e, 0x40, 0x4c], "ld1 {v0.2d}, [x16]"),
        ([0x30, 0x88, 0x40, 0x4c], "ld2 {v16.4s, v17.4s}, [x1]"),
        ([0x32, 0x88, 0x40, 0x4c], "ld2 {v18.4s, v19.4s}, [x1]"),
        ([0x7e, 0x8c, 0x40, 0x4c], "ld2 {v30.2d, v31.2d}, [x3]"),
        ([0x68, 0x8d, 0x40, 0x4c], "ld2 {v8.2d, v9.2d}, [x11]"),
        ([0x6a, 0x8d, 0x40, 0x4c], "ld2 {v10.2d, v11.2d}, [x11]"),
        ([0x6c, 0x8d, 0x40, 0x4c], "ld2 {v12.2d, v13.2d}, [x11]"),
        ([0x6e, 0x8d, 0x40, 0x4c], "ld2 {v14.2d, v15.2d}, [x11]"),
        ([0x80, 0x8d, 0x40, 0x4c], "ld2 {v0.2d, v1.2d}, [x12]"),
        ([0x82, 0x8d, 0x40, 0x4c], "ld2 {v2.2d, v3.2d}, [x12]"),
        ([0xa0, 0x8d, 0x40, 0x4c], "ld2 {v0.2d, v1.2d}, [x13]"),
        ([0xa4, 0x8d, 0x40, 0x4c], "ld2 {v4.2d, v5.2d}, [x13]"),
        ([0xa6, 0x8d, 0x40, 0x4c], "ld2 {v6.2d, v7.2d}, [x13]"),
        ([0xa3, 0x7c, 0x86, 0x4c], "st1 {v3.2d}, [x5], x6"),
        ([0x61, 0x2c, 0x9f, 0x4c], "st1 {v1.2d, v2.2d, v3.2d, v4.2d}, [x3], 0x40"),
        ([0xb0, 0x2c, 0x9f, 0x4c], "st1 {v16.2d, v17.2d, v18.2d, v19.2d}, [x5], 0x40"),
        ([0x24, 0x78, 0x9f, 0x4c], "st1 {v4.4s}, [x1], 0x10"),
        ([0xa5, 0x7d, 0x9f, 0x4c], "st1 {v5.2d}, [x13], 0x10"),
        ([0xa4, 0x88, 0x9f, 0x4c], "st2 {v4.4s, v5.4s}, [x5], 0x20"),
        ([0xc4, 0x88, 0x9f, 0x4c], "st2 {v4.4s, v5.4s}, [x6], 0x20"),
        ([0xb0, 0xad, 0x9f, 0x4c], "st1 {v16.2d, v17.2d}, [x13], 0x20"),
        ([0x20, 0x7c, 0xc2, 0x4c], "ld1 {v0.2d}, [x1], x2"),
        ([0x46, 0x7d, 0xc6, 0x4c], "ld1 {v6.2d}, [x10], x6"),
        ([0x20, 0x0c, 0xdf, 0x4c], "ld4 {v0.2d, v1.2d, v2.2d, v3.2d}, [x1], 0x40"),
        ([0x51, 0x2d, 0xdf, 0x4c], "ld1 {v17.2d, v18.2d, v19.2d, v20.2d}, [x10], 0x40"),
        ([0x20, 0x78, 0xdf, 0x4c], "ld1 {v0.4s}, [x1], 0x10"),
        ([0x21, 0x78, 0xdf, 0x4c], "ld1 {v1.4s}, [x1], 0x10"),
        ([0x46, 0x7d, 0xdf, 0x4c], "ld1 {v6.2d}, [x10], 0x10"),
        ([0x20, 0x88, 0xdf, 0x4c], "ld2 {v0.4s, v1.4s}, [x1], 0x20"),
        ([0x50, 0xad, 0xdf, 0x4c], "ld1 {v16.2d, v17.2d}, [x10], 0x20"),
        ([0xa8, 0x85, 0x00, 0x4d], "st1 {v8.d}[1], [x13]"),
        ([0xac, 0x85, 0x00, 0x4d], "st1 {v12.d}[1], [x13]"),
        ([0xec, 0x85, 0x00, 0x4d], "st1 {v12.d}[1], [x15]"),
        ([0x62, 0x84, 0x40, 0x4d], "ld1 {v2.d}[1], [x3]"),
        ([0xa8, 0x85, 0x40, 0x4d], "ld1 {v8.d}[1], [x13]"),
        ([0xec, 0x85, 0x40, 0x4d], "ld1 {v12.d}[1], [x15]"),
        ([0x64, 0x84, 0x84, 0x4d], "st1 {v4.d}[1], [x3], x4"),
        ([0x64, 0x84, 0x9f, 0x4d], "st1 {v4.d}[1], [x3], 0x8"),
        ([0x24, 0xcd, 0xdf, 0x4d], "ld1r {v4.2d}, [x9], 0x8"),
        ([0x60, 0x04, 0x81, 0x3c], "str q0, [x3], 0x10"),
        ([0x61, 0x00, 0x9f, 0x3c], "stur q1, [x3, -0x10]"),
        ([0xa0, 0x00, 0x9f, 0x3c], "stur q0, [x5, -0x10]"),
        ([0x30, 0x00, 0xc0, 0x3c], "ldur q16, [x1]"),
        ([0x68, 0x01, 0xc0, 0x3c], "ldur q8, [x11]"),
        ([0x6c, 0x01, 0xc0, 0x3c], "ldur q12, [x11]"),
        ([0x04, 0x02, 0xc0, 0x3c], "ldur q4, [x16]"),
        ([0x32, 0x00, 0xc1, 0x3c], "ldur q18, [x1, 0x10]"),
        ([0x6c, 0x01, 0xc1, 0x3c], "ldur q12, [x11, 0x10]"),
        ([0x05, 0x02, 0xc1, 0x3c], "ldur q5, [x16, 0x10]"),
        ([0x20, 0x04, 0xc1, 0x3c], "ldr q0, [x1], 0x10"),
        ([0x04, 0x06, 0xc1, 0x3c], "ldr q4, [x16], 0x10"),
        ([0x05, 0x06, 0xc1, 0x3c], "ldr q5, [x16], 0x10"),
        ([0x34, 0x00, 0xc2, 0x3c], "ldur q20, [x1, 0x20]"),
        ([0x3c, 0x00, 0xc6, 0x3c], "ldur q28, [x1, 0x60]"),
        ([0x06, 0x02, 0xc6, 0x3c], "ldur q6, [x16, 0x60]"),
        ([0x3e, 0x00, 0xc7, 0x3c], "ldur q30, [x1, 0x70]"),
        ([0x07, 0x02, 0xc7, 0x3c], "ldur q7, [x16, 0x70]"),
        ([0x44, 0x00, 0xdf, 0x3c], "ldur q4, [x2, -0x10]"),
        ([0x60, 0x00, 0x80, 0x3d], "str q0, [x3]"),
        ([0x61, 0x00, 0x80, 0x3d], "str q1, [x3]"),
        ([0xa0, 0x00, 0x80, 0x3d], "str q0, [x5]"),
        ([0x60, 0x01, 0x80, 0x3d], "str q0, [x11]"),
        ([0x80, 0x01, 0x80, 0x3d], "str q0, [x12]"),
        ([0xa1, 0x01, 0x80, 0x3d], "str q1, [x13]"),
        ([0xc2, 0x01, 0x80, 0x3d], "str q2, [x14]"),
        ([0xe0, 0x01, 0x80, 0x3d], "str q0, [x15]"),
        ([0xe3, 0x01, 0x80, 0x3d], "str q3, [x15]"),
        ([0x00, 0x02, 0x80, 0x3d], "str q0, [x16]"),
        ([0xe0, 0x27, 0x80, 0x3d], "str q0, [sp, 0x90]"),
        ([0xe1, 0x2b, 0x80, 0x3d], "str q1, [sp, 0xa0]"),
        ([0xe2, 0x2f, 0x80, 0x3d], "str q2, [sp, 0xb0]"),
        ([0xe3, 0x33, 0x80, 0x3d], "str q3, [sp, 0xc0]"),
        ([0xe4, 0x37, 0x80, 0x3d], "str q4, [sp, 0xd0]"),
        ([0xe5, 0x3b, 0x80, 0x3d], "str q5, [sp, 0xe0]"),
        ([0xe6, 0x3f, 0x80, 0x3d], "str q6, [sp, 0xf0]"),
        ([0xe7, 0x43, 0x80, 0x3d], "str q7, [sp, 0x100]"),
        ([0x20, 0x00, 0xc0, 0x3d], "ldr q0, [x1]"),
        ([0x21, 0x00, 0xc0, 0x3d], "ldr q1, [x1]"),
        ([0x24, 0x00, 0xc0, 0x3d], "ldr q4, [x1]"),
        ([0x30, 0x00, 0xc0, 0x3d], "ldr q16, [x1]"),
        ([0x60, 0x00, 0xc0, 0x3d], "ldr q0, [x3]"),
        ([0x78, 0x00, 0xc0, 0x3d], "ldr q24, [x3]"),
        ([0xa1, 0x00, 0xc0, 0x3d], "ldr q1, [x5]"),
        ([0xc0, 0x00, 0xc0, 0x3d], "ldr q0, [x6]"),
        ([0xe1, 0x00, 0xc0, 0x3d], "ldr q1, [x7]"),
        ([0xe4, 0x00, 0xc0, 0x3d], "ldr q4, [x7]"),
        ([0x02, 0x01, 0xc0, 0x3d], "ldr q2, [x8]"),
        ([0x23, 0x01, 0xc0, 0x3d], "ldr q3, [x9]"),
        ([0x44, 0x01, 0xc0, 0x3d], "ldr q4, [x10]"),
        ([0xc1, 0x05, 0xc0, 0x3d], "ldr q1, [x14, 0x10]"),
        ([0xe5, 0x05, 0xc0, 0x3d], "ldr q5, [x15, 0x10]"),
        ([0xc2, 0x09, 0xc0, 0x3d], "ldr q2, [x14, 0x20]"),
        ([0xe6, 0x09, 0xc0, 0x3d], "ldr q6, [x15, 0x20]"),
        ([0x33, 0x0c, 0xc0, 0x3d], "ldr q19, [x1, 0x30]"),
        ([0x85, 0x0c, 0xc0, 0x3d], "ldr q5, [x4, 0x30]"),
        ([0x83, 0x0d, 0xc0, 0x3d], "ldr q3, [x12, 0x30]"),
        ([0xa7, 0x0d, 0xc0, 0x3d], "ldr q7, [x13, 0x30]"),
        ([0xc3, 0x0d, 0xc0, 0x3d], "ldr q3, [x14, 0x30]"),
        ([0xe7, 0x0d, 0xc0, 0x3d], "ldr q7, [x15, 0x30]"),
        ([0x00, 0x06, 0xc1, 0xac], "ldp q0, q1, [x16], 0x20"),
        ([0xbe, 0x7d, 0xc1, 0xac], "ldp q30, q31, [x13], 0x20"),
        ([0xb0, 0x44, 0x00, 0xad], "stp q16, q17, [x5]"),
        ([0x82, 0x0d, 0x01, 0xad], "stp q2, q3, [x12, 0x20]"),
        ([0xc2, 0x0d, 0x01, 0xad], "stp q2, q3, [x14, 0x20]"),
        ([0xb8, 0x64, 0x02, 0xad], "stp q24, q25, [x5, 0x40]"),
        ([0xba, 0x6c, 0x03, 0xad], "stp q26, q27, [x5, 0x60]"),
        ([0xc0, 0x04, 0x40, 0xad], "ldp q0, q1, [x6]"),
        ([0xb0, 0x44, 0x40, 0xad], "ldp q16, q17, [x5]"),
        ([0x02, 0x0e, 0x41, 0xad], "ldp q2, q3, [x16, 0x20]"),
        ([0x68, 0x25, 0x41, 0xad], "ldp q8, q9, [x11, 0x20]"),
        ([0x6c, 0x35, 0x41, 0xad], "ldp q12, q13, [x11, 0x20]"),
        ([0x7c, 0x74, 0x42, 0xad], "ldp q28, q29, [x3, 0x40]"),
        ([0x02, 0x0e, 0x43, 0xad], "ldp q2, q3, [x16, 0x60]"),
        ([0x06, 0x1e, 0x43, 0xad], "ldp q6, q7, [x16, 0x60]"),
        ([0x30, 0x44, 0x43, 0xad], "ldp q16, q17, [x1, 0x60]"),
        ([0x3e, 0x7c, 0x47, 0xad], "ldp q30, q31, [x1, 0xe0]"),
        ([0x6e, 0x3d, 0xc1, 0x6c], "ldp d14, d15, [x11], 0x10"),
        ([0xe8, 0x27, 0xc4, 0x6c], "ldp d8, d9, [sp], 0x40"),
        ([0x81, 0x01, 0x00, 0x6d], "stp d1, d0, [x12]"),
        ([0x39, 0x60, 0x00, 0x6d], "stp d25, d24, [x1]"),
        ([0xdd, 0x71, 0x01, 0x6d], "stp d29, d28, [x14, 0x10]"),
        ([0xfd, 0x70, 0x31, 0x6d], "stp d29, d28, [x7, -0xf0]"),
        ([0x86, 0xd8, 0x3f, 0x6d], "stp d6, d22, [x4, -0x8]"),
        ([0x24, 0x00, 0x40, 0x6d], "ldp d4, d0, [x1]"),
        ([0xe1, 0x02, 0x40, 0x6d], "ldp d1, d0, [x23]"),
        ([0xb2, 0x45, 0x7f, 0x6d], "ldp d18, d17, [x13, -0x10]"),
        ([0x32, 0xc4, 0x7f, 0x6d], "ldp d18, d17, [x1, -0x8]"),
        ([0x33, 0xd0, 0x7f, 0x6d], "ldp d19, d20, [x1, -0x8]"),
        ([0x00, 0x84, 0x00, 0xfc], "str d0, [x0], 0x8"),
        ([0xc2, 0x87, 0x00, 0xfc], "str d2, [x30], 0x8"),
        ([0x40, 0x8f, 0x00, 0xfc], "str d0, [x26, 0x8]!"),
        ([0x15, 0x04, 0x01, 0xfc], "str d21, [x0], 0x10"),
        ([0xc2, 0x07, 0x01, 0xfc], "str d2, [x30], 0x10"),
        ([0x20, 0x84, 0x02, 0xfc], "str d0, [x1], 0x28"),
        ([0x66, 0x00, 0x15, 0xfc], "stur d6, [x3, -0xb0]"),
        ([0x29, 0x03, 0x1f, 0xfc], "stur d9, [x25, -0x10]"),
        ([0xe8, 0x0f, 0x1f, 0xfc], "str d8, [sp, -0x10]!"),
        ([0x6d, 0x83, 0x1f, 0xfc], "stur d13, [x27, -0x8]"),
        ([0xc3, 0x83, 0x1f, 0xfc], "stur d3, [x30, -0x8]"),
        ([0x0d, 0x84, 0x1f, 0xfc], "str d13, [x0], -0x8"),
        ([0x61, 0x8e, 0x1f, 0xfc], "str d1, [x19, -0x8]!"),
        ([0xa3, 0x68, 0x20, 0xfc], "str d3, [x5, x0]"),
        ([0xd2, 0x68, 0x20, 0xfc], "str d18, [x6, x0]"),
        ([0x94, 0x6b, 0x20, 0xfc], "str d20, [x28, x0]"),
        ([0x48, 0x78, 0x20, 0xfc], "str d8, [x2, x0, lsl 3]"),
        ([0x83, 0x7b, 0x77, 0xfc], "ldr d3, [x28, x23, lsl 3]"),
        ([0x80, 0xda, 0x77, 0xfc], "ldr d0, [x20, w23, sxtw 3]"),
        ([0x22, 0x6b, 0x78, 0xfc], "ldr d2, [x25, x24]"),
        ([0x08, 0x78, 0x78, 0xfc], "ldr d8, [x0, x24, lsl 3]"),
        ([0xf3, 0x9b, 0x41, 0xfd], "ldr d19, [sp, 0x330]"),
        ([0x4a, 0x44, 0x47, 0xfd], "ldr d10, [x2, 0xe88]"),
        ([0x01, 0xd0, 0x47, 0xfd], "ldr d1, [x0, 0xfa0]"),
        ([0xe8, 0x27, 0xbc, 0x6d], "stp d8, d9, [sp, -0x40]!"),
        ([0xe8, 0x27, 0xbf, 0x6d], "stp d8, d9, [sp, -0x10]!"),
        ([0xa2, 0x0f, 0x32, 0x3d], "str b2, [x29, 0xc83]"),
        ([0x97, 0xff, 0xff, 0x1c], "ldr s23, $-0x10"),
        ([0x6e, 0x3d, 0xc1, 0x2c], "ldp s14, s15, [x11], 0x8"),
        ([0xef, 0x7e, 0x40, 0x2d], "ldp s15, s31, [x23]"),
        ([0x41, 0x80, 0x40, 0x2d], "ldp s1, s0, [x2, 0x4]"),
        ([0x33, 0xd0, 0x7f, 0x2d], "ldp s19, s20, [x1, -0x4]"),
        ([0x60, 0x47, 0x00, 0xbc], "str s0, [x27], 0x4"),
        ([0x81, 0x47, 0x00, 0xbc], "str s1, [x28], 0x4"),
        ([0xc2, 0x47, 0x00, 0xbc], "str s2, [x30], 0x4"),
        ([0x00, 0x4d, 0x00, 0xbc], "str s0, [x8, 0x4]!"),
        ([0x40, 0x4f, 0x00, 0xbc], "str s0, [x26, 0x4]!"),
        ([0x15, 0x84, 0x00, 0xbc], "str s21, [x0], 0x8"),
        ([0x80, 0x87, 0x00, 0xbc], "str s0, [x28], 0x8"),
        ([0xf1, 0x00, 0x1c, 0xbc], "stur s17, [x7, -0x40]"),
        ([0x01, 0x04, 0x1f, 0xbc], "str s1, [x0], -0x10"),
        ([0x8d, 0xc3, 0x1f, 0xbc], "stur s13, [x28, -0x4]"),
        ([0x0d, 0xc4, 0x1f, 0xbc], "str s13, [x0], -0x4"),
        ([0x61, 0xce, 0x1f, 0xbc], "str s1, [x19, -0x4]!"),
        ([0x82, 0x6b, 0x20, 0xbc], "str s2, [x28, x0]"),
        ([0xad, 0x7a, 0x20, 0xbc], "str s13, [x21, x0, lsl 2]"),
        ([0x88, 0x7b, 0x21, 0xbc], "str s8, [x28, x1, lsl 2]"),
        ([0x60, 0xda, 0x21, 0xbc], "str s0, [x19, w1, sxtw 2]"),
        ([0xc0, 0x5a, 0x32, 0xbc], "str s0, [x22, w18, uxtw 2]"),
        ([0xb3, 0x85, 0x40, 0xbc], "ldr s19, [x13], 0x8"),
        ([0x02, 0x8f, 0x40, 0xbc], "ldr s2, [x24, 0x8]!"),
        ([0x71, 0x05, 0x41, 0xbc], "ldr s17, [x11], 0x10"),
        ([0xe0, 0x42, 0x5d, 0xbc], "ldur s0, [x23, -0x2c]"),
        ([0x27, 0x80, 0x5d, 0xbc], "ldur s7, [x1, -0x28]"),
        ([0x21, 0x84, 0x5f, 0xbc], "ldr s1, [x1], -0x8"),
        ([0x22, 0x87, 0x5f, 0xbc], "ldr s2, [x25], -0x8"),
        ([0xe0, 0x8e, 0x5f, 0xbc], "ldr s0, [x23, -0x8]!"),
        ([0x79, 0x6a, 0x60, 0xbc], "ldr s25, [x19, x0]"),
        ([0x6a, 0x78, 0x60, 0xbc], "ldr s10, [x3, x0, lsl 2]"),
        ([0xeb, 0x7a, 0x60, 0xbc], "ldr s11, [x23, x0, lsl 2]"),
        ([0x96, 0x7b, 0x61, 0xbc], "ldr s22, [x28, x1, lsl 2]"),
        ([0x68, 0xdb, 0x61, 0xbc], "ldr s8, [x27, w1, sxtw 2]"),
        ([0x49, 0x03, 0x00, 0xbd], "str s9, [x26]"),
        ([0x62, 0x78, 0x00, 0xbd], "str s2, [x3, 0x78]"),
        ([0x6c, 0x78, 0x00, 0xbd], "str s12, [x3, 0x78]"),
        ([0xea, 0x7f, 0x00, 0xbd], "str s10, [sp, 0x7c]"),
        ([0xe9, 0x87, 0x04, 0xbd], "str s9, [sp, 0x484]"),
        ([0xc0, 0x8a, 0x0a, 0xbd], "str s0, [x22, 0xa88]"),
        ([0x41, 0x58, 0x4f, 0xbd], "ldr s1, [x2, 0xf58]"),
        ([0x88, 0x7c, 0x00, 0x2d], "stp s8, s31, [x4]"),
        ([0x03, 0x84, 0x00, 0x2d], "stp s3, s1, [x0, 0x4]"),
        ([0x13, 0xdc, 0x3f, 0x2d], "stp s19, s23, [x0, -0x4]"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_loadstore() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x83, 0x68, 0x60, 0x38], "ldrb w3, [x4, x0]"),
        ([0x63, 0x03, 0x40, 0x29], "ldp w3, w0, [x27]"),
        ([0x49, 0x00, 0x40, 0x39], "ldrb w9, [x2]"),
        ([0x4a, 0x00, 0x40, 0x39], "ldrb w10, [x2]"),
        ([0x82, 0x08, 0x40, 0x39], "ldrb w2, [x4, 0x2]"),
        ([0x82, 0x0a, 0x40, 0x39], "ldrb w2, [x20, 0x2]"),
        ([0x41, 0x0b, 0x40, 0x39], "ldrb w1, [x26, 0x2]"),
        ([0x88, 0x10, 0x40, 0x39], "ldrb w8, [x4, 0x4]"),
        ([0xc1, 0x16, 0x40, 0x39], "ldrb w1, [x22, 0x5]"),
        ([0xc2, 0x16, 0x40, 0x39], "ldrb w2, [x22, 0x5]"),
        ([0x00, 0x40, 0x40, 0x39], "ldrb w0, [x0, 0x10]"),
        ([0xe1, 0x43, 0x41, 0x39], "ldrb w1, [sp, 0x50]"),
        ([0xe0, 0x83, 0x41, 0x39], "ldrb w0, [sp, 0x60]"),
        ([0xe1, 0x8b, 0x41, 0x39], "ldrb w1, [sp, 0x62]"),
        ([0xe2, 0x8b, 0x41, 0x39], "ldrb w2, [sp, 0x62]"),
        ([0xe2, 0xa3, 0x41, 0x39], "ldrb w2, [sp, 0x68]"),
        ([0xe1, 0xb7, 0x41, 0x39], "ldrb w1, [sp, 0x6d]"),
        ([0xe2, 0xb7, 0x41, 0x39], "ldrb w2, [sp, 0x6d]"),
        ([0xf3, 0xcb, 0x41, 0x39], "ldrb w19, [sp, 0x72]"),
        ([0xe2, 0xeb, 0x41, 0x39], "ldrb w2, [sp, 0x7a]"),
        ([0xe1, 0x13, 0x42, 0x39], "ldrb w1, [sp, 0x84]"),
        ([0xe3, 0x13, 0x42, 0x39], "ldrb w3, [sp, 0x84]"),
        ([0xe7, 0x23, 0x42, 0x39], "ldrb w7, [sp, 0x88]"),
        ([0xe3, 0x37, 0x42, 0x39], "ldrb w3, [sp, 0x8d]"),
        ([0xe1, 0x4f, 0x42, 0x39], "ldrb w1, [sp, 0x93]"),
        ([0x60, 0x02, 0x72, 0x39], "ldrb w0, [x19, 0xc80]"),
        ([0x22, 0x04, 0x40, 0x69], "ldpsw x2, x1, [x1]"),
        ([0x38, 0x15, 0x40, 0x69], "ldpsw x24, x5, [x9]"),
        ([0x38, 0x1d, 0x40, 0x69], "ldpsw x24, x7, [x9]"),
        ([0x43, 0x80, 0x40, 0x69], "ldpsw x3, x0, [x2, 0x4]"),
        ([0x05, 0x90, 0x40, 0x69], "ldpsw x5, x4, [x0, 0x4]"),
        ([0x39, 0x90, 0x40, 0x69], "ldpsw x25, x4, [x1, 0x4]"),
        ([0x05, 0x98, 0x40, 0x69], "ldpsw x5, x6, [x0, 0x4]"),
        ([0xe1, 0x13, 0x5f, 0x69], "ldpsw x1, x4, [sp, 0xf8]"),
        ([0xe3, 0x33, 0x45, 0x78], "ldurh w3, [sp, 0x53]"),
        ([0xe1, 0x13, 0x46, 0x78], "ldurh w1, [sp, 0x61]"),
        ([0xe2, 0x93, 0x46, 0x78], "ldurh w2, [sp, 0x69]"),
        ([0xe2, 0xb3, 0x46, 0x78], "ldurh w2, [sp, 0x6b]"),
        ([0xe5, 0xb3, 0x48, 0x78], "ldurh w5, [sp, 0x8b]"),
        ([0xe5, 0x8b, 0x00, 0x79], "strh w5, [sp, 0x44]"),
        ([0xe2, 0xa3, 0x00, 0x79], "strh w2, [sp, 0x50]"),
        ([0xe0, 0xab, 0x00, 0x79], "strh w0, [sp, 0x54]"),
        ([0xe1, 0xb3, 0x00, 0x79], "strh w1, [sp, 0x58]"),
        ([0xe2, 0xc3, 0x00, 0x79], "strh w2, [sp, 0x60]"),
        ([0xe5, 0xf3, 0x00, 0x79], "strh w5, [sp, 0x78]"),
        ([0x01, 0x00, 0x40, 0x79], "ldrh w1, [x0]"),
        ([0x02, 0x00, 0x40, 0x79], "ldrh w2, [x0]"),
        ([0x22, 0x00, 0x40, 0x79], "ldrh w2, [x1]"),
        ([0x83, 0x02, 0x40, 0x79], "ldrh w3, [x20]"),
        ([0x42, 0x03, 0x40, 0x79], "ldrh w2, [x26]"),
        ([0x20, 0x08, 0x40, 0x79], "ldrh w0, [x1, 0x4]"),
        ([0xe0, 0xa3, 0x40, 0x79], "ldrh w0, [sp, 0x50]"),
        ([0xe1, 0xa3, 0x40, 0x79], "ldrh w1, [sp, 0x50]"),
        ([0xe0, 0xb3, 0x40, 0x79], "ldrh w0, [sp, 0x58]"),
        ([0xe0, 0xc3, 0x40, 0x79], "ldrh w0, [sp, 0x60]"),
        ([0xe2, 0xc3, 0x40, 0x79], "ldrh w2, [sp, 0x60]"),
        ([0xe3, 0xf3, 0x40, 0x79], "ldrh w3, [sp, 0x78]"),
        ([0xfd, 0x7b, 0xc1, 0xa8], "ldp x29, x30, [sp], 0x10"),
        ([0xfd, 0x7b, 0xd9, 0xa8], "ldp x29, x30, [sp], 0x190"),
        ([0xfd, 0x7b, 0xda, 0xa8], "ldp x29, x30, [sp], 0x1a0"),
        ([0x3c, 0x61, 0x00, 0xa9], "stp x28, x24, [x9]"),
        ([0xba, 0x61, 0x00, 0xa9], "stp x26, x24, [x13]"),
        ([0xed, 0x6f, 0x00, 0xa9], "stp x13, x27, [sp]"),
        ([0xea, 0x9f, 0x1c, 0xa9], "stp x10, x7, [sp, 0x1c8]"),
        ([0xff, 0x7c, 0x3e, 0xa9], "stp xzr, xzr, [x7, -0x20]"),
        ([0x03, 0x00, 0x40, 0xa9], "ldp x3, x0, [x0]"),
        ([0x2a, 0x00, 0x40, 0xa9], "ldp x10, x0, [x1]"),
        ([0x5a, 0x28, 0x40, 0xa9], "ldp x26, x10, [x2]"),
        ([0x16, 0x87, 0x7f, 0xa9], "ldp x22, x1, [x24, -0x8]"),
        ([0xc1, 0x46, 0x00, 0xb8], "str w1, [x22], 0x4"),
        ([0x3f, 0x47, 0x00, 0xb8], "str wzr, [x25], 0x4"),
        ([0x7f, 0x4c, 0x00, 0xb8], "str wzr, [x3, 0x4]!"),
        ([0x1f, 0x4d, 0x00, 0xb8], "str wzr, [x8, 0x4]!"),
        ([0x3f, 0x84, 0x00, 0xb8], "str wzr, [x1], 0x8"),
        ([0x7f, 0x0e, 0x04, 0xb8], "str wzr, [x19, 0x40]!"),
        ([0x9f, 0x0e, 0x04, 0xb8], "str wzr, [x20, 0x40]!"),
        ([0xe9, 0x93, 0x08, 0xb8], "stur w9, [sp, 0x89]"),
        ([0x1f, 0x40, 0x10, 0xb8], "stur wzr, [x0, -0xfc]"),
        ([0x1f, 0xc0, 0x11, 0xb8], "stur wzr, [x0, -0xe4]"),
        ([0xff, 0x82, 0x14, 0xb8], "stur wzr, [x23, -0xb8]"),
        ([0x0b, 0x83, 0x14, 0xb8], "stur w11, [x24, -0xb8]"),
        ([0xff, 0x69, 0x20, 0xb8], "str wzr, [x15, x0]"),
        ([0x57, 0x78, 0x20, 0xb8], "str w23, [x2, x0, lsl 2]"),
        ([0x7f, 0x68, 0x21, 0xb8], "str wzr, [x3, x1]"),
        ([0xa8, 0x68, 0x21, 0xb8], "str w8, [x5, x1]"),
        ([0xe0, 0xda, 0x34, 0xb8], "str w0, [x23, w20, sxtw 2]"),
        ([0x48, 0x7b, 0x35, 0xb8], "str w8, [x26, x21, lsl 2]"),
        ([0x23, 0x44, 0x40, 0xb8], "ldr w3, [x1], 0x4"),
        ([0xe1, 0x13, 0x45, 0xb8], "ldur w1, [sp, 0x51]"),
        ([0xe2, 0xf3, 0x48, 0xb8], "ldur w2, [sp, 0x8f]"),
        ([0x27, 0x80, 0x5f, 0xb8], "ldur w7, [x1, -0x8]"),
        ([0xe3, 0x68, 0x61, 0xb8], "ldr w3, [x7, x1]"),
        ([0x0e, 0x79, 0x61, 0xb8], "ldr w14, [x8, x1, lsl 2]"),
        ([0xf2, 0x6a, 0x62, 0xb8], "ldr w18, [x23, x2]"),
        ([0x63, 0x7b, 0x7c, 0xb8], "ldr w3, [x27, x28, lsl 2]"),
        ([0xe5, 0x44, 0x80, 0xb8], "ldrsw x5, [x7], 0x4"),
        ([0xa3, 0xc0, 0x9f, 0xb8], "ldursw x3, [x5, -0x4]"),
        ([0x04, 0x78, 0xa2, 0xb8], "ldrsw x4, [x0, x2, lsl 2]"),
        ([0xe4, 0x68, 0xa3, 0xb8], "ldrsw x4, [x7, x3]"),
        ([0xe5, 0x6a, 0xb3, 0xb8], "ldrsw x5, [x23, x19]"),
        ([0x65, 0x02, 0x00, 0xb9], "str w5, [x19]"),
        ([0xff, 0x03, 0x00, 0xb9], "str wzr, [sp]"),
        ([0xe9, 0x23, 0x00, 0xb9], "str w9, [sp, 0x20]"),
        ([0x01, 0x3c, 0x0c, 0xb9], "str w1, [x0, 0xc3c]"),
        ([0x60, 0x4a, 0x0c, 0xb9], "str w0, [x19, 0xc48]"),
        ([0x7f, 0x4a, 0x0c, 0xb9], "str wzr, [x19, 0xc48]"),
        ([0x40, 0xf0, 0x0d, 0xb9], "str w0, [x2, 0xdf0]"),
        ([0x89, 0x00, 0x40, 0xb9], "ldr w9, [x4]"),
        ([0xa0, 0x6f, 0x40, 0xb9], "ldr w0, [x29, 0x6c]"),
        ([0xe4, 0x6f, 0x40, 0xb9], "ldr w4, [sp, 0x6c]"),
        ([0xea, 0xc3, 0x6e, 0xb9], "ldr w10, [sp, 0x2ec0]"),
        ([0xeb, 0xc3, 0x6e, 0xb9], "ldr w11, [sp, 0x2ec0]"),
        ([0xea, 0xcb, 0x6e, 0xb9], "ldr w10, [sp, 0x2ec8]"),
        ([0xf9, 0x03, 0x6f, 0xb9], "ldr w25, [sp, 0x2f00]"),
        ([0xf9, 0x0b, 0x6f, 0xb9], "ldr w25, [sp, 0x2f08]"),
        ([0xf7, 0x33, 0x6f, 0xb9], "ldr w23, [sp, 0x2f30]"),
        ([0xf7, 0x3b, 0x6f, 0xb9], "ldr w23, [sp, 0x2f38]"),
        ([0xec, 0x1b, 0x71, 0xb9], "ldr w12, [sp, 0x3118]"),
        ([0xeb, 0x23, 0x71, 0xb9], "ldr w11, [sp, 0x3120]"),
        ([0xe0, 0x73, 0x71, 0xb9], "ldr w0, [sp, 0x3170]"),
        ([0xe0, 0x7b, 0x71, 0xb9], "ldr w0, [sp, 0x3178]"),
        ([0xe0, 0x83, 0x71, 0xb9], "ldr w0, [sp, 0x3180]"),
        ([0xe0, 0x8b, 0x71, 0xb9], "ldr w0, [sp, 0x3188]"),
        ([0xe9, 0x1b, 0x72, 0xb9], "ldr w9, [sp, 0x3218]"),
        ([0xeb, 0x23, 0x72, 0xb9], "ldr w11, [sp, 0x3220]"),
        ([0xea, 0x2b, 0x72, 0xb9], "ldr w10, [sp, 0x3228]"),
        ([0xeb, 0x33, 0x72, 0xb9], "ldr w11, [sp, 0x3230]"),
        ([0x24, 0x03, 0x80, 0xb9], "ldrsw x4, [x25]"),
        ([0x34, 0x10, 0x80, 0xb9], "ldrsw x20, [x1, 0x10]"),
        ([0xc8, 0x7c, 0x89, 0xb9], "ldrsw x8, [x6, 0x97c]"),
        ([0x7f, 0xfe, 0x01, 0xc8], "stlxr w1, xzr, [x19]"),
        ([0xbf, 0xfe, 0x01, 0xc8], "stlxr w1, xzr, [x21]"),
        ([0x64, 0x7e, 0x03, 0xc8], "stxr w3, x4, [x19]"),
        ([0x60, 0xfe, 0x5f, 0xc8], "ldaxr x0, [x19]"),
        ([0x62, 0xfe, 0x5f, 0xc8], "ldaxr x2, [x19]"),
        ([0x3f, 0xfc, 0x9f, 0xc8], "stlr xzr, [x1]"),
        ([0x81, 0xfd, 0x9f, 0xc8], "stlr x1, [x12]"),
        ([0x77, 0xfe, 0xdf, 0xc8], "ldar x23, [x19]"),
        ([0xff, 0x42, 0x00, 0xf8], "stur xzr, [x23, 0x4]"),
        ([0x3f, 0x84, 0x00, 0xf8], "str xzr, [x1], 0x8"),
        ([0x3f, 0x87, 0x00, 0xf8], "str xzr, [x25], 0x8"),
        ([0x1f, 0x8c, 0x00, 0xf8], "str xzr, [x0, 0x8]!"),
        ([0x02, 0x8f, 0x00, 0xf8], "str x2, [x24, 0x8]!"),
        ([0x20, 0xc0, 0x00, 0xf8], "stur x0, [x1, 0xc]"),
        ([0x3f, 0x04, 0x01, 0xf8], "str xzr, [x1], 0x10"),
        ([0xe1, 0xc3, 0x07, 0xf8], "stur x1, [sp, 0x7c]"),
        ([0x7f, 0x80, 0x10, 0xf8], "stur xzr, [x3, -0xf8]"),
        ([0xc3, 0x00, 0x1c, 0xf8], "stur x3, [x6, -0x40]"),
        ([0x02, 0x87, 0x1f, 0xf8], "str x2, [x24], -0x8"),
        ([0x1f, 0xc3, 0x1f, 0xf8], "stur xzr, [x24, -0x4]"),
        ([0xbf, 0x68, 0x20, 0xf8], "str xzr, [x5, x0]"),
        ([0xff, 0x6a, 0x38, 0xf8], "str xzr, [x23, x24]"),
        ([0x7f, 0x7b, 0x3c, 0xf8], "str xzr, [x27, x28, lsl 3]"),
        ([0xc7, 0x40, 0x40, 0xf8], "ldur x7, [x6, 0x4]"),
        ([0x01, 0x87, 0x40, 0xf8], "ldr x1, [x24], 0x8"),
        ([0x98, 0x83, 0x5f, 0xf8], "ldur x24, [x28, -0x8]"),
        ([0x80, 0x86, 0x5f, 0xf8], "ldr x0, [x20], -0x8"),
        ([0xe3, 0x6a, 0x60, 0xf8], "ldr x3, [x23, x0]"),
        ([0xc5, 0x6a, 0x7b, 0xf8], "ldr x5, [x22, x27]"),
        ([0xa0, 0x7a, 0x7c, 0xf8], "ldr x0, [x21, x28, lsl 3]"),
        ([0x08, 0xdb, 0x7c, 0xf8], "ldr x8, [x24, w28, sxtw 3]"),
        ([0x5f, 0x00, 0x00, 0xf9], "str xzr, [x2]"),
        ([0x2a, 0x6d, 0x04, 0xf9], "str x10, [x9, 0x8d8]"),
        ([0xeb, 0x1f, 0x18, 0xf9], "str x11, [sp, 0x3038]"),
        ([0xff, 0x7f, 0x18, 0xf9], "str xzr, [sp, 0x30f8]"),
        ([0xe9, 0x2f, 0x25, 0xf9], "str x9, [sp, 0x4a58]"),
        ([0xe1, 0xd7, 0x26, 0xf9], "str x1, [sp, 0x4da8]"),
        ([0x42, 0x01, 0x40, 0xf9], "ldr x2, [x10]"),
        ([0xf7, 0xef, 0x66, 0xf9], "ldr x23, [sp, 0x4dd8]"),
        ([0x01, 0x00, 0x00, 0xb0], "adrp x1, $+0x1000"),
        ([0xea, 0x6e, 0x00, 0xb0], "adrp x10, $+0xddd000"),
        ([0x13, 0x70, 0x00, 0xb0], "adrp x19, $+0xe01000"),
        ([0x20, 0x00, 0x75, 0x10], "adr x0, $+0xea004"),
        ([0x01, 0x00, 0x00, 0x90], "adrp x1, $+0x0"),
        ([0xc7, 0x6e, 0x00, 0x90], "adrp x7, $+0xdd8000"),
        ([0x01, 0x00, 0x00, 0xd0], "adrp x1, $+0x2000"),
        ([0x13, 0x70, 0x00, 0xd0], "adrp x19, $+0xe02000"),
        ([0xfc, 0xff, 0xff, 0xf0], "adrp x28, $-0x1000"),
        ([0xfd, 0x7b, 0xa1, 0xa9], "stp x29, x30, [sp, -0x1f0]!"),
        ([0xfd, 0x7b, 0xa2, 0xa9], "stp x29, x30, [sp, -0x1e0]!"),
        ([0xfd, 0x7b, 0xbf, 0xa9], "stp x29, x30, [sp, -0x10]!"),
        ([0x23, 0xf0, 0x1f, 0x38], "sturb w3, [x1, -0x1]"),
        ([0x01, 0x00, 0x00, 0x39], "strb w1, [x0]"),
        ([0x20, 0x00, 0x00, 0x39], "strb w0, [x1]"),
        ([0x80, 0x00, 0x00, 0x39], "strb w0, [x4]"),
        ([0x60, 0x02, 0x00, 0x39], "strb w0, [x19]"),
        ([0x80, 0x02, 0x00, 0x39], "strb w0, [x20]"),
        ([0xa0, 0x02, 0x00, 0x39], "strb w0, [x21]"),
        ([0xe0, 0x02, 0x00, 0x39], "strb w0, [x23]"),
        ([0x20, 0x03, 0x00, 0x39], "strb w0, [x25]"),
        ([0x40, 0x03, 0x00, 0x39], "strb w0, [x26]"),
        ([0x68, 0x13, 0x00, 0x39], "strb w8, [x27, 0x4]"),
        ([0xe0, 0x03, 0x01, 0x39], "strb w0, [sp, 0x40]"),
        ([0xe1, 0x43, 0x01, 0x39], "strb w1, [sp, 0x50]"),
        ([0xe1, 0x8b, 0x01, 0x39], "strb w1, [sp, 0x62]"),
        ([0xe2, 0xa3, 0x01, 0x39], "strb w2, [sp, 0x68]"),
        ([0xe5, 0x03, 0x0c, 0x39], "strb w5, [sp, 0x300]"),
        ([0xe0, 0xe3, 0x0d, 0x39], "strb w0, [sp, 0x378]"),
        ([0xe1, 0xe3, 0x0d, 0x39], "strb w1, [sp, 0x378]"),
        ([0xe2, 0xe3, 0x0d, 0x39], "strb w2, [sp, 0x378]"),
        ([0xe0, 0x03, 0x0e, 0x39], "strb w0, [sp, 0x380]"),
        ([0xe0, 0x23, 0x0e, 0x39], "strb w0, [sp, 0x388]"),
        ([0xe1, 0x23, 0x0e, 0x39], "strb w1, [sp, 0x388]"),
        ([0xe2, 0x23, 0x0e, 0x39], "strb w2, [sp, 0x388]"),
        ([0xe0, 0x43, 0x0e, 0x39], "strb w0, [sp, 0x390]"),
        ([0xe0, 0x23, 0x0f, 0x39], "strb w0, [sp, 0x3c8]"),
        ([0xe1, 0x23, 0x0f, 0x39], "strb w1, [sp, 0x3c8]"),
        ([0xe2, 0x23, 0x0f, 0x39], "strb w2, [sp, 0x3c8]"),
        ([0xe0, 0x43, 0x0f, 0x39], "strb w0, [sp, 0x3d0]"),
        ([0xe0, 0xa3, 0x0f, 0x39], "strb w0, [sp, 0x3e8]"),
        ([0xe1, 0xa3, 0x0f, 0x39], "strb w1, [sp, 0x3e8]"),
        ([0xe2, 0xa3, 0x0f, 0x39], "strb w2, [sp, 0x3e8]"),
        ([0xe0, 0xc3, 0x0f, 0x39], "strb w0, [sp, 0x3f0]"),
        ([0x60, 0x02, 0x32, 0x39], "strb w0, [x19, 0xc80]"),
        ([0x13, 0xb8, 0x00, 0x29], "stp w19, w14, [x0, 0x4]"),
        ([0xeb, 0x9f, 0x1f, 0x29], "stp w11, w7, [sp, 0xfc]"),
        ([0x7f, 0x7c, 0x3f, 0x29], "stp wzr, wzr, [x3, -0x8]"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_data_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0xe5, 0x03, 0x1e, 0x2a], "mov w5, w30"),
        ([0xe7, 0x03, 0x1e, 0x2a], "mov w7, w30"),
        ([0xe0, 0x03, 0x1f, 0x2a], "mov w0, wzr"),
        ([0x20, 0x0f, 0x80, 0x52], "mov w0, 0x79"),
        ([0x41, 0x0f, 0x80, 0x52], "mov w1, 0x7a"),
        ([0x01, 0x10, 0x80, 0x52], "mov w1, 0x80"),
        ([0x02, 0x10, 0x80, 0x52], "mov w2, 0x80"),
        ([0x08, 0x10, 0x80, 0x52], "mov w8, 0x80"),
        ([0x0a, 0x10, 0x80, 0x52], "mov w10, 0x80"),
        ([0x13, 0x10, 0x80, 0x52], "mov w19, 0x80"),
        ([0x15, 0x10, 0x80, 0x52], "mov w21, 0x80"),
        ([0x60, 0x10, 0x80, 0x52], "mov w0, 0x83"),
        ([0x81, 0x10, 0x80, 0x52], "mov w1, 0x84"),
        ([0x05, 0x16, 0x80, 0x52], "mov w5, 0xb0"),
        ([0x06, 0x16, 0x80, 0x52], "mov w6, 0xb0"),
        ([0x08, 0x16, 0x80, 0x52], "mov w8, 0xb0"),
        ([0x00, 0x18, 0x80, 0x52], "mov w0, 0xc0"),
        ([0x82, 0x18, 0x80, 0x52], "mov w2, 0xc4"),
        ([0x60, 0x1a, 0x80, 0x52], "mov w0, 0xd3"),
        ([0x80, 0x1a, 0x80, 0x52], "mov w0, 0xd4"),
        ([0xa0, 0x1a, 0x80, 0x52], "mov w0, 0xd5"),
        ([0xc0, 0x1a, 0x80, 0x52], "mov w0, 0xd6"),
        ([0x22, 0x1e, 0x80, 0x52], "mov w2, 0xf1"),
        ([0x00, 0x20, 0x80, 0x52], "mov w0, 0x100"),
        ([0x02, 0x20, 0x80, 0x52], "mov w2, 0x100"),
        ([0x20, 0x20, 0x80, 0x52], "mov w0, 0x101"),
        ([0x22, 0x20, 0x80, 0x52], "mov w2, 0x101"),
        ([0x80, 0x20, 0x80, 0x52], "mov w0, 0x104"),
        ([0xa0, 0x20, 0x80, 0x52], "mov w0, 0x105"),
        ([0xc2, 0x21, 0x80, 0x52], "mov w2, 0x10e"),
        ([0x42, 0x22, 0x80, 0x52], "mov w2, 0x112"),
        ([0xc6, 0x31, 0x80, 0x52], "mov w6, 0x18e"),
        ([0x25, 0x60, 0x80, 0x52], "mov w5, 0x301"),
        ([0x00, 0x82, 0x80, 0x52], "mov w0, 0x410"),
        ([0x20, 0x82, 0x80, 0x52], "mov w0, 0x411"),
        ([0x80, 0x82, 0x80, 0x52], "mov w0, 0x414"),
        ([0xa0, 0x82, 0x80, 0x52], "mov w0, 0x415"),
        ([0x60, 0x9e, 0x80, 0x52], "mov w0, 0x4f3"),
        ([0x02, 0x00, 0x81, 0x52], "mov w2, 0x800"),
        ([0x00, 0x02, 0x81, 0x52], "mov w0, 0x810"),
        ([0x20, 0x02, 0x81, 0x52], "mov w0, 0x811"),
        ([0x80, 0x02, 0x81, 0x52], "mov w0, 0x814"),
        ([0xa0, 0x02, 0x81, 0x52], "mov w0, 0x815"),
        ([0x00, 0x82, 0x81, 0x52], "mov w0, 0xc10"),
        ([0x20, 0x82, 0x81, 0x52], "mov w0, 0xc11"),
        ([0x80, 0x82, 0x81, 0x52], "mov w0, 0xc14"),
        ([0xa0, 0x82, 0x81, 0x52], "mov w0, 0xc15"),
        ([0x60, 0xfb, 0x81, 0x52], "mov w0, 0xfdb"),
        ([0x64, 0xfb, 0x81, 0x52], "mov w4, 0xfdb"),
        ([0x01, 0x00, 0x82, 0x52], "mov w1, 0x1000"),
        ([0xe2, 0x07, 0x82, 0x52], "mov w2, 0x103f"),
        ([0xe3, 0x07, 0x82, 0x52], "mov w3, 0x103f"),
        ([0xe4, 0x07, 0x82, 0x52], "mov w4, 0x103f"),
        ([0xea, 0x07, 0x82, 0x52], "mov w10, 0x103f"),
        ([0xeb, 0x07, 0x82, 0x52], "mov w11, 0x103f"),
        ([0x01, 0x08, 0x82, 0x52], "mov w1, 0x1040"),
        ([0x02, 0x08, 0x82, 0x52], "mov w2, 0x1040"),
        ([0x03, 0x08, 0x82, 0x52], "mov w3, 0x1040"),
        ([0x80, 0x46, 0x82, 0x52], "mov w0, 0x1234"),
        ([0xe0, 0x4d, 0x82, 0x52], "mov w0, 0x126f"),
        ([0xe2, 0xed, 0x82, 0x52], "mov w2, 0x176f"),
        ([0x04, 0x00, 0x84, 0x52], "mov w4, 0x2000"),
        ([0x05, 0x00, 0x84, 0x52], "mov w5, 0x2000"),
        ([0x25, 0x00, 0x84, 0x52], "mov w5, 0x2001"),
        ([0x85, 0x00, 0x84, 0x52], "mov w5, 0x2004"),
        ([0xa5, 0x00, 0x84, 0x52], "mov w5, 0x2005"),
        ([0xa0, 0x18, 0x84, 0x52], "mov w0, 0x20c5"),
        ([0xa1, 0x18, 0x84, 0x52], "mov w1, 0x20c5"),
        ([0xa2, 0x18, 0x84, 0x52], "mov w2, 0x20c5"),
        ([0x03, 0xe2, 0x84, 0x52], "mov w3, 0x2710"),
        ([0x05, 0xe2, 0x84, 0x52], "mov w5, 0x2710"),
        ([0x06, 0x00, 0x86, 0x52], "mov w6, 0x3000"),
        ([0x61, 0x66, 0x86, 0x52], "mov w1, 0x3333"),
        ([0x06, 0x00, 0x88, 0x52], "mov w6, 0x4000"),
        ([0x80, 0x29, 0x88, 0x52], "mov w0, 0x414c"),
        ([0x81, 0x29, 0x88, 0x52], "mov w1, 0x414c"),
        ([0xe0, 0x48, 0x88, 0x52], "mov w0, 0x4247"),
        ([0x00, 0x4a, 0x88, 0x52], "mov w0, 0x4250"),
        ([0xe1, 0xa8, 0x88, 0x52], "mov w1, 0x4547"),
        ([0xe2, 0xa8, 0x88, 0x52], "mov w2, 0x4547"),
        ([0x00, 0xa9, 0x88, 0x52], "mov w0, 0x4548"),
        ([0xe0, 0xe8, 0x88, 0x52], "mov w0, 0x4747"),
        ([0xc0, 0xf5, 0x88, 0x52], "mov w0, 0x47ae"),
        ([0x21, 0x8a, 0x89, 0x52], "mov w1, 0x4c51"),
        ([0xa0, 0xca, 0x89, 0x52], "mov w0, 0x4e55"),
        ([0x02, 0xea, 0x89, 0x52], "mov w2, 0x4f50"),
        ([0x81, 0x29, 0x8a, 0x52], "mov w1, 0x514c"),
        ([0x41, 0x2a, 0x8a, 0x52], "mov w1, 0x5152"),
        ([0x41, 0x48, 0x8a, 0x52], "mov w1, 0x5242"),
        ([0x01, 0x49, 0x8a, 0x52], "mov w1, 0x5248"),
        ([0xe0, 0x49, 0x8a, 0x52], "mov w0, 0x524f"),
        ([0x21, 0x4a, 0x8a, 0x52], "mov w1, 0x5251"),
        ([0x80, 0x4a, 0x8a, 0x52], "mov w0, 0x5254"),
        ([0x81, 0x4a, 0x8a, 0x52], "mov w1, 0x5254"),
        ([0x60, 0x8a, 0x8a, 0x52], "mov w0, 0x5453"),
        ([0xc0, 0xaa, 0x8a, 0x52], "mov w0, 0x5556"),
        ([0xc1, 0xaa, 0x8a, 0x52], "mov w1, 0x5556"),
        ([0xc4, 0xaa, 0x8a, 0x52], "mov w4, 0x5556"),
        ([0xc6, 0xaa, 0x8a, 0x52], "mov w6, 0x5556"),
        ([0xc8, 0xaa, 0x8a, 0x52], "mov w8, 0x5556"),
        ([0xca, 0xaa, 0x8a, 0x52], "mov w10, 0x5556"),
        ([0xd7, 0xaa, 0x8a, 0x52], "mov w23, 0x5556"),
        ([0xd8, 0xaa, 0x8a, 0x52], "mov w24, 0x5556"),
        ([0xd9, 0xaa, 0x8a, 0x52], "mov w25, 0x5556"),
        ([0x61, 0x2a, 0x8b, 0x52], "mov w1, 0x5953"),
        ([0x62, 0x2a, 0x8b, 0x52], "mov w2, 0x5953"),
        ([0xc0, 0xcc, 0x8c, 0x52], "mov w0, 0x6666"),
        ([0xc1, 0xcc, 0x8c, 0x52], "mov w1, 0x6666"),
        ([0xe0, 0xcc, 0x8c, 0x52], "mov w0, 0x6667"),
        ([0x00, 0x43, 0x8e, 0x52], "mov w0, 0x7218"),
        ([0x02, 0x43, 0x8e, 0x52], "mov w2, 0x7218"),
        ([0x40, 0xdf, 0x8f, 0x52], "mov w0, 0x7efa"),
        ([0x13, 0x00, 0x90, 0x52], "mov w19, 0x8000"),
        ([0x20, 0xc7, 0x91, 0x52], "mov w0, 0x8e39"),
        ([0x23, 0xc7, 0x91, 0x52], "mov w3, 0x8e39"),
        ([0x3b, 0xc7, 0x91, 0x52], "mov w27, 0x8e39"),
        ([0x42, 0x55, 0x95, 0x52], "mov w2, 0xaaaa"),
        ([0x64, 0x55, 0x95, 0x52], "mov w4, 0xaaab"),
        ([0xe3, 0xce, 0x97, 0x52], "mov w3, 0xbe77"),
        ([0xa2, 0x99, 0x99, 0x52], "mov w2, 0xcccd"),
        ([0x42, 0xe1, 0x9a, 0x52], "mov w2, 0xd70a"),
        ([0x62, 0x0f, 0x9e, 0x52], "mov w2, 0xf07b"),
        ([0x05, 0x70, 0xa6, 0x52], "mov w5, 0x33800000"),
        ([0x04, 0x30, 0xa7, 0x52], "mov w4, 0x39800000"),
        ([0x00, 0x50, 0xa8, 0x52], "mov w0, 0x42800000"),
        ([0x02, 0x59, 0xa8, 0x52], "mov w2, 0x42c80000"),
        ([0x40, 0x9f, 0xa8, 0x52], "mov w0, 0x44fa0000"),
        ([0x04, 0xb0, 0xa8, 0x52], "mov w4, 0x45800000"),
        ([0x05, 0x70, 0xa9, 0x52], "mov w5, 0x4b800000"),
        ([0x00, 0xf8, 0xaf, 0x52], "mov w0, 0x7fc00000"),
        ([0x41, 0x5f, 0xb8, 0x52], "mov w1, 0xc2fa0000"),
        ([0x06, 0x00, 0x80, 0x92], "mov x6, 0xffffffffffffffff"),
        ([0xfb, 0x01, 0x80, 0x92], "mov x27, 0xfffffffffffffff0"),
        ([0xe3, 0x02, 0x80, 0x92], "mov x3, 0xffffffffffffffe8"),
        ([0xf8, 0x02, 0x80, 0x92], "mov x24, 0xffffffffffffffe8"),
        ([0xfa, 0x03, 0x80, 0x92], "mov x26, 0xffffffffffffffe0"),
        ([0x6b, 0x21, 0x88, 0x92], "mov x11, 0xffffffffffffbef4"),
        ([0xe7, 0x41, 0x90, 0x92], "mov x7, 0xffffffffffff7df0"),
        ([0xe8, 0x41, 0x90, 0x92], "mov x8, 0xffffffffffff7df0"),
        ([0x00, 0x02, 0xe0, 0x92], "mov x0, 0xffefffffffffffff"),
        ([0x00, 0x02, 0xf0, 0x92], "mov x0, 0x7fefffffffffffff"),
        ([0xe0, 0x03, 0x00, 0xb2], "mov x0, 0x100000001"),
        ([0xe1, 0x03, 0x00, 0xb2], "mov x1, 0x100000001"),
        ([0xe2, 0x03, 0x00, 0xb2], "mov x2, 0x100000001"),
        ([0xe4, 0x03, 0x00, 0xb2], "mov x4, 0x100000001"),
        ([0xe1, 0xe7, 0x03, 0xb2], "mov x1, 0x6666666666666666"),
        ([0xe0, 0x1b, 0x09, 0xb2], "mov x0, 0x3f8000003f800000"),
        ([0xe0, 0x7f, 0x60, 0xb2], "mov x0, 0xffffffff00000000"),
        ([0x1b, 0x00, 0x80, 0xd2], "mov x27, 0x0"),
        ([0x8e, 0x01, 0x80, 0xd2], "mov x14, 0xc"),
        ([0x12, 0x10, 0x80, 0xd2], "mov x18, 0x80"),
        ([0x05, 0x14, 0x80, 0xd2], "mov x5, 0xa0"),
        ([0x60, 0x1d, 0x80, 0xd2], "mov x0, 0xeb"),
        ([0x02, 0x20, 0x80, 0xd2], "mov x2, 0x100"),
        ([0x15, 0x40, 0x80, 0xd2], "mov x21, 0x200"),
        ([0x14, 0xc0, 0x81, 0xd2], "mov x20, 0xe00"),
        ([0x00, 0x00, 0x82, 0xd2], "mov x0, 0x1000"),
        ([0x0c, 0x3a, 0x82, 0xd2], "mov x12, 0x11d0"),
        ([0x00, 0x4a, 0x82, 0xd2], "mov x0, 0x1250"),
        ([0x05, 0x4b, 0x82, 0xd2], "mov x5, 0x1258"),
        ([0x03, 0x4d, 0x82, 0xd2], "mov x3, 0x1268"),
        ([0x00, 0x4f, 0x82, 0xd2], "mov x0, 0x1278"),
        ([0x02, 0x4f, 0x82, 0xd2], "mov x2, 0x1278"),
        ([0x02, 0x51, 0x82, 0xd2], "mov x2, 0x1288"),
        ([0xe1, 0x7f, 0x82, 0xd2], "mov x1, 0x13ff"),
        ([0x07, 0x90, 0x82, 0xd2], "mov x7, 0x1480"),
        ([0x08, 0xdb, 0x82, 0xd2], "mov x8, 0x16d8"),
        ([0xe1, 0xff, 0x82, 0xd2], "mov x1, 0x17ff"),
        ([0x09, 0xcf, 0x83, 0xd2], "mov x9, 0x1e78"),
        ([0xe5, 0xff, 0x83, 0xd2], "mov x5, 0x1fff"),
        ([0x03, 0x00, 0x84, 0xd2], "mov x3, 0x2000"),
        ([0x0c, 0x4a, 0x84, 0xd2], "mov x12, 0x2250"),
        ([0xe2, 0x7f, 0x84, 0xd2], "mov x2, 0x23ff"),
        ([0x01, 0x80, 0x84, 0xd2], "mov x1, 0x2400"),
        ([0x05, 0xe2, 0x84, 0xd2], "mov x5, 0x2710"),
        ([0x00, 0xec, 0x84, 0xd2], "mov x0, 0x2760"),
        ([0x0c, 0xee, 0x84, 0xd2], "mov x12, 0x2770"),
        ([0x0c, 0x8a, 0x85, 0xd2], "mov x12, 0x2c50"),
        ([0x0c, 0xc6, 0x85, 0xd2], "mov x12, 0x2e30"),
        ([0x0c, 0xd6, 0x85, 0xd2], "mov x12, 0x2eb0"),
        ([0x0c, 0xd8, 0x85, 0xd2], "mov x12, 0x2ec0"),
        ([0x0c, 0xdc, 0x85, 0xd2], "mov x12, 0x2ee0"),
        ([0x0c, 0xde, 0x85, 0xd2], "mov x12, 0x2ef0"),
        ([0x0c, 0xe0, 0x85, 0xd2], "mov x12, 0x2f00"),
        ([0x0c, 0xe4, 0x85, 0xd2], "mov x12, 0x2f20"),
        ([0x0c, 0xe6, 0x85, 0xd2], "mov x12, 0x2f30"),
        ([0x0c, 0x08, 0x86, 0xd2], "mov x12, 0x3040"),
        ([0x0c, 0x20, 0x86, 0xd2], "mov x12, 0x3100"),
        ([0x02, 0x21, 0x86, 0xd2], "mov x2, 0x3108"),
        ([0x0c, 0x22, 0x86, 0xd2], "mov x12, 0x3110"),
        ([0x01, 0x29, 0x86, 0xd2], "mov x1, 0x3148"),
        ([0x0c, 0x2a, 0x86, 0xd2], "mov x12, 0x3150"),
        ([0x00, 0x2d, 0x86, 0xd2], "mov x0, 0x3168"),
        ([0x0c, 0x2e, 0x86, 0xd2], "mov x12, 0x3170"),
        ([0x0c, 0x30, 0x86, 0xd2], "mov x12, 0x3180"),
        ([0x0c, 0x42, 0x86, 0xd2], "mov x12, 0x3210"),
        ([0x0c, 0x44, 0x86, 0xd2], "mov x12, 0x3220"),
        ([0x06, 0x4d, 0x86, 0xd2], "mov x6, 0x3268"),
        ([0x0c, 0x4e, 0x86, 0xd2], "mov x12, 0x3270"),
        ([0xe1, 0xff, 0x87, 0xd2], "mov x1, 0x3fff"),
        ([0xe2, 0xff, 0x87, 0xd2], "mov x2, 0x3fff"),
        ([0x08, 0x02, 0x88, 0xd2], "mov x8, 0x4010"),
        ([0x04, 0x51, 0x88, 0xd2], "mov x4, 0x4288"),
        ([0x0c, 0x52, 0x88, 0xd2], "mov x12, 0x4290"),
        ([0x04, 0x53, 0x88, 0xd2], "mov x4, 0x4298"),
        ([0x0c, 0x54, 0x88, 0xd2], "mov x12, 0x42a0"),
        ([0x8c, 0x58, 0x88, 0xd2], "mov x12, 0x42c4"),
        ([0x02, 0x59, 0x88, 0xd2], "mov x2, 0x42c8"),
        ([0x06, 0x59, 0x88, 0xd2], "mov x6, 0x42c8"),
        ([0x08, 0x59, 0x88, 0xd2], "mov x8, 0x42c8"),
        ([0x09, 0x59, 0x88, 0xd2], "mov x9, 0x42c8"),
        ([0x0c, 0x6a, 0x88, 0xd2], "mov x12, 0x4350"),
        ([0x0c, 0x4a, 0x89, 0xd2], "mov x12, 0x4a50"),
        ([0x0c, 0x4c, 0x89, 0xd2], "mov x12, 0x4a60"),
        ([0x00, 0xb4, 0x89, 0xd2], "mov x0, 0x4da0"),
        ([0x0c, 0xb6, 0x89, 0xd2], "mov x12, 0x4db0"),
        ([0x00, 0x0a, 0x90, 0xd2], "mov x0, 0x8050"),
        ([0x01, 0x20, 0x90, 0xd2], "mov x1, 0x8100"),
        ([0x0d, 0x20, 0x90, 0xd2], "mov x13, 0x8100"),
        ([0x0a, 0x7a, 0x90, 0xd2], "mov x10, 0x83d0"),
        ([0x0c, 0x7a, 0x90, 0xd2], "mov x12, 0x83d0"),
        ([0x08, 0x7c, 0x90, 0xd2], "mov x8, 0x83e0"),
        ([0x07, 0x7d, 0x90, 0xd2], "mov x7, 0x83e8"),
        ([0x01, 0x46, 0x93, 0xd2], "mov x1, 0x9a30"),
        ([0x0c, 0x48, 0x93, 0xd2], "mov x12, 0x9a40"),
        ([0x01, 0x20, 0xa0, 0xd2], "mov x1, 0x1000000"),
        ([0x00, 0xf0, 0xa7, 0xd2], "mov x0, 0x3f800000"),
        ([0x1c, 0xf0, 0xa7, 0xd2], "mov x28, 0x3f800000"),
        ([0x00, 0xf0, 0xb7, 0xd2], "mov x0, 0xbf800000"),
        ([0x05, 0xf0, 0xb7, 0xd2], "mov x5, 0xbf800000"),
        ([0x00, 0x00, 0xc8, 0xd2], "mov x0, 0x400000000000"),
        ([0x00, 0x00, 0xd0, 0xd2], "mov x0, 0x800000000000"),
        ([0x00, 0x00, 0xdd, 0xd2], "mov x0, 0xe80000000000"),
        ([0x00, 0x02, 0xe0, 0xd2], "mov x0, 0x10000000000000"),
        ([0x01, 0x94, 0xe7, 0xd2], "mov x1, 0x3ca0000000000000"),
        ([0x01, 0x96, 0xe7, 0xd2], "mov x1, 0x3cb0000000000000"),
        ([0x02, 0xce, 0xe7, 0xd2], "mov x2, 0x3e70000000000000"),
        ([0x00, 0xe6, 0xe7, 0xd2], "mov x0, 0x3f30000000000000"),
        ([0x13, 0xf0, 0xe7, 0xd2], "mov x19, 0x3f80000000000000"),
        ([0x00, 0x0a, 0xe8, 0xd2], "mov x0, 0x4050000000000000"),
        ([0x20, 0x0b, 0xe8, 0xd2], "mov x0, 0x4059000000000000"),
        ([0x00, 0x12, 0xe8, 0xd2], "mov x0, 0x4090000000000000"),
        ([0x04, 0x16, 0xe8, 0xd2], "mov x4, 0x40b0000000000000"),
        ([0x40, 0x18, 0xe8, 0xd2], "mov x0, 0x40c2000000000000"),
        ([0x01, 0x1c, 0xe8, 0xd2], "mov x1, 0x40e0000000000000"),
        ([0x01, 0x22, 0xe8, 0xd2], "mov x1, 0x4110000000000000"),
        ([0x00, 0x2e, 0xe8, 0xd2], "mov x0, 0x4170000000000000"),
        ([0x00, 0xff, 0xef, 0xd2], "mov x0, 0x7ff8000000000000"),
        ([0x00, 0x00, 0xf0, 0xd2], "mov x0, 0x8000000000000000"),
        ([0x02, 0xfe, 0xff, 0xd2], "mov x2, 0xfff0000000000000"),
        ([0x1b, 0x00, 0x80, 0x12], "mov w27, 0xffffffff"),
        ([0x84, 0x00, 0x80, 0x12], "mov w4, 0xfffffffb"),
        ([0x00, 0x19, 0x80, 0x12], "mov w0, 0xffffff37"),
        ([0xe0, 0x07, 0x82, 0x12], "mov w0, 0xffffefc0"),
        ([0xe1, 0x07, 0x82, 0x12], "mov w1, 0xffffefc0"),
        ([0x00, 0x10, 0xb0, 0x12], "mov w0, 0x7f7fffff"),
        ([0xf9, 0x03, 0x0a, 0xaa], "mov x25, x10"),
        ([0x01, 0x20, 0xa0, 0xf2], "movk x1, 0x100, lsl 16"),
        ([0x02, 0x0e, 0xc0, 0xf2], "movk x2, 0x70, lsl 32"),
        ([0x03, 0x0e, 0xc0, 0xf2], "movk x3, 0x70, lsl 32"),
        ([0x02, 0x0f, 0xc0, 0xf2], "movk x2, 0x78, lsl 32"),
        ([0x04, 0x10, 0xc0, 0xf2], "movk x4, 0x80, lsl 32"),
        ([0x05, 0x10, 0xc0, 0xf2], "movk x5, 0x80, lsl 32"),
        ([0x04, 0x1c, 0xc0, 0xf2], "movk x4, 0xe0, lsl 32"),
        ([0x07, 0x1e, 0xc0, 0xf2], "movk x7, 0xf0, lsl 32"),
        ([0x06, 0x2c, 0xc0, 0xf2], "movk x6, 0x160, lsl 32"),
        ([0xc1, 0xfd, 0xe7, 0xf2], "movk x1, 0x3fee, lsl 48"),
        ([0x40, 0x09, 0xe8, 0xf2], "movk x0, 0x404a, lsl 48"),
        ([0xe0, 0x13, 0xe8, 0xf2], "movk x0, 0x409f, lsl 48"),
        ([0xe0, 0x11, 0xf8, 0xf2], "movk x0, 0xc08f, lsl 48"),
        ([0x42, 0x55, 0xa5, 0x72], "movk w2, 0x2aaa, lsl 16"),
        ([0x60, 0x1c, 0xa7, 0x72], "movk w0, 0x38e3, lsl 16"),
        ([0x63, 0x1c, 0xa7, 0x72], "movk w3, 0x38e3, lsl 16"),
        ([0x80, 0x99, 0xb9, 0x72], "movk w0, 0xcccc, lsl 16"),
        ([0xfa, 0x03, 0x3c, 0xaa], "mvn x26, x28"),
        ([0xfb, 0x03, 0x3c, 0xaa], "mvn x27, x28"),
        ([0xfe, 0x03, 0x3e, 0xaa], "mvn x30, x30"),
        ([0xe3, 0x03, 0x3b, 0x2a], "mvn w3, w27"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_cmp_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0xff, 0x01, 0x01, 0xeb], "cmp x15, x1"),
        ([0x1f, 0x02, 0x01, 0xeb], "cmp x16, x1"),
        ([0x9f, 0x02, 0x1b, 0xeb], "cmp x20, x27"),
        ([0xbf, 0x06, 0x1b, 0xeb], "cmp x21, x27, lsl 1"),
        ([0x7f, 0xc3, 0x20, 0xeb], "cmp x27, w0, sxtw 0"),
        ([0xff, 0x63, 0x21, 0xeb], "cmp sp, x1"),
        ([0x1f, 0xc0, 0x21, 0xeb], "cmp x0, w1, sxtw 0"),
        ([0x5f, 0xc0, 0x21, 0xeb], "cmp x2, w1, sxtw 0"),
        ([0x5f, 0x0b, 0x00, 0xf1], "cmp x26, 0x2"),
        ([0x7f, 0x0d, 0x00, 0xf1], "cmp x11, 0x3"),
        ([0xdf, 0x0f, 0x00, 0xf1], "cmp x30, 0x3"),
        ([0x7f, 0x13, 0x00, 0xf1], "cmp x27, 0x4"),
        ([0xdf, 0x16, 0x00, 0xf1], "cmp x22, 0x5"),
        ([0x3f, 0x1b, 0x00, 0xf1], "cmp x25, 0x6"),
        ([0x7f, 0x1c, 0x00, 0xf1], "cmp x3, 0x7"),
        ([0x1f, 0x20, 0x00, 0xf1], "cmp x0, 0x8"),
        ([0x9f, 0x23, 0x00, 0xf1], "cmp x28, 0x8"),
        ([0x9f, 0x27, 0x00, 0xf1], "cmp x28, 0x9"),
        ([0x9f, 0x2b, 0x00, 0xf1], "cmp x28, 0xa"),
        ([0x1f, 0x2c, 0x00, 0xf1], "cmp x0, 0xb"),
        ([0x9f, 0x2f, 0x00, 0xf1], "cmp x28, 0xb"),
        ([0x1f, 0x30, 0x00, 0xf1], "cmp x0, 0xc"),
        ([0x9f, 0x33, 0x00, 0xf1], "cmp x28, 0xc"),
        ([0x1f, 0x34, 0x00, 0xf1], "cmp x0, 0xd"),
        ([0xbf, 0x36, 0x00, 0xf1], "cmp x21, 0xd"),
        ([0xdf, 0x36, 0x00, 0xf1], "cmp x22, 0xd"),
        ([0x1f, 0x3d, 0x00, 0xf1], "cmp x8, 0xf"),
        ([0xbf, 0x3e, 0x00, 0xf1], "cmp x21, 0xf"),
        ([0xdf, 0x3e, 0x00, 0xf1], "cmp x22, 0xf"),
        ([0x1f, 0x41, 0x00, 0xf1], "cmp x8, 0x10"),
        ([0x5f, 0x41, 0x00, 0xf1], "cmp x10, 0x10"),
        ([0xff, 0x80, 0x00, 0xf1], "cmp x7, 0x20"),
        ([0x3f, 0xfc, 0x00, 0xf1], "cmp x1, 0x3f"),
        ([0x1f, 0x01, 0x01, 0xf1], "cmp x8, 0x40"),
        ([0x3f, 0xfc, 0x07, 0xf1], "cmp x1, 0x1ff"),
        ([0x3f, 0xfc, 0x0f, 0xf1], "cmp x1, 0x3ff"),
        ([0x7f, 0xfc, 0x0f, 0xf1], "cmp x3, 0x3ff"),
        ([0x1f, 0x00, 0x10, 0xf1], "cmp x0, 0x400"),
        ([0x3f, 0x00, 0x10, 0xf1], "cmp x1, 0x400"),
        ([0x3f, 0x00, 0x24, 0xf1], "cmp x1, 0x900"),
        ([0x1f, 0xfc, 0x3f, 0xf1], "cmp x0, 0xfff"),
        ([0x3f, 0xfc, 0x3f, 0xf1], "cmp x1, 0xfff"),
        ([0x1f, 0x08, 0x40, 0xf1], "cmp x0, 0x2000"),
        ([0x3f, 0x08, 0x40, 0xf1], "cmp x1, 0x2000"),
        ([0x7f, 0x01, 0x00, 0xf1], "cmp x11, 0x0"),
        ([0x3f, 0x07, 0x00, 0xf1], "cmp x25, 0x1"),
        ([0x1f, 0x00, 0x00, 0x71], "cmp w0, 0x0"),
        ([0x3f, 0x04, 0x00, 0x6b], "cmp w1, w0, lsl 1"),
        ([0x5f, 0x05, 0x80, 0x6b], "cmp w10, w0, asr 1"),
        ([0x3f, 0x04, 0x00, 0x71], "cmp w1, 0x1"),
        ([0x5f, 0x24, 0x34, 0x71], "cmp w2, 0xd09"),
        ([0x7f, 0x0a, 0x40, 0x71], "cmp w19, 0x2000"),
        ([0x1f, 0x80, 0x40, 0x71], "cmp w0, 0x20000"),
        ([0x1f, 0x00, 0x44, 0x71], "cmp w0, 0x100000"),
        ([0x9f, 0x02, 0x1a, 0x2b], "cmn w20, w26"),
        ([0x1f, 0x58, 0x00, 0x31], "cmn w0, 0x16"),
        ([0x1f, 0x04, 0x00, 0xb1], "cmn x0, 0x1"),
        ([0xdf, 0x38, 0x00, 0xb1], "cmn x6, 0xe"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_tst_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x9f, 0x02, 0x05, 0x6a], "tst w20, w5"),
        ([0x1f, 0x78, 0x1e, 0x72], "tst w0, 0xfffffffd"),
        ([0x3f, 0x78, 0x1e, 0x72], "tst w1, 0xfffffffd"),
        ([0x5f, 0x03, 0x13, 0xea], "tst x26, x19"),
        ([0x3f, 0x01, 0x40, 0xf2], "tst x9, 0x1"),
        ([0x5f, 0x01, 0x40, 0xf2], "tst x10, 0x1"),
        ([0x1f, 0x04, 0x40, 0xf2], "tst x0, 0x3"),
        ([0x3f, 0x09, 0x40, 0xf2], "tst x9, 0x7"),
        ([0x3f, 0x01, 0x7e, 0xf2], "tst x9, 0x4"),
        ([0x5f, 0x04, 0x7f, 0xf2], "tst x2, 0x6"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_conditional_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x82, 0xd2, 0x80, 0x1a], "csel w2, w20, w0, le"),
        ([0x94, 0xd2, 0x80, 0x1a], "csel w20, w20, w0, le"),
        ([0xe2, 0x13, 0x81, 0x1a], "csel w2, wzr, w1, ne"),
        ([0x73, 0xa2, 0x81, 0x1a], "csel w19, w19, w1, ge"),
        ([0xe1, 0xa3, 0x81, 0x1a], "csel w1, wzr, w1, ge"),
        ([0xe1, 0xa7, 0x81, 0x1a], "csinc w1, wzr, w1, ge"),
        ([0x21, 0xb3, 0x81, 0x1a], "csel w1, w25, w1, lt"),
        ([0x9c, 0xd3, 0x81, 0x1a], "csel w28, w28, w1, le"),
        ([0x00, 0x00, 0x82, 0x1a], "csel w0, w0, w2, eq"),
        ([0x00, 0x30, 0x82, 0x1a], "csel w0, w0, w2, lo"),
        ([0x42, 0x54, 0x82, 0x1a], "cinc w2, w2, mi"),
        ([0x62, 0x80, 0x82, 0x1a], "csel w2, w3, w2, hi"),
        ([0x02, 0xa0, 0x82, 0x1a], "csel w2, w0, w2, ge"),
        ([0x44, 0xa4, 0x84, 0x1a], "csinc w4, w2, w4, ge"),
        ([0x81, 0xc7, 0x9f, 0x1a], "csinc w1, w28, wzr, gt"),
        ([0x9c, 0xc7, 0x9f, 0x1a], "csinc w28, w28, wzr, gt"),
        ([0xf4, 0xc7, 0x9f, 0x1a], "cset w20, le"),
        ([0x94, 0xd2, 0x9f, 0x1a], "csel w20, w20, wzr, le"),
        ([0x00, 0xd4, 0x9f, 0x1a], "csinc w0, w0, wzr, le"),
        ([0x21, 0xd4, 0x9f, 0x1a], "csinc w1, w1, wzr, le"),
        ([0xfa, 0xd7, 0x9f, 0x1a], "cset w26, gt"),
        ([0x16, 0x04, 0x80, 0x5a], "cneg w22, w0, ne"),
        ([0x00, 0x44, 0x82, 0x5a], "csneg w0, w0, w2, mi"),
        ([0x9c, 0x17, 0x9c, 0x5a], "cneg w28, w28, eq"),
        ([0x9c, 0x03, 0x9f, 0x5a], "csinv w28, w28, wzr, eq"),
        ([0xfc, 0x03, 0x9f, 0x5a], "csetm w28, ne"),
        ([0x7b, 0x13, 0x9f, 0x5a], "csinv w27, w27, wzr, ne"),
        ([0xc6, 0xb0, 0x9f, 0x5a], "csinv w6, w6, wzr, lt"),
        ([0x63, 0xc0, 0x9f, 0x5a], "csinv w3, w3, wzr, gt"),
        ([0x84, 0x1b, 0x40, 0xfa], "ccmp x28, 0x0, 0x4, ne"),
        ([0x84, 0xca, 0x40, 0xfa], "ccmp x20, 0x0, 0x4, gt"),
        ([0x80, 0x08, 0x41, 0xfa], "ccmp x4, 0x1, 0x0, eq"),
        ([0x64, 0x12, 0x43, 0xfa], "ccmp x19, x3, 0x4, ne"),
        ([0x04, 0x10, 0x45, 0xfa], "ccmp x0, x5, 0x4, ne"),
        ([0x24, 0xd3, 0x5b, 0xfa], "ccmp x25, x27, 0x4, le"),
        ([0x00, 0x08, 0x40, 0x7a], "ccmp w0, 0x0, 0x0, eq"),
        ([0x01, 0xc0, 0x5c, 0x7a], "ccmp w0, w28, 0x1, gt"),
        ([0x04, 0x08, 0x41, 0x3a], "ccmn w0, 0x1, 0x4, eq"),
        ([0x84, 0xbb, 0x41, 0x3a], "ccmn w28, 0x1, 0x4, lt"),
        ([0x04, 0xc8, 0x41, 0x3a], "ccmn w0, 0x1, 0x4, gt"),
        ([0xa4, 0xc8, 0x41, 0x3a], "ccmn w5, 0x1, 0x4, gt"),
        ([0x84, 0xdb, 0x41, 0x3a], "ccmn w28, 0x1, 0x4, le"),
        ([0x84, 0x1b, 0x4a, 0x3a], "ccmn w28, 0xa, 0x4, ne"),
        ([0x08, 0x41, 0x80, 0x9a], "csel x8, x8, x0, mi"),
        ([0x8c, 0xb1, 0x8f, 0x9a], "csel x12, x12, x15, lt"),
        ([0xc6, 0x50, 0x97, 0x9a], "csel x6, x6, x23, pl"),
        ([0x08, 0x51, 0x97, 0x9a], "csel x8, x8, x23, pl"),
        ([0x77, 0xd0, 0x97, 0x9a], "csel x23, x3, x23, le"),
        ([0x9c, 0xa3, 0x9f, 0x9a], "csel x28, x28, xzr, ge"),
        ([0x00, 0xc0, 0x9f, 0x9a], "csel x0, x0, xzr, gt"),
        ([0x21, 0xc0, 0x9f, 0x9a], "csel x1, x1, xzr, gt"),
        ([0x33, 0xc0, 0x9f, 0x9a], "csel x19, x1, xzr, gt"),
        ([0x63, 0xc0, 0x9f, 0x9a], "csel x3, x3, xzr, gt"),
        ([0x39, 0xc3, 0x9f, 0x9a], "csel x25, x25, xzr, gt"),
        ([0x05, 0xc4, 0x9f, 0x9a], "csinc x5, x0, xzr, gt"),
        ([0x18, 0xc7, 0x9f, 0x9a], "csinc x24, x24, xzr, gt"),
        ([0x39, 0xc7, 0x9f, 0x9a], "csinc x25, x25, xzr, gt"),
        ([0xf7, 0xc7, 0x9f, 0x9a], "cset x23, le"),
        ([0x1b, 0xd0, 0x9f, 0x9a], "csel x27, x0, xzr, le"),
        ([0x00, 0xd3, 0x9f, 0x9a], "csel x0, x24, xzr, le"),
        ([0xe0, 0xd7, 0x9f, 0x9a], "cset x0, gt"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_muldiv_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x39, 0x08, 0xc0, 0x1a], "udiv w25, w1, w0"),
        ([0x3a, 0x09, 0xc1, 0x1a], "udiv w26, w9, w1"),
        ([0xa0, 0x0e, 0xc1, 0x1a], "sdiv w0, w21, w1"),
        ([0x00, 0x08, 0xc2, 0x1a], "udiv w0, w0, w2"),
        ([0x61, 0x0b, 0xc2, 0x1a], "udiv w1, w27, w2"),
        ([0x00, 0x0c, 0xc2, 0x1a], "sdiv w0, w0, w2"),
        ([0x01, 0x0d, 0xc2, 0x1a], "sdiv w1, w8, w2"),
        ([0x00, 0x08, 0xc3, 0x1a], "udiv w0, w0, w3"),
        ([0x6b, 0x0d, 0xc4, 0x1a], "sdiv w11, w11, w4"),
        ([0x73, 0x0e, 0xdc, 0x1a], "sdiv w19, w19, w28"),
        ([0xa1, 0x72, 0x00, 0x1b], "madd w1, w21, w0, w28"),
        ([0x3c, 0xa8, 0x00, 0x1b], "msub w28, w1, w0, w10"),
        ([0x80, 0x7f, 0x01, 0x1b], "mul w0, w28, w1"),
        ([0x00, 0x0c, 0xd3, 0x9a], "sdiv x0, x0, x19"),
        ([0x80, 0x0c, 0xda, 0x9a], "sdiv x0, x4, x26"),
        ([0x00, 0x0c, 0xdb, 0x9a], "sdiv x0, x0, x27"),
        ([0x00, 0x00, 0x00, 0x9b], "madd x0, x0, x0, x0"),
        ([0x9c, 0x7f, 0x1b, 0x9b], "mul x28, x28, x27"),
        ([0x00, 0xd4, 0x1b, 0x9b], "msub x0, x0, x27, x21"),
        ([0x20, 0x00, 0x1c, 0x9b], "madd x0, x1, x28, x0"),
        ([0x81, 0x7b, 0x1e, 0x9b], "madd x1, x28, x30, x30"),
        ([0xad, 0x7d, 0x1e, 0x9b], "mul x13, x13, x30"),
        ([0x02, 0x7f, 0x3a, 0x9b], "smull x2, w24, w26"),
        ([0x42, 0x64, 0x3c, 0x9b], "smaddl x2, w2, w28, x25"),
        ([0x29, 0x7c, 0x3c, 0x9b], "smull x9, w1, w28"),
        ([0x20, 0x7c, 0xa0, 0x9b], "umull x0, w1, w0"),
        ([0x42, 0x0c, 0xa4, 0x9b], "umaddl x2, w2, w4, x3"),
        ([0x21, 0x7c, 0xa4, 0x9b], "umull x1, w1, w4"),
        ([0x63, 0x98, 0xa4, 0x9b], "umsubl x3, w3, w4, x6"),
        ([0x85, 0x00, 0xa5, 0x9b], "umaddl x5, w4, w5, x0"),
        ([0x10, 0xa8, 0xb0, 0x9b], "umsubl x16, w0, w16, x10"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_branch_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x40, 0x00, 0x00, 0x34], "cbz w0, $+0x8"),
        ([0xcd, 0xff, 0xff, 0x34], "cbz w13, $-0x8"),
        ([0x40, 0x00, 0x00, 0x35], "cbnz w0, $+0x8"),
        ([0x19, 0xfd, 0xff, 0x35], "cbnz w25, $-0x60"),
        ([0xc1, 0xff, 0xff, 0x35], "cbnz w1, $-0x8"),
        ([0x61, 0x00, 0x00, 0x36], "tbz w1, 0x0, $+0xc"),
        ([0x20, 0x01, 0x00, 0x36], "tbz w0, 0x0, $+0x24"),
        ([0x73, 0x00, 0xf8, 0x36], "tbz w19, 0x1f, $+0xc"),
        ([0x27, 0xff, 0xff, 0x36], "tbz w7, 0x1f, $-0x1c"),
        ([0xf3, 0x05, 0x00, 0x37], "tbnz w19, 0x0, $+0xbc"),
        ([0xfb, 0xff, 0xff, 0x17], "b $-0x14"),
        ([0xfd, 0xff, 0xff, 0x17], "b $-0xc"),
        ([0x6d, 0x02, 0x00, 0x54], "b.le $+0x4c"),
        ([0x6d, 0xff, 0xff, 0x54], "b.le $-0x14"),
        ([0x97, 0x1e, 0x00, 0x94], "bl $+0x7a5c"),
        ([0xd2, 0xff, 0xff, 0x97], "bl $-0xb8"),
        ([0x53, 0x00, 0x00, 0xb4], "cbz x19, $+0x8"),
        ([0x7c, 0x00, 0x00, 0xb4], "cbz x28, $+0xc"),
        ([0x96, 0x00, 0x00, 0xb5], "cbnz x22, $+0x10"),
        ([0x98, 0x00, 0x00, 0xb5], "cbnz x24, $+0x10"),
        ([0xa6, 0x00, 0xf8, 0xb6], "tbz x6, 0x3f, $+0x14"),
        ([0x73, 0x03, 0xf8, 0xb7], "tbnz x19, 0x3f, $+0x6c"),
        ([0x23, 0xf8, 0xff, 0xb7], "tbnz x3, 0x3f, $-0xfc"),
        ([0x40, 0x00, 0x1f, 0xd6], "br x2"),
        ([0x00, 0x02, 0x1f, 0xd6], "br x16"),
        ([0x20, 0x02, 0x1f, 0xd6], "br x17"),
        ([0x00, 0x00, 0x3f, 0xd6], "blr x0"),
        ([0x20, 0x00, 0x3f, 0xd6], "blr x1"),
        ([0x80, 0x03, 0x3f, 0xd6], "blr x28"),
        ([0xc0, 0x03, 0x5f, 0xd6], "ret"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_simd_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x64, 0xcc, 0x21, 0x0e], "fmla v4.2s, v3.2s, v1.2s"),
        ([0x00, 0xd4, 0x21, 0x0e], "fadd v0.2s, v0.2s, v1.2s"),
        ([0x03, 0xcc, 0x22, 0x0e], "fmla v3.2s, v0.2s, v2.2s"),
        ([0x21, 0xd4, 0x23, 0x0e], "fadd v1.2s, v1.2s, v3.2s"),
        ([0x29, 0xd5, 0x35, 0x0e], "fadd v9.2s, v9.2s, v21.2s"),
        ([0x4a, 0xd5, 0x35, 0x0e], "fadd v10.2s, v10.2s, v21.2s"),
        ([0x42, 0x78, 0x61, 0x0e], "fcvtl v2.2d, v2.2s"),
        ([0x63, 0x78, 0x61, 0x0e], "fcvtl v3.2d, v3.2s"),
        ([0x00, 0xf8, 0xa0, 0x0e], "fabs v0.2s, v0.2s"),
        ([0x25, 0xcc, 0xa2, 0x0e], "fmls v5.2s, v1.2s, v2.2s"),
        ([0x10, 0x11, 0x80, 0x0f], "fmla v16.2s, v8.2s, v0.s[0]"),
        ([0x39, 0x58, 0x88, 0x0f], "fmls v25.2s, v1.2s, v8.s[2]"),
        ([0x08, 0x92, 0x8a, 0x0f], "fmul v8.2s, v16.2s, v10.s[0]"),
        ([0x01, 0x12, 0x8b, 0x0f], "fmla v1.2s, v16.2s, v11.s[0]"),
        ([0x8c, 0x12, 0x8e, 0x0f], "fmla v12.2s, v20.2s, v14.s[0]"),
        ([0xc6, 0x12, 0x8e, 0x0f], "fmla v6.2s, v22.2s, v14.s[0]"),
        ([0x3c, 0x58, 0xa9, 0x0f], "fmls v28.2s, v1.2s, v9.s[3]"),
        ([0x00, 0x06, 0x20, 0x1e], "fccmp s16, s0, 0x0, eq"),
        ([0x05, 0x08, 0x22, 0x1e], "fmul s5, s0, s2"),
        ([0x35, 0x88, 0x24, 0x1e], "fnmul s21, s1, s4"),
        ([0x42, 0x88, 0x24, 0x1e], "fnmul s2, s2, s4"),
        ([0x00, 0xdc, 0x26, 0x1e], "fcsel s0, s0, s6, le"),
        ([0x4e, 0x0c, 0x2e, 0x1e], "fcsel s14, s2, s14, eq"),
        ([0x41, 0x18, 0x2e, 0x1e], "fdiv s1, s2, s14"),
        ([0xd3, 0x5e, 0x33, 0x1e], "fcsel s19, s22, s19, pl"),
        ([0xe4, 0x3b, 0x3b, 0x1e], "fsub s4, s31, s27"),
        ([0xa1, 0x08, 0x3c, 0x1e], "fmul s1, s5, s28"),
        ([0xb8, 0x1a, 0x3c, 0x1e], "fdiv s24, s21, s28"),
        ([0x5c, 0x39, 0x3c, 0x1e], "fsub s28, s10, s28"),
        ([0x76, 0x08, 0x3d, 0x1e], "fmul s22, s3, s29"),
        ([0x59, 0x18, 0x3d, 0x1e], "fdiv s25, s2, s29"),
        ([0x26, 0x08, 0x3e, 0x1e], "fmul s6, s1, s30"),
        ([0x39, 0x3b, 0x3f, 0x1e], "fsub s25, s25, s31"),
        ([0x20, 0x04, 0x60, 0x1e], "fccmp d1, d0, 0x0, eq"),
        ([0x20, 0x06, 0x60, 0x1e], "fccmp d17, d0, 0x0, eq"),
        ([0x00, 0x08, 0x60, 0x1e], "fmul d0, d0, d0"),
        ([0xe8, 0x0b, 0x60, 0x1e], "fmul d8, d31, d0"),
        ([0xf3, 0x0b, 0x60, 0x1e], "fmul d19, d31, d0"),
        ([0x40, 0x0c, 0x60, 0x1e], "fcsel d0, d2, d0, eq"),
        ([0x08, 0x0d, 0x60, 0x1e], "fcsel d8, d8, d0, eq"),
        ([0xc4, 0x14, 0x60, 0x1e], "fccmp d6, d0, 0x4, ne"),
        ([0x72, 0x15, 0x60, 0x1e], "fccmpe d11, d0, 0x2, ne"),
        ([0xa4, 0x15, 0x60, 0x1e], "fccmp d13, d0, 0x4, ne"),
        ([0xe4, 0x15, 0x60, 0x1e], "fccmp d15, d0, 0x4, ne"),
        ([0x20, 0x18, 0x60, 0x1e], "fdiv d0, d1, d0"),
        ([0xc6, 0x1a, 0x60, 0x1e], "fdiv d6, d22, d0"),
        ([0x20, 0x1c, 0x60, 0x1e], "fcsel d0, d1, d0, ne"),
        ([0xef, 0x1d, 0x60, 0x1e], "fcsel d15, d15, d0, ne"),
        ([0x70, 0x22, 0x60, 0x1e], "fcmpe d19, d0"),
        ([0xd8, 0x22, 0x60, 0x1e], "fcmpe d22, 0.0"),
        ([0x08, 0x23, 0x60, 0x1e], "fcmp d24, 0.0"),
        ([0x80, 0x28, 0x60, 0x1e], "fadd d0, d4, d0"),
        ([0x22, 0x4c, 0x60, 0x1e], "fcsel d2, d1, d0, mi"),
        ([0x21, 0x5c, 0x60, 0x1e], "fcsel d1, d1, d0, pl"),
        ([0x20, 0x68, 0x60, 0x1e], "fmaxnm d0, d1, d0"),
        ([0xab, 0x6a, 0x60, 0x1e], "fmaxnm d11, d21, d0"),
        ([0xaf, 0x79, 0x60, 0x1e], "fminnm d15, d13, d0"),
        ([0x82, 0x8b, 0x60, 0x1e], "fnmul d2, d28, d0"),
        ([0xc0, 0x8b, 0x60, 0x1e], "fnmul d0, d30, d0"),
        ([0x22, 0x9c, 0x60, 0x1e], "fcsel d2, d1, d0, ls"),
        ([0x08, 0xad, 0x60, 0x1e], "fcsel d8, d8, d0, ge"),
        ([0x20, 0xcc, 0x60, 0x1e], "fcsel d0, d1, d0, gt"),
        ([0x6b, 0xdd, 0x60, 0x1e], "fcsel d11, d11, d0, le"),
        ([0xec, 0x0b, 0x61, 0x1e], "fmul d12, d31, d1"),
        ([0x41, 0x0c, 0x61, 0x1e], "fcsel d1, d2, d1, eq"),
        ([0x04, 0x14, 0x61, 0x1e], "fccmp d0, d1, 0x4, ne"),
        ([0xe1, 0x1b, 0x61, 0x1e], "fdiv d1, d31, d1"),
        ([0x00, 0x1c, 0x61, 0x1e], "fcsel d0, d0, d1, ne"),
        ([0xd0, 0x22, 0x61, 0x1e], "fcmpe d22, d1"),
        ([0x41, 0x2b, 0x61, 0x1e], "fadd d1, d26, d1"),
        ([0x00, 0x38, 0x61, 0x1e], "fsub d0, d0, d1"),
        ([0x81, 0x3b, 0x61, 0x1e], "fsub d1, d28, d1"),
        ([0x01, 0x4c, 0x61, 0x1e], "fcsel d1, d0, d1, mi"),
        ([0xef, 0x5d, 0x61, 0x1e], "fcsel d15, d15, d1, pl"),
        ([0x6c, 0x68, 0x61, 0x1e], "fmaxnm d12, d3, d1"),
        ([0x61, 0x78, 0x61, 0x1e], "fminnm d1, d3, d1"),
        ([0x06, 0x88, 0x61, 0x1e], "fnmul d6, d0, d1"),
        ([0x01, 0x9c, 0x61, 0x1e], "fcsel d1, d0, d1, ls"),
        ([0x02, 0xac, 0x61, 0x1e], "fcsel d2, d0, d1, ge"),
        ([0x84, 0xbc, 0x61, 0x1e], "fcsel d4, d4, d1, lt"),
        ([0x04, 0xc4, 0x61, 0x1e], "fccmp d0, d1, 0x4, gt"),
        ([0x11, 0xc4, 0x61, 0x1e], "fccmpe d0, d1, 0x1, gt"),
        ([0x50, 0xcc, 0x61, 0x1e], "fcsel d16, d2, d1, gt"),
        ([0x92, 0xcc, 0x61, 0x1e], "fcsel d18, d4, d1, gt"),
        ([0x00, 0xdc, 0x61, 0x1e], "fcsel d0, d0, d1, le"),
        ([0x20, 0x04, 0x62, 0x1e], "fccmp d1, d2, 0x0, eq"),
        ([0x00, 0x08, 0x62, 0x1e], "fmul d0, d0, d2"),
        ([0x8b, 0x09, 0x62, 0x1e], "fmul d11, d12, d2"),
        ([0x04, 0x14, 0x6a, 0x1e], "fccmp d0, d10, 0x4, ne"),
        ([0x72, 0x15, 0x6a, 0x1e], "fccmpe d11, d10, 0x2, ne"),
        ([0x00, 0x18, 0x6a, 0x1e], "fdiv d0, d0, d10"),
        ([0xf5, 0x5e, 0x75, 0x1e], "fcsel d21, d23, d21, pl"),
        ([0xa5, 0x68, 0x75, 0x1e], "fmaxnm d5, d5, d21"),
        ([0x42, 0x88, 0x75, 0x1e], "fnmul d2, d2, d21"),
        ([0x20, 0x06, 0x76, 0x1e], "fccmp d17, d22, 0x0, eq"),
        ([0x41, 0x18, 0x76, 0x1e], "fdiv d1, d2, d22"),
        ([0xa5, 0x18, 0x76, 0x1e], "fdiv d5, d5, d22"),
        ([0xf0, 0x22, 0x76, 0x1e], "fcmpe d23, d22"),
        ([0x00, 0x28, 0x76, 0x1e], "fadd d0, d0, d22"),
        ([0xf7, 0x39, 0x77, 0x1e], "fsub d23, d15, d23"),
        ([0x10, 0x3a, 0x77, 0x1e], "fsub d16, d16, d23"),
        ([0x01, 0x68, 0x77, 0x1e], "fmaxnm d1, d0, d23"),
        ([0x42, 0x88, 0x77, 0x1e], "fnmul d2, d2, d23"),
        ([0x00, 0x00, 0x78, 0x1e], "fcvtzs w0, d0"),
        ([0x85, 0x01, 0x78, 0x1e], "fcvtzs w5, d12"),
        ([0x00, 0x18, 0x7e, 0x1e], "fdiv d0, d0, d30"),
        ([0x42, 0x18, 0x7e, 0x1e], "fdiv d2, d2, d30"),
        ([0x84, 0x18, 0x7e, 0x1e], "fdiv d4, d4, d30"),
        ([0x52, 0x1a, 0x7e, 0x1e], "fdiv d18, d18, d30"),
        ([0xbd, 0x1b, 0x7e, 0x1e], "fdiv d29, d29, d30"),
        ([0x21, 0x28, 0x7e, 0x1e], "fadd d1, d1, d30"),
        ([0x63, 0x38, 0x7e, 0x1e], "fsub d3, d3, d30"),
        ([0x7c, 0x38, 0x7e, 0x1e], "fsub d28, d3, d30"),
        ([0xe7, 0x38, 0x7e, 0x1e], "fsub d7, d7, d30"),
        ([0x73, 0x3a, 0x7e, 0x1e], "fsub d19, d19, d30"),
        ([0x03, 0x08, 0x7f, 0x1e], "fmul d3, d0, d31"),
        ([0x23, 0x08, 0x7f, 0x1e], "fmul d3, d1, d31"),
        ([0x24, 0x08, 0x7f, 0x1e], "fmul d4, d1, d31"),
        ([0x29, 0x08, 0x7f, 0x1e], "fmul d9, d1, d31"),
        ([0x0c, 0xb2, 0x01, 0x1f], "fmsub s12, s16, s1, s12"),
        ([0x39, 0xe6, 0x74, 0x1f], "fnmsub d25, d17, d20, d25"),
        ([0x82, 0x0a, 0x75, 0x1f], "fnmadd d2, d20, d21, d2"),
        ([0xc6, 0xf4, 0x30, 0x4e], "fmax v6.4s, v6.4s, v16.4s"),
        ([0x64, 0xcc, 0x31, 0x4e], "fmla v4.4s, v3.4s, v17.4s"),
        ([0xc6, 0xd4, 0x3c, 0x4e], "fadd v6.4s, v6.4s, v28.4s"),
        ([0x82, 0xce, 0x3d, 0x4e], "fmla v2.4s, v20.4s, v29.4s"),
        ([0xdf, 0x7b, 0x61, 0x4e], "fcvtl2 v31.2d, v30.4s"),
        ([0x18, 0xf7, 0x79, 0x4e], "fmax v24.2d, v24.2d, v25.2d"),
        ([0xde, 0xd7, 0x7f, 0x4e], "fadd v30.2d, v30.2d, v31.2d"),
        ([0x21, 0xf8, 0xa0, 0x4e], "fabs v1.4s, v1.4s"),
        ([0x00, 0xd4, 0xa1, 0x4e], "fsub v0.4s, v0.4s, v1.4s"),
        ([0x65, 0xcc, 0xb0, 0x4e], "fmls v5.4s, v3.4s, v16.4s"),
        ([0x64, 0xcc, 0xb1, 0x4e], "fmls v4.4s, v3.4s, v17.4s"),
        ([0xff, 0xfb, 0xe0, 0x4e], "fabs v31.2d, v31.2d"),
        ([0x94, 0xd6, 0xe6, 0x4e], "fsub v20.2d, v20.2d, v6.2d"),
        ([0x30, 0xce, 0xf4, 0x4e], "fmls v16.2d, v17.2d, v20.2d"),
        ([0x4f, 0xce, 0xf4, 0x4e], "fmls v15.2d, v18.2d, v20.2d"),
        ([0x5a, 0x18, 0x88, 0x4f], "fmla v26.4s, v2.4s, v8.s[2]"),
        ([0x1d, 0x98, 0xaa, 0x4f], "fmul v29.4s, v0.4s, v10.s[3]"),
        ([0xfe, 0x18, 0xae, 0x4f], "fmla v30.4s, v7.4s, v14.s[3]"),
        ([0xfe, 0x50, 0xaf, 0x4f], "fmls v30.4s, v7.4s, v15.s[1]"),
        ([0x31, 0x50, 0xc8, 0x4f], "fmls v17.2d, v1.2d, v8.d[0]"),
        ([0xc7, 0x93, 0xcb, 0x4f], "fmul v7.2d, v30.2d, v11.d[0]"),
        ([0xb0, 0x18, 0xcc, 0x4f], "fmla v16.2d, v5.2d, v12.d[1]"),
        ([0xf7, 0x58, 0xcc, 0x4f], "fmls v23.2d, v7.2d, v12.d[1]"),
        ([0xa0, 0xb9, 0xa1, 0x5e], "fcvtzs s0, s13"),
        ([0x40, 0x10, 0x82, 0x5f], "fmla s0, s2, v2.s[0]"),
        ([0x84, 0x12, 0x8a, 0x5f], "fmla s4, s20, v10.s[0]"),
        ([0xa5, 0x12, 0x8a, 0x5f], "fmla s5, s21, v10.s[0]"),
        ([0x00, 0x13, 0x8a, 0x5f], "fmla s0, s24, v10.s[0]"),
        ([0x21, 0x13, 0x8a, 0x5f], "fmla s1, s25, v10.s[0]"),
        ([0x84, 0x13, 0x8a, 0x5f], "fmla s4, s28, v10.s[0]"),
        ([0xa5, 0x13, 0x8a, 0x5f], "fmla s5, s29, v10.s[0]"),
        ([0x00, 0x92, 0x8a, 0x5f], "fmul s0, s16, v10.s[0]"),
        ([0x84, 0x92, 0x8a, 0x5f], "fmul s4, s20, v10.s[0]"),
        ([0x00, 0x93, 0x8a, 0x5f], "fmul s0, s24, v10.s[0]"),
        ([0x84, 0x93, 0x8a, 0x5f], "fmul s4, s28, v10.s[0]"),
        ([0x01, 0x12, 0x8b, 0x5f], "fmla s1, s16, v11.s[0]"),
        ([0x85, 0x12, 0x8b, 0x5f], "fmla s5, s20, v11.s[0]"),
        ([0x01, 0x13, 0x8b, 0x5f], "fmla s1, s24, v11.s[0]"),
        ([0x85, 0x13, 0x8b, 0x5f], "fmla s5, s28, v11.s[0]"),
        ([0x20, 0x52, 0x8b, 0x5f], "fmls s0, s17, v11.s[0]"),
        ([0x20, 0x52, 0xb8, 0x5f], "fmls s0, s17, v24.s[1]"),
        ([0x40, 0x10, 0xc2, 0x5f], "fmla d0, d2, v2.d[0]"),
        ([0x03, 0x90, 0xc2, 0x5f], "fmul d3, d0, v2.d[0]"),
        ([0x20, 0x5a, 0xd8, 0x5f], "fmls d0, d17, v24.d[1]"),
        ([0x21, 0xdc, 0x60, 0x6e], "fmul v1.2d, v1.2d, v0.2d"),
        ([0x42, 0xdc, 0x60, 0x6e], "fmul v2.2d, v2.2d, v0.2d"),
        ([0x44, 0xdc, 0x60, 0x6e], "fmul v4.2d, v2.2d, v0.2d"),
        ([0x63, 0xdc, 0x60, 0x6e], "fmul v3.2d, v3.2d, v0.2d"),
        ([0x84, 0xdc, 0x60, 0x6e], "fmul v4.2d, v4.2d, v0.2d"),
        ([0x42, 0xdc, 0x61, 0x6e], "fmul v2.2d, v2.2d, v1.2d"),
        ([0x02, 0xdc, 0x62, 0x6e], "fmul v2.2d, v0.2d, v2.2d"),
        ([0x04, 0xdc, 0x62, 0x6e], "fmul v4.2d, v0.2d, v2.2d"),
        ([0x06, 0xdc, 0x62, 0x6e], "fmul v6.2d, v0.2d, v2.2d"),
        ([0x42, 0xd4, 0x63, 0x6e], "faddp v2.2d, v2.2d, v3.2d"),
        ([0x05, 0xdc, 0x63, 0x6e], "fmul v5.2d, v0.2d, v3.2d"),
        ([0x07, 0xdc, 0x63, 0x6e], "fmul v7.2d, v0.2d, v3.2d"),
        ([0x42, 0xdc, 0x63, 0x6e], "fmul v2.2d, v2.2d, v3.2d"),
        ([0x81, 0xd4, 0x64, 0x6e], "faddp v1.2d, v4.2d, v4.2d"),
        ([0x10, 0xdc, 0x64, 0x6e], "fmul v16.2d, v0.2d, v4.2d"),
        ([0x42, 0xdc, 0x64, 0x6e], "fmul v2.2d, v2.2d, v4.2d"),
        ([0x83, 0xd4, 0x65, 0x6e], "faddp v3.2d, v4.2d, v5.2d"),
        ([0x84, 0xd4, 0x65, 0x6e], "faddp v4.2d, v4.2d, v5.2d"),
        ([0x11, 0xdc, 0x65, 0x6e], "fmul v17.2d, v0.2d, v5.2d"),
        ([0x63, 0xdc, 0x65, 0x6e], "fmul v3.2d, v3.2d, v5.2d"),
        ([0x84, 0xdc, 0x65, 0x6e], "fmul v4.2d, v4.2d, v5.2d"),
        ([0xc6, 0xd4, 0x67, 0x6e], "faddp v6.2d, v6.2d, v7.2d"),
        ([0x10, 0xde, 0x68, 0x6e], "fmul v16.2d, v16.2d, v8.2d"),
        ([0x31, 0xde, 0x68, 0x6e], "fmul v17.2d, v17.2d, v8.2d"),
        ([0x52, 0xde, 0x68, 0x6e], "fmul v18.2d, v18.2d, v8.2d"),
        ([0x73, 0xde, 0x68, 0x6e], "fmul v19.2d, v19.2d, v8.2d"),
        ([0x94, 0xde, 0x68, 0x6e], "fmul v20.2d, v20.2d, v8.2d"),
        ([0xb5, 0xde, 0x68, 0x6e], "fmul v21.2d, v21.2d, v8.2d"),
        ([0xd6, 0xde, 0x68, 0x6e], "fmul v22.2d, v22.2d, v8.2d"),
        ([0xf7, 0xde, 0x68, 0x6e], "fmul v23.2d, v23.2d, v8.2d"),
        ([0x44, 0xdc, 0x70, 0x6e], "fmul v4.2d, v2.2d, v16.2d"),
        ([0x66, 0xdc, 0x70, 0x6e], "fmul v6.2d, v3.2d, v16.2d"),
        ([0x18, 0xde, 0x70, 0x6e], "fmul v24.2d, v16.2d, v16.2d"),
        ([0x54, 0xde, 0x70, 0x6e], "fmul v20.2d, v18.2d, v16.2d"),
        ([0x66, 0xde, 0x70, 0x6e], "fmul v6.2d, v19.2d, v16.2d"),
        ([0x04, 0xd6, 0x71, 0x6e], "faddp v4.2d, v16.2d, v17.2d"),
        ([0x10, 0xd6, 0x71, 0x6e], "faddp v16.2d, v16.2d, v17.2d"),
        ([0x45, 0xdc, 0x71, 0x6e], "fmul v5.2d, v2.2d, v17.2d"),
        ([0x66, 0xdc, 0x71, 0x6e], "fmul v6.2d, v3.2d, v17.2d"),
        ([0x39, 0xde, 0x71, 0x6e], "fmul v25.2d, v17.2d, v17.2d"),
        ([0x55, 0xde, 0x71, 0x6e], "fmul v21.2d, v18.2d, v17.2d"),
        ([0x66, 0xde, 0x71, 0x6e], "fmul v6.2d, v19.2d, v17.2d"),
        ([0x18, 0xf6, 0x71, 0x6e], "fmaxp v24.2d, v16.2d, v17.2d"),
        ([0x5a, 0xde, 0x72, 0x6e], "fmul v26.2d, v18.2d, v18.2d"),
        ([0x45, 0xd6, 0x73, 0x6e], "faddp v5.2d, v18.2d, v19.2d"),
        ([0x52, 0xd6, 0x73, 0x6e], "faddp v18.2d, v18.2d, v19.2d"),
        ([0x7b, 0xde, 0x73, 0x6e], "fmul v27.2d, v19.2d, v19.2d"),
        ([0x59, 0xf6, 0x73, 0x6e], "fmaxp v25.2d, v18.2d, v19.2d"),
        ([0x94, 0xd6, 0x75, 0x6e], "faddp v20.2d, v20.2d, v21.2d"),
        ([0x9a, 0xf6, 0x75, 0x6e], "fmaxp v26.2d, v20.2d, v21.2d"),
        ([0xd6, 0xd6, 0x77, 0x6e], "faddp v22.2d, v22.2d, v23.2d"),
        ([0xdb, 0xf6, 0x77, 0x6e], "fmaxp v27.2d, v22.2d, v23.2d"),
        ([0x18, 0xf7, 0x78, 0x6e], "fmaxp v24.2d, v24.2d, v24.2d"),
        ([0x18, 0xd7, 0x79, 0x6e], "faddp v24.2d, v24.2d, v25.2d"),
        ([0x18, 0xf7, 0x79, 0x6e], "fmaxp v24.2d, v24.2d, v25.2d"),
        ([0x18, 0xf7, 0x7a, 0x6e], "fmaxp v24.2d, v24.2d, v26.2d"),
        ([0x5a, 0xf7, 0x7b, 0x6e], "fmaxp v26.2d, v26.2d, v27.2d"),
        ([0x00, 0xd8, 0x30, 0x7e], "faddp s0, v0.2s"),
        ([0x21, 0xd8, 0x30, 0x7e], "faddp s1, v1.2s"),
        ([0x29, 0xd9, 0x30, 0x7e], "faddp s9, v9.2s"),
        ([0x4a, 0xd9, 0x30, 0x7e], "faddp s10, v10.2s"),
        ([0x00, 0xd8, 0x70, 0x7e], "faddp d0, v0.2d"),
        ([0x21, 0xd8, 0x70, 0x7e], "faddp d1, v1.2d"),
        ([0x29, 0xd9, 0x70, 0x7e], "faddp d9, v9.2d"),
        ([0x4a, 0xd9, 0x70, 0x7e], "faddp d10, v10.2d"),
        ([0x18, 0xdb, 0x70, 0x7e], "faddp d24, v24.2d"),
        ([0x00, 0xf8, 0x70, 0x7e], "fmaxp d0, v0.2d"),
        ([0x41, 0xf8, 0x70, 0x7e], "fmaxp d1, v2.2d"),
        ([0x20, 0xd4, 0xa0, 0x7e], "fabd s0, s1, s0"),
        ([0x21, 0xd4, 0xa0, 0x7e], "fabd s1, s1, s0"),
        ([0xd6, 0xd6, 0xf9, 0x7e], "fabd d22, d22, d25"),
        ([0x21, 0xd4, 0xfa, 0x7e], "fabd d1, d1, d26"),
        ([0x06, 0x00, 0x66, 0x9e], "fmov x6, d0"),
        ([0x11, 0x00, 0x66, 0x9e], "fmov x17, d0"),
        ([0x4b, 0x02, 0x67, 0x9e], "fmov d11, x18"),
        ([0xfc, 0x03, 0x67, 0x9e], "fmov d28, xzr"),
        ([0x06, 0x01, 0x78, 0x9e], "fcvtzs x6, d8"),
        ([0x42, 0xdc, 0x20, 0x2e], "fmul v2.2s, v2.2s, v0.2s"),
        ([0x44, 0xdc, 0x20, 0x2e], "fmul v4.2s, v2.2s, v0.2s"),
        ([0x42, 0xdc, 0x21, 0x2e], "fmul v2.2s, v2.2s, v1.2s"),
        ([0x02, 0xdc, 0x22, 0x2e], "fmul v2.2s, v0.2s, v2.2s"),
        ([0x04, 0xdc, 0x22, 0x2e], "fmul v4.2s, v0.2s, v2.2s"),
        ([0x05, 0xdc, 0x23, 0x2e], "fmul v5.2s, v0.2s, v3.2s"),
        ([0x81, 0xd4, 0x24, 0x2e], "faddp v1.2s, v4.2s, v4.2s"),
        ([0x00, 0xd4, 0x20, 0x6e], "faddp v0.4s, v0.4s, v0.4s"),
        ([0x21, 0xdc, 0x20, 0x6e], "fmul v1.4s, v1.4s, v0.4s"),
        ([0x42, 0xdc, 0x20, 0x6e], "fmul v2.4s, v2.4s, v0.4s"),
        ([0x21, 0xd4, 0x21, 0x6e], "faddp v1.4s, v1.4s, v1.4s"),
        ([0x04, 0xdc, 0x22, 0x6e], "fmul v4.4s, v0.4s, v2.4s"),
        ([0x06, 0xdc, 0x22, 0x6e], "fmul v6.4s, v0.4s, v2.4s"),
        ([0x42, 0xd4, 0x23, 0x6e], "faddp v2.4s, v2.4s, v3.4s"),
        ([0x05, 0xdc, 0x23, 0x6e], "fmul v5.4s, v0.4s, v3.4s"),
        ([0x07, 0xdc, 0x23, 0x6e], "fmul v7.4s, v0.4s, v3.4s"),
        ([0x10, 0xdc, 0x24, 0x6e], "fmul v16.4s, v0.4s, v4.4s"),
        ([0x83, 0xd4, 0x25, 0x6e], "faddp v3.4s, v4.4s, v5.4s"),
        ([0x84, 0xd4, 0x25, 0x6e], "faddp v4.4s, v4.4s, v5.4s"),
        ([0x11, 0xdc, 0x25, 0x6e], "fmul v17.4s, v0.4s, v5.4s"),
        ([0xc6, 0xd4, 0x27, 0x6e], "faddp v6.4s, v6.4s, v7.4s"),
        ([0x44, 0xdc, 0x30, 0x6e], "fmul v4.4s, v2.4s, v16.4s"),
        ([0x66, 0xdc, 0x30, 0x6e], "fmul v6.4s, v3.4s, v16.4s"),
        ([0x00, 0xf8, 0x30, 0x6e], "fmaxv s0, v0.4s"),
        ([0x21, 0xf8, 0x30, 0x6e], "fmaxv s1, v1.4s"),
        ([0x41, 0xf8, 0x30, 0x6e], "fmaxv s1, v2.4s"),
        ([0x10, 0xd6, 0x31, 0x6e], "faddp v16.4s, v16.4s, v17.4s"),
        ([0x45, 0xdc, 0x31, 0x6e], "fmul v5.4s, v2.4s, v17.4s"),
        ([0x66, 0xdc, 0x31, 0x6e], "fmul v6.4s, v3.4s, v17.4s"),
        ([0x52, 0xd6, 0x33, 0x6e], "faddp v18.4s, v18.4s, v19.4s"),
        ([0x94, 0xd6, 0x35, 0x6e], "faddp v20.4s, v20.4s, v21.4s"),
        ([0xd6, 0xd6, 0x37, 0x6e], "faddp v22.4s, v22.4s, v23.4s"),
        ([0x18, 0xd7, 0x39, 0x6e], "faddp v24.4s, v24.4s, v25.4s"),
        ([0xc7, 0x20, 0x06, 0x2e], "ext v7.8b, v6.8b, v6.8b, 0x4"),
        ([0x27, 0x1c, 0x20, 0x2e], "eor v7.8b, v1.8b, v0.8b"),
        ([0x22, 0x1c, 0x22, 0x2e], "eor v2.8b, v1.8b, v2.8b"),
        ([0x42, 0x1c, 0x32, 0x2e], "eor v2.8b, v2.8b, v18.8b"),
        ([0xc2, 0x1c, 0x70, 0x2e], "bsl v2.8b, v6.8b, v16.8b"),
        ([0xd2, 0x1d, 0xa1, 0x2e], "bit v18.8b, v14.8b, v1.8b"),
        ([0x01, 0x1c, 0xa6, 0x2e], "bit v1.8b, v0.8b, v6.8b"),
        ([0xa6, 0x1c, 0xe0, 0x2e], "bif v6.8b, v5.8b, v0.8b"),
        ([0x15, 0x1e, 0xf7, 0x2e], "bif v21.8b, v16.8b, v23.8b"),
        ([0x08, 0x85, 0xa0, 0x0e], "add v8.2s, v8.2s, v0.2s"),
        ([0x21, 0x1c, 0x21, 0x6e], "eor v1.16b, v1.16b, v1.16b"),
        ([0x42, 0x1c, 0x22, 0x6e], "eor v2.16b, v2.16b, v2.16b"),
        ([0x84, 0x1c, 0x24, 0x6e], "eor v4.16b, v4.16b, v4.16b"),
        ([0x10, 0x1e, 0x30, 0x6e], "eor v16.16b, v16.16b, v16.16b"),
        ([0x31, 0x1e, 0x31, 0x6e], "eor v17.16b, v17.16b, v17.16b"),
        ([0x73, 0x1e, 0x33, 0x6e], "eor v19.16b, v19.16b, v19.16b"),
        ([0xb5, 0x1e, 0x35, 0x6e], "eor v21.16b, v21.16b, v21.16b"),
        ([0xf7, 0x1e, 0x37, 0x6e], "eor v23.16b, v23.16b, v23.16b"),
        ([0x39, 0x1f, 0x39, 0x6e], "eor v25.16b, v25.16b, v25.16b"),
        ([0x7b, 0x1f, 0x3b, 0x6e], "eor v27.16b, v27.16b, v27.16b"),
        ([0xbd, 0x1f, 0x3d, 0x6e], "eor v29.16b, v29.16b, v29.16b"),
        ([0xff, 0x1f, 0x3f, 0x6e], "eor v31.16b, v31.16b, v31.16b"),
        ([0xa5, 0x40, 0x05, 0x6e], "ext v5.16b, v5.16b, v5.16b, 0x8"),
        ([0xc7, 0x40, 0x06, 0x6e], "ext v7.16b, v6.16b, v6.16b, 0x8"),
        ([0x02, 0x1d, 0x21, 0x0e], "and v2.8b, v8.8b, v1.8b"),
        ([0x21, 0x1c, 0x22, 0x0e], "and v1.8b, v1.8b, v2.8b"),
        ([0x21, 0x1c, 0x32, 0x0e], "and v1.8b, v1.8b, v18.8b"),
        ([0x08, 0x54, 0x22, 0x0f], "shl v8.2s, v0.2s, 0x2"),
        ([0xfe, 0x43, 0x60, 0x1e], "fmov d30, d31"),
        ([0x54, 0xc2, 0x20, 0x1e], "fabs s20, s18"),
        ([0xf7, 0xc3, 0x60, 0x1e], "fabs d23, d31"),
        ([0x23, 0x40, 0x21, 0x1e], "fneg s3, s1"),
        ([0x06, 0x40, 0x61, 0x1e], "fneg d6, d0"),
        ([0x00, 0xc0, 0x61, 0x1e], "fsqrt d0, d0"),
        ([0x02, 0xc2, 0x61, 0x1e], "fsqrt d2, d16"),
        ([0x08, 0x90, 0x26, 0x1e], "fmov s8, 20"),
        ([0x00, 0x10, 0x2e, 0x1e], "fmov s0, 1"),
        ([0x08, 0x90, 0x3b, 0x1e], "fmov s8, -0.4375"),
        ([0x01, 0x10, 0x3c, 0x1e], "fmov s1, -0.5"),
        ([0x00, 0x10, 0x3e, 0x1e], "fmov s0, -1"),
        ([0x13, 0x10, 0x3e, 0x1e], "fmov s19, -1"),
        ([0x14, 0x10, 0x60, 0x1e], "fmov d20, 2"),
        ([0x18, 0x10, 0x61, 0x1e], "fmov d24, 3"),
        ([0x13, 0x10, 0x7e, 0x1e], "fmov d19, -1"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_simd_movs() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x55, 0x04, 0x04, 0x4e], "dup v21.4s, v2.s[0]"),
        ([0x38, 0x07, 0x08, 0x4e], "dup v24.2d, v25.d[0]"),
        ([0x64, 0x64, 0x04, 0x6e], "mov v4.s[0], v3.s[3]"),
        ([0x67, 0x64, 0x04, 0x6e], "mov v7.s[0], v3.s[3]"),
        ([0x4b, 0x64, 0x14, 0x6e], "mov v11.s[2], v2.s[3]"),
        ([0x00, 0x04, 0x18, 0x6e], "mov v0.d[1], v0.d[0]"),
        ([0x21, 0x04, 0x18, 0x6e], "mov v1.d[1], v1.d[0]"),
        ([0x40, 0x04, 0x18, 0x6e], "mov v0.d[1], v2.d[0]"),
        ([0x41, 0x04, 0x18, 0x6e], "mov v1.d[1], v2.d[0]"),
        ([0x42, 0x04, 0x18, 0x6e], "mov v2.d[1], v2.d[0]"),
        ([0x48, 0x04, 0x18, 0x6e], "mov v8.d[1], v2.d[0]"),
        ([0x50, 0x04, 0x18, 0x6e], "mov v16.d[1], v2.d[0]"),
        ([0x63, 0x04, 0x18, 0x6e], "mov v3.d[1], v3.d[0]"),
        ([0x6b, 0x44, 0x18, 0x6e], "mov v11.d[1], v3.d[1]"),
        ([0xff, 0x45, 0x18, 0x6e], "mov v31.d[1], v15.d[1]"),
        ([0x5a, 0x46, 0x18, 0x6e], "mov v26.d[1], v18.d[1]"),
        ([0x00, 0x04, 0x1c, 0x6e], "mov v0.s[3], v0.s[0]"),
        ([0x21, 0x04, 0x1c, 0x6e], "mov v1.s[3], v1.s[0]"),
        ([0x68, 0x04, 0x1c, 0x6e], "mov v8.s[3], v3.s[0]"),
        ([0x69, 0x24, 0x1c, 0x6e], "mov v9.s[3], v3.s[1]"),
        ([0x6a, 0x44, 0x1c, 0x6e], "mov v10.s[3], v3.s[2]"),
        ([0x6b, 0x64, 0x1c, 0x6e], "mov v11.s[3], v3.s[3]"),
        ([0x43, 0x1c, 0xa2, 0x4e], "mov v3.16b, v2.16b"),
        ([0x1c, 0x04, 0x00, 0x0f], "movi v28.2s, 0x0"),
        ([0x28, 0x04, 0x00, 0x0f], "movi v8.2s, 0x1"),
        ([0x80, 0x66, 0x01, 0x0f], "movi v0.2s, 0x34, lsl 24"),
        ([0x17, 0x64, 0x04, 0x0f], "movi v23.2s, 0x80, lsl 24"),
        ([0x01, 0xe4, 0x00, 0x6f], "movi v1.2d, 0x0"),
        ([0x02, 0xe4, 0x00, 0x6f], "movi v2.2d, 0x0"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}

#[test]
fn test_openblas_misc_ops() {
    const TESTS: &[([u8; 4], &'static str)] = &[
        ([0x1f, 0x20, 0x03, 0xd5], "nop"),
        ([0xbf, 0x3a, 0x03, 0xd5], "dmb ishst"),
        ([0xbf, 0x3b, 0x03, 0xd5], "dmb ish"),
        ([0xdf, 0x3f, 0x03, 0xd5], "isb"),
        ([0x01, 0x00, 0x38, 0xd5], "mrs x1, midr_el1"),
        ([0x54, 0xd0, 0x3b, 0xd5], "mrs x20, tpidr_el0"),
        ([0x41, 0xe0, 0x3b, 0xd5], "mrs x1, cntvct_el0"),
        ([0x55, 0xe0, 0x3b, 0xd5], "mrs x21, cntvct_el0"),
        ([0xe2, 0x69, 0xb6, 0xf8], "prfm pldl2keep, [x15, x22]"),
        ([0x00, 0x6a, 0xb7, 0xf8], "prfm pldl1keep, [x16, x23]"),
        ([0x80, 0x00, 0x80, 0xf9], "prfm pldl1keep, [x4]"),
        ([0x81, 0x00, 0x80, 0xf9], "prfm pldl1strm, [x4]"),
        ([0x00, 0x02, 0x80, 0xf9], "prfm pldl1keep, [x16]"),
        ([0x21, 0x20, 0x80, 0xf9], "prfm pldl1strm, [x1, 0x40]"),
        ([0x00, 0x22, 0x80, 0xf9], "prfm pldl1keep, [x16, 0x40]"),
        ([0x61, 0x30, 0x80, 0xf9], "prfm pldl1strm, [x3, 0x60]"),
        ([0xa2, 0x51, 0x80, 0xf9], "prfm pldl2keep, [x13, 0xa0]"),
        ([0xc2, 0x51, 0x80, 0xf9], "prfm pldl2keep, [x14, 0xa0]"),
        ([0xe2, 0x51, 0x80, 0xf9], "prfm pldl2keep, [x15, 0xa0]"),
        ([0xa1, 0x00, 0x82, 0xf9], "prfm pldl1strm, [x5, 0x400]"),
        ([0x00, 0x82, 0x87, 0xf9], "prfm pldl1keep, [x16, 0xf00]"),
    ];

    let errs = run_tests(TESTS);

    for err in errs.iter() {
        println!("{}", err);
    }

    assert!(errs.is_empty());
}