summaryrefslogtreecommitdiff
path: root/tests/from_brain.rs
blob: 78122475f361976f43f901916e8fd299d4bf0a5b (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
use yaxpeax_arch::Decoder;
use yaxpeax_arch::StandardDecodeError as DecodeError;

// these instructions are just what i think the manual says

#[track_caller]
fn test_display(bytes: &[u8], text: &str) {
    let decoder = yaxpeax_hexagon::InstDecoder::default();
    let inst = decoder.decode(&mut yaxpeax_arch::U8Reader::new(bytes)).expect("decode succeeds");
    let rendered = format!("{}", inst);
    assert_eq!(rendered, text);
}

#[track_caller]
fn test_invalid(bytes: &[u8], expected: DecodeError) {
    let decoder = yaxpeax_hexagon::InstDecoder::default();
    let err = decoder.decode(&mut yaxpeax_arch::U8Reader::new(bytes)).unwrap_err();
    assert_eq!(err, expected);
}

// mix of seen-in-the-wild extenders and stuff i made up
#[test]
fn extenders() {
    /*
     * extendable instructions covered in this test:
     *        // it turns out these are encoded by applying an extender to the `mem{b,ub,...}(gp+#u16)` forms
     * [x]:   Rd = mem{b,ub,h,uh,w,d}(##U32)
     *        // predicated loads
     * [x]:   if ([!]Pt[.new]) Rd = mem{b,ub,h,uh,w,d} (Rs + ##U32)
     * [x]:   Rd = mem{b,ub,h,uh,w,d} (Rs + ##U32)
     * [x]:   Rd = mem{b,ub,h,uh,w,d} (Re=##U32)
     * [x]:   Rd = mem{b,ub,h,uh,w,d} (Rt<<#u2 + ##U32)
     * [x]:   if ([!]Pt[.new]) Rd = mem{b,ub,h,uh,w,d} (##U32)
     *        // it turns out these are encoded by applying an extender to the `mem{b,ub,...}(gp+#u16)` forms
     * [x]:   mem{b,h,w,d}(##U32) = Rs[.new]
     *        // predicated stores
     * [x]:   if ([!]Pt[.new]) mem{b,h,w,d}(Rs + ##U32) = Rt[.new]
     * [x]:   mem{b,h,w,d}(Rs + ##U32) = Rt[.new]
     * [x]:   mem{b,h,w,d}(Rd=##U32) = Rt[.new]
     * [x]:   mem{b,h,w,d}(Ru<<#u2 + ##U32) = Rt[.new]
     * [x]:   if ([!]Pt[.new]) mem{b,h,w,d}(##U32) = Rt[.new]
     * [x]:   [if [!]Ps] memw(Rs + #u6) = ##U32 // constant store
     * // this just does not exist?!
     * [!]:   memw(Rs + Rt<<#u2) = ##U32 // constant store
     * [x]:   if (cmp.xx(Rs.new,##U32)) jump:hint target
     * [x]:   Rd = ##u32
     * [x]:   Rdd = combine(Rs,##u32)
     * [x]:   Rdd = combine(##u32,Rs)
     * [x]:   Rdd = combine(##u32,#s8)
     * [x]:   Rdd = combine(#s8,##u32)
     * [x]:   Rd = mux(Pu, Rs,##u32)
     * [x]:   Rd = mux(Pu, ##u32, Rs)
     * [x]:   Rd = mux(Pu,##u32,#s8)
     * [x]:   if ([!]Pu[.new]) Rd = add(Rs,##u32)
     * [x]:   if ([!]Pu[.new]) Rd = ##u32
     * [x]:   Pd = [!]cmp.eq (Rs,##u32)
     * [x]:   Pd = [!]cmp.gt (Rs,##u32)
     * [x]:   Pd = [!]cmp.gtu (Rs,##u32)
     * [x]:   Rd = and(Rs,##u32)
     * [x]:   Rd = or(Rs,##u32)
     * [x]:   Rd = sub(##u32,Rs)
     * [x]:   Rd = add(Rs,##s32)
     * // this does not exist...
     * [!]:   Rd = mpyi(Rs,##u32)
     * [x]:   Rd += mpyi(Rs,##u32)
     * [x]:   Rd -= mpyi(Rs,##u32)
     * [x]:   Rx += add(Rs,##u32)
     * [x]:   Rx -= add(Rs,##u32)
     * [x]:   Rd = ##u32
     * [x]:   Rd = add(Rs,##s32)
     * [x]:   jump (PC + ##s32)
     * [x]:   call (PC + ##s32)
     * [x]:   if ([!]Pu) call (PC + ##s32)
     * [x]:   Pd = spNloop0(PC+##s32,Rs/#U10)
     * [x]:   loop0/1 (PC+##s32,#Rs/#U10)
     * [x]:   Rd = add(pc,##s32)
     * [x]:   Rd = add(##u32,mpyi(Rs,#u6))
     * [x]:   Rd = add(##u32,mpyi(Rs,Rt))
     * [x]:   Rd = add(Rs,add(Rt,##u32))
     * [x]:   Rd = add(Rs,sub(##u32,Rt))
     * // doesn't exist?
     * [!]:   Rd = sub(##u32,add(Rs,Rt))
     * [x]:   Rd = or(Rs,and(Rt,##u32))
     * [x]:   Rx = add/sub/and/or (##u32,asl/asr/lsr(Rx,#U5))
     * // neither of these exist?
     * [!]:   Rx = add/sub/and/or (##u32,asl/asr/lsr(Rs,Rx))
     * [!]:   Rx = add/sub/and/or (##u32,asl/asr/lsr(Rx,Rs))
     * [ ]:   Pd = cmpb/h.{eq,gt,gtu} (Rs,##u32)
     */

    // HELP! not sure how extenders combined with shifted constants should work.
    // for example: `Rdd=memd(gp+#u16:3)` can be extended. if u16 is `0...1111`, where the low
    // three bits are all set, the address used for gp-relative addressing would be `1111000`. as
    // an extended constant, would this also be `1111000` and illegal for extension as bits other
    // than the low six are set? or is this `000111` with an unaligned address but otherwise
    // extended and legal for execution?
    //
    // i am going to assume that the shifted immediate is used.
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x00, 0x48,
    ], "{ memb(##0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x40, 0x48,
    ], "{ memh(##0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x80, 0x48,
    ], "{ memw(##0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0xa0, 0x48,
    ], "{ memb(##0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xce, 0xa0, 0x48,
    ], "{ memh(##0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xd6, 0xa0, 0x48,
    ], "{ memw(##0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x07, 0xc6, 0xc0, 0x48,
    ], "{ memd(##0x207) = r7:6 }");


    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x00, 0x49,
    ], "{ r6 = memb(##0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x20, 0x49,
    ], "{ r6 = memub(##0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x40, 0x49,
    ], "{ r6 = memh(##0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x60, 0x49,
    ], "{ r6 = memuh(##0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x80, 0x49,
    ], "{ r6 = memw(##0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc0, 0xc0, 0x49,
    ], "{ r7:6 = memd(##0x207) }");


    // HELP! it is somewhat unfortunate that extended offsets don't get the ## treatment like
    // immediates. having different operands for all immediate-extended forms seems like a kind of
    // bad idea though.
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x05, 0x91,
    ], "{ r6 = memb(r5+#527) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x25, 0x91,
    ], "{ r6 = memub(r5+#527) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x45, 0x91,
    ], "{ r6 = memh(r5+#527) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x65, 0x91,
    ], "{ r6 = memuh(r5+#527) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x85, 0x91,
    ], "{ r6 = memw(r5+#527) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc0, 0xc5, 0x91,
    ], "{ r7:6 = memd(r5+#519) }");


    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x05, 0x9b,
    ], "{ r6 = memb(r5=#0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x25, 0x9b,
    ], "{ r6 = memub(r5=#0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x45, 0x9b,
    ], "{ r6 = memh(r5=#0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x65, 0x9b,
    ], "{ r6 = memuh(r5=#0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x85, 0x9b,
    ], "{ r6 = memw(r5=#0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0xc5, 0x9b,
    ], "{ r7:6 = memd(r5=#0x20f) }");


    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x04, 0xa1,
    ], "{ memb(r4+#527) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x44, 0xa1,
    ], "{ memh(r4+#527) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x84, 0xa1,
    ], "{ memw(r4+#527) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0xa4, 0xa1,
    ], "{ memb(r4+#527) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xce, 0xa4, 0xa1,
    ], "{ memh(r4+#527) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xd6, 0xa4, 0xa1,
    ], "{ memw(r4+#527) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x07, 0xc6, 0xc4, 0xa1,
    ], "{ memd(r4+#519) = r7:6 }");


    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x8f, 0xc6, 0x04, 0xab,
    ], "{ memb(r4=#0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x8f, 0xc6, 0x44, 0xab,
    ], "{ memh(r4=#0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x8f, 0xc6, 0x84, 0xab,
    ], "{ memw(r4=#0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x8f, 0xc6, 0xa4, 0xab,
    ], "{ memb(r4=#0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x8f, 0xce, 0xa4, 0xab,
    ], "{ memh(r4=#0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x8f, 0xd6, 0xa4, 0xab,
    ], "{ memw(r4=#0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x87, 0xc6, 0xc4, 0xab,
    ], "{ memd(r4=#0x207) = r7:6 }");


    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x05, 0x9d,
    ], "{ r6 = memb(r5<<1 + 0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x25, 0x9d,
    ], "{ r6 = memub(r5<<1 + 0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x45, 0x9d,
    ], "{ r6 = memh(r5<<1 + 0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x65, 0x9d,
    ], "{ r6 = memuh(r5<<1 + 0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0x85, 0x9d,
    ], "{ r6 = memw(r5<<1 + 0x20f) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xd3, 0xc5, 0x9d,
    ], "{ r7:6 = memd(r5<<1 + 0x20f) }");


    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xcf, 0xc6, 0x04, 0xad,
    ], "{ memb(r4<<1 + 0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xcf, 0xc6, 0x44, 0xad,
    ], "{ memh(r4<<1 + 0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xcf, 0xc6, 0x84, 0xad,
    ], "{ memw(r4<<1 + 0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xcf, 0xc6, 0xa4, 0xad,
    ], "{ memb(r4<<1 + 0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xcf, 0xce, 0xa4, 0xad,
    ], "{ memh(r4<<1 + 0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xcf, 0xd6, 0xa4, 0xad,
    ], "{ memw(r4<<1 + 0x20f) = r6.new }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xc7, 0xc6, 0xc4, 0xad,
    ], "{ memd(r4<<1 + 0x207) = r7:6 }");

    // not writing out permutations for all predicated instructions come on now
    // if ([!]Pt[.new]) Rd = mem{b,ub,h,uh,w,d} (Rs + ##U32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xa8, 0xf0, 0x6a, 0x47,
    ], "{ if (!p2.new) r8 = memuh(r10+#517) }");
    // if ([!]Pt[.new]) Rd = mem{b,ub,h,uh,w,d} (##U32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x90, 0xf5, 0x62, 0x9f,
    ], "{ if (p2.new) r16 = memuh(##0x205) }");
    // if ([!]Pt[.new]) mem{b,h,w,d}(Rs + ##U32) = Rt[.new]
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x2a, 0xc7, 0x4a, 0x40,
    ], "{ if (p2) memh(r10+#517) = r7 }");
    // if ([!]Pt[.new]) mem{b,h,w,d}(##U32) = Rt[.new]
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xc9, 0xe6, 0x80, 0xaf,
    ], "{ if (p1.new) memw(#0x209) = r6 }");
    // [if [!]Ps] memw(Rs + #u6) = ##U32 // constant store
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xbf, 0xe2, 0x84, 0x38,
    ], "{ if (!p1) memb(r4+#5) = #575 }");
    // if (cmp.xx(Rs.new,##U32)) jump:hint target
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xe3, 0xd4, 0x24,
    ], "{ if (!cmp.gt(r4.new, ##0x203)) jump:t $+0x32c }");

    test_display(&[
        0x02, 0x40, 0x00, 0x00,
        0x01, 0xd6, 0x49, 0x6a,
    ], "{ r1 = add(pc, ##0xac) }");

    test_display(&[
        0x0c, 0x42, 0xf8, 0x03,
        0x17, 0xc2, 0x19, 0xb0,
    ], "{ r23 = add(r25, ##0x3f808310) }");

    //    Rdd = combine(##u32,#s8)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf0, 0xe0, 0x40, 0x7c,
    ], "{ r17:16 = combine(##0x207, #-127) }");

    //    Rdd = combine(#s8,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf0, 0xc0, 0x84, 0x7c,
    ], "{ r17:16 = combine(#7, ##0x208) }");

    //    Rd = mux(Pu, Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf0, 0xc0, 0x26, 0x73,
    ], "{ r16 = mux(p1, r6, ##0x207) }");
    //    Rd = mux(Pu, ##u32, Rs)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf0, 0xc0, 0xa6, 0x73,
    ], "{ r16 = mux(p1, ##0x207, r6) }");
    //    Rd = mux(Pu,##u32,#s8)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf1, 0xe0, 0xa7, 0x7a,
    ], "{ r17 = mux(p1, ##0x207, #79) }");

    //    if ([!]Pu[.new]) Rd = add(Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf0, 0xe0, 0xc6, 0x74,
    ], "{ if (!p2.new) r16 = add(r6, ##0x207) }");

    //    if ([!]Pu[.new]) Rd = ##u32
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf0, 0xe0, 0xc0, 0x7e,
    ], "{ if (!p2.new) r16 = ##0x207 }");

    //    Pd = [!]cmp.eq (Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf1, 0xc0, 0x06, 0x75,
    ], "{ p1 = !cmp.eq(r6, ##0x207) }");
    //    Pd = [!]cmp.gt (Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf1, 0xc0, 0x46, 0x75,
    ], "{ p1 = !cmp.gt(r6, ##0x207) }");
    //    Pd = [!]cmp.gtu (Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xf1, 0xc0, 0x86, 0x75,
    ], "{ p1 = !cmp.gtu(r6, ##0x207) }");

    //    Rd = mpyi(Rs,##u32)

    //    Rd += mpyi(Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xc6, 0x14, 0xe1,
    ], "{ r22 += mpyi(r20, ##0x234) }");
    //    Rd -= mpyi(Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xc6, 0x94, 0xe1,
    ], "{ r22 -= mpyi(r20, ##0x234) }");
    //    Rx += add(Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xc6, 0x14, 0xe2,
    ], "{ r22 += add(r20, ##0x234) }");
    //    Rx -= add(Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xc6, 0x94, 0xe2,
    ], "{ r22 -= add(r20, ##0x234) }");
    //    Rd = add(Rs,##s32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x02, 0xc0, 0x00, 0x58,
    ], "{ jump $+0x201 }");
    //    jump (PC + ##s32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x02, 0xc0, 0x00, 0x5a,
    ], "{ call $+0x201 }");
    //    call (PC + ##s32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x02, 0xc1, 0x00, 0x5c,
    ], "{ if (p1) jump:nt $+0x201 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x02, 0xc9, 0x20, 0x5c,
    ], "{ if (!p1.new) jump:nt $+0x201 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x02, 0xc1, 0x20, 0x5d,
    ], "{ if (!p1) call $+0x201 }");
    //    if ([!]Pu) call (PC + ##s32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x08, 0xc2, 0xa6, 0x60,
    ], "{ p3 = sp1loop0($+0x224, r6) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x08, 0xc2, 0xc6, 0x60,
    ], "{ p3 = sp2loop0($+0x224, r6) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x08, 0xc2, 0xe6, 0x60,
    ], "{ p3 = sp3loop0($+0x224, r6) }");
    //    Pd = spNloop0(PC+##s32,Rs/#U10)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x08, 0xc2, 0x06, 0x60,
    ], "{ loop0($+0x224, r6) }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x08, 0xc2, 0x26, 0x60,
    ], "{ loop1($+0x224, r6) }");
    //    loop0/1 (PC+##s32,#Rs/#U10)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xe6, 0xd4, 0xd8,
    ], "{ r6 = add(##0x22c, mpyi(r20, #0x36)) }");
    //    Rd = add(##u32,mpyi(Rs,#u6))
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xe6, 0x54, 0xd7,
    ], "{ r22 = add(##0x22c, mpyi(r20, r6)) }");
    //    Rd = add(##u32,mpyi(Rs,Rt))
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xe6, 0x34, 0xdb,
    ], "{ r6 = add(r20, add(r22, ##0x21c)) }");
    //    Rd = add(Rs,add(Rt,##u32))
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xe6, 0xb4, 0xdb,
    ], "{ r6 = add(r20, sub(##0x21c, r22)) }");
    //    Rd = add(Rs,sub(##u32,Rt))

    //    Rd = sub(##u32,add(Rs,Rt))

    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x96, 0xc3, 0x54, 0xda,
    ], "{ r20 = or(r22, and(r20, ##0x21c)) }");
    //    Rd = or(Rs,and(Rt,##u32))
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x84, 0xe6, 0x14, 0xde,
    ], "{ r20 = add(##0x218, asl(r20, #0x6)) }");
    //    Rx = add/sub/and/or (##u32,asl/asr/lsr(Rx,#U5))

    // neither of these exist?
    //    Rx = add/sub/and/or (##u32,asl/asr/lsr(Rs,Rx))
    //    Rx = add/sub/and/or (##u32,asl/asr/lsr(Rx,Rs))

    //    Pd = cmpb/h.{eq,gt,gtu} (Rs,##u32)
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x87, 0xe6, 0x14, 0xdd,
    ], "{ p3 = cmpb.gt(r20, ##0x234) }");

    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0x0f, 0xc6, 0x00, 0x48,
    ], "{ memb(##0x20f) = r6 }");
    test_display(&[
        0x08, 0x40, 0x00, 0x00,
        0xe6, 0xc1, 0x00, 0x49,
    ], "{ r6 = memb(##0x20f) }");

    test_display(&[
        0x0f, 0x40, 0x92, 0x6e, // r15 = syscfg
        0x04, 0x40, 0xe1, 0x0f, // extender
        0xf1, 0xc0, 0x00, 0x78, // r17 = #whatever
    ], "{ r15 = syscfg; r17 = ##0xfe100107 }");

    // the fact that something generated this packet is a little hilarious
    test_display(&[
        0x00, 0x40, 0x00, 0x00, // extender (0)
        0xf1, 0xc1, 0x91, 0x76, // r17 = or(r17, #whatever)
    ], "{ r17 = or(r17, ##0xf) }");

    test_display(&[
        0x04, 0x40, 0x00, 0x00, // extender (4 == 0x100)
        0xf1, 0xc1, 0x91, 0x76, // r17 = or(r17, #whatever)
    ], "{ r17 = or(r17, ##0x10f) }");

    test_display(&[
        0x04, 0x40, 0x00, 0x00, // extender (4 == 0x100)
        0xf1, 0xc1, 0x51, 0x76, // r17 = sub(#whatever, r17)
    ], "{ r17 = sub(##0x10f, r17) }");

    test_display(&[
        0x04, 0x40, 0x00, 0x00, // extender (4 == 0x100)
        0xf1, 0xc1, 0x11, 0x76, // r17 = and(r17, #whatever)
    ], "{ r17 = and(r17, ##0x10f) }");

    // great, this instruction is from a real program and proves that interpreting the offset as
    // shifted by 2 before adding the extender is an error. bonkers stuff.
    test_display(&[
        0xa8, 0x46, 0xe1, 0x01,
        0x20, 0xc0, 0x99, 0xa1,
    ], "{ memw(r25+#504474144) = r0 }");
}

// mentioned in the V62 manual, not later?
// not sure if these are still what they seem in later versions, but until demonstrated
// otherwise...
#[test]
fn supervisor() {
    test_invalid(&0b0101_010_1100_00010_11_0_01000_000_00110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0101_010_1101_00010_11_0_01000_000_00110u32.to_le_bytes(), "{ r6 = icdatar(r2) }");
    test_display(&0b0101_010_1110_00010_11_0_01000_000_00110u32.to_le_bytes(), "{ ictagw(r2, r8) }");
    test_display(&0b0101_010_1111_00010_11_0_01000_000_00110u32.to_le_bytes(), "{ r6 = ictagr(r2) }");
    test_display(&0b0101_011_0110_00010_11_0_10000_000_00110u32.to_le_bytes(), "{ ickill }");
    test_display(&0b0101_011_0111_00010_11_0_01000_000_00110u32.to_le_bytes(), "{ icinvidx(r2) }");

    test_display(&0b0110_01_00000_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ swi(r6) }");
    test_display(&0b0110_01_00000_00110_11_0_00010_001_10110u32.to_le_bytes(), "{ cswi(r6) }");
    test_display(&0b0110_01_00000_00110_11_0_00010_011_10110u32.to_le_bytes(), "{ ciad(r6) }");
    test_display(&0b0110_01_00010_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ wait(r6) }");
    test_display(&0b0110_01_00010_00110_11_0_00010_010_10110u32.to_le_bytes(), "{ resume(r6) }");
    test_display(&0b0110_01_00011_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ stop(r6) }");
    test_display(&0b0110_01_00011_00110_11_0_00010_001_10110u32.to_le_bytes(), "{ start(r6) }");
    test_display(&0b0110_01_00011_00110_11_0_00010_010_10110u32.to_le_bytes(), "{ nmi(r6) }");
    test_display(&0b0110_01_00100_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ setimask(p2, r6) }");
    test_display(&0b0110_01_00100_00110_11_0_00010_011_10110u32.to_le_bytes(), "{ siad(r6) }");
    test_display(&0b0110_01_01000_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ crswap(r6, sgp0) }");
    test_display(&0b0110_01_01001_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ crswap(r6, sgp1) }");
    test_display(&0b0110_01_10000_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ r22 = getimask(r6) }");
    test_display(&0b0110_11_00001_00110_11_0_00010_000_10110u32.to_le_bytes(), "{ brkpt }");
    test_display(&0b0110_11_00001_00110_11_0_00010_001_00000u32.to_le_bytes(), "{ tlblock }");
    test_display(&0b0110_11_00001_00110_11_0_00010_011_00000u32.to_le_bytes(), "{ k0lock }");
    test_display(&0b0110_11_01100_00110_11_0_00010_000_00000u32.to_le_bytes(), "{ crswap(r7:6, sgp1:0) }");
    test_invalid(&0b0110_11_01100_00110_11_0_00010_000_00001u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_display(&0b0110_11_10011_00110_11_0_00010_011_10110u32.to_le_bytes(), "{ r22 = iassignr(r6) }");

    // ok
    test_display(&0b0110_0111000_00010_11_0011010_0000110u32.to_le_bytes(), "{ ssr = r2 }");
    test_display(&0b0110_1101000_00010_11_0011010_0000110u32.to_le_bytes(), "{ s7:6 = r3:2 }");

    test_display(&0b0110_11101_0100010_11_000000000_00110u32.to_le_bytes(), "{ r6 = isdbcfg1 }");
    test_display(&0b0110_11110_0100010_11_000000000_00110u32.to_le_bytes(), "{ r7:6 = s35:34 }");

    test_display(&0b0110_1100000_00010_11_0_01101_00000000u32.to_le_bytes(), "{ tlbw(r3:2, r13) }");
    test_invalid(&0b0110_1100000_00010_11_1_01101_00000000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0110_1100010_00010_11_0_00000000_01000u32.to_le_bytes(), "{ r9:8 = tlbr(r2) }");
    test_display(&0b0110_1100100_00010_11_0_00000000_01000u32.to_le_bytes(), "{ r8 = tlbp(r2) }");

    test_display(&0b0110_1100101_00010_11_0_00000000_01000u32.to_le_bytes(), "{ tlbinvasid(r2) }");
    test_display(&0b0110_1100110_00010_11_0_01001000_01000u32.to_le_bytes(), "{ r8 = ctlbw(r3:2, r9) }");
    test_invalid(&0b0110_1100110_00010_11_1_00000000_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0110_1100111_00010_11_0_00000000_01000u32.to_le_bytes(), "{ r8 = tlboc(r3:2) }");
}

// tests grouped by prefix. not very principled but it's something.

#[test]
fn inst_0001() {
    test_display(&0b0001_0110000_01001_11_00_0111_000_00100u32.to_le_bytes(), "{ r17 = #7; jump $+0x8 }");
    test_display(&0b0001_0111000_01001_11_00_0111_000_00100u32.to_le_bytes(), "{ r7 = r17; jump $+0x8 }");

    test_display(&0b0001_0011011_11001_11_00_0011_000_00010u32.to_le_bytes(), "{ p1 = cmp.gtu(r17, #3); if (!p1.new) jump:nt $-0x1fc }");
    test_display(&0b0001_0011101_11001_11_00_0011_000_00010u32.to_le_bytes(), "{ p1 = tstbit(r17, #0x0); if (p1.new) jump:nt $-0x1fc }");
    test_display(&0b0001_0011111_11001_11_00_0011_000_00010u32.to_le_bytes(), "{ p1 = tstbit(r17, #0x0); if (!p1.new) jump:nt $-0x1fc }");
    test_display(&0b0001_0011111_11001_11_10_0011_000_00010u32.to_le_bytes(), "{ p1 = tstbit(r17, #0x0); if (!p1.new) jump:t $-0x1fc }");

    test_display(&0b0001_0101011_11001_11_10_0111_000_00010u32.to_le_bytes(), "{ p0 = cmp.gtu(r17, r7); if (!p0.new) jump:t $-0x1fc }");
    test_display(&0b0001_0101011_11001_11_11_0111_000_00010u32.to_le_bytes(), "{ p1 = cmp.gtu(r17, r7); if (!p1.new) jump:t $-0x1fc }");
}

#[test]
fn inst_0010() {
    test_display(&0b0010_00000001_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (cmp.eq(r4.new, r2)) jump:nt $+0x32c }");
    test_display(&0b0010_00000001_0100_11_1_00010_100_10110u32.to_le_bytes(), "{ if (cmp.eq(r4.new, r2)) jump:t $+0x32c }");
    test_display(&0b0010_00000101_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (!cmp.eq(r4.new, r2)) jump:nt $+0x32c }");
    test_display(&0b0010_00001001_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (cmp.gt(r4.new, r2)) jump:nt $+0x32c }");
    test_display(&0b0010_00001101_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (!cmp.gt(r4.new, r2)) jump:nt $+0x32c }");
    test_display(&0b0010_00010001_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (cmp.gtu(r4.new, r2)) jump:nt $+0x32c }");
    test_display(&0b0010_00010101_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (!cmp.gtu(r4.new, r2)) jump:nt $+0x32c }");
    test_display(&0b0010_00011001_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (cmp.gt(r2, r4.new)) jump:nt $+0x32c }");
    test_display(&0b0010_00100101_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (!cmp.gtu(r2, r4.new)) jump:nt $+0x32c }");
    test_invalid(&0b0010_00101101_0100_11_0_00010_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0010_00110101_0100_11_0_00010_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0010_00111101_0100_11_0_00010_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0010_01000001_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (cmp.eq(r4.new, #2)) jump:nt $+0x32c }");
    test_display(&0b0010_01010101_0100_11_1_00010_100_10110u32.to_le_bytes(), "{ if (!cmp.gtu(r4.new, #2)) jump:t $+0x32c }");
    test_display(&0b0010_01011001_0100_11_0_00010_100_10110u32.to_le_bytes(), "{ if (tstbit(r4.new, #0)) jump:nt $+0x32c }");
    test_display(&0b0010_01011101_0100_11_1_00010_100_10110u32.to_le_bytes(), "{ if (!tstbit(r4.new, #0)) jump:t $+0x32c }");
    test_display(&0b0010_01101101_0100_11_1_00010_100_10110u32.to_le_bytes(), "{ if (!cmp.gt(r4.new, #-1)) jump:t $+0x32c }");
}

#[test]
fn inst_0011() {
    test_display(&0b0011_0010110_00100_11_1_0_0010_101_10000u32.to_le_bytes(), "{ if (p1.new) r17:16 = memd(r4 + r2<<3) }");
    test_display(&0b0011_0010110_00100_11_1_0_0010_101_10000u32.to_le_bytes(), "{ if (p1.new) r17:16 = memd(r4 + r2<<3) }");

    test_display(&0b0011_0101011_00100_11_1_0_0010_101_10000u32.to_le_bytes(), "{ if (!p1) memh(r4 + r2<<3) = r16.h }");
    test_display(&0b0011_0101101_00100_11_1_0_0010_101_10010u32.to_le_bytes(), "{ if (!p1) memw(r4 + r2<<3) = r2.new }");

    test_display(&0b0011_0101101_00100_11_1_0_0010_101_10010u32.to_le_bytes(), "{ if (!p1) memw(r4 + r2<<3) = r2.new }");

    test_invalid(&0b0011_0101111_00100_11_1_0_0010_101_10010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0011_0110001_00100_11_1_0_0010_101_10010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0011_0110111_00100_11_1_0_0010_101_10010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0011_0111001_00100_11_1_0_0010_101_10010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0011_0111111_00100_11_1_0_0010_101_10010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0011_1000000_00100_11_1_0_0010_101_11111u32.to_le_bytes(), "{ if (p1) memb(r4+#5) = #-1 }");
    test_display(&0b0011_1000100_00100_11_1_0_0010_101_11111u32.to_le_bytes(), "{ if (!p1) memb(r4+#5) = #-1 }");
    test_invalid(&0b0011_1000111_00100_11_1_0_0010_101_11111u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0011_1010000_00100_11_1_0_0010_100_11111u32.to_le_bytes(), "{ lr = memb(r4 + r2<<3) }");
    test_display(&0b0011_1010001_00100_11_1_0_0010_100_11110u32.to_le_bytes(), "{ fp = memub(r4 + r2<<3) }");

    test_display(&0b0011_1011010_00100_11_1_0_0010_100_11110u32.to_le_bytes(), "{ memh(r4 + r2<<3) = fp }");
    test_display(&0b0011_1011011_00100_11_1_0_0010_100_11110u32.to_le_bytes(), "{ memh(r4 + r2<<3) = r30.h }");
    test_display(&0b0011_1011101_00100_11_1_0_0010_100_10110u32.to_le_bytes(), "{ memw(r4 + r2<<3) = r6.new }");

    test_display(&0b0011_1100000_00100_11_1_1_0010_100_10110u32.to_le_bytes(), "{ memb(r4+#37) = #-106 }");
    test_display(&0b0011_1100001_00100_11_1_1_0010_100_10110u32.to_le_bytes(), "{ memh(r4+#74) = #-106 }");
    test_display(&0b0011_1100010_00100_11_1_1_0010_100_10110u32.to_le_bytes(), "{ memw(r4+#148) = #-106 }");
    test_invalid(&0b0011_1100011_00100_11_1_1_0010_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0011_1110000_00100_11_0_1_0010_100_10110u32.to_le_bytes(), "{ memb(r4+#37) += r22 }");
    test_display(&0b0011_1110000_00100_11_0_1_0010_101_10110u32.to_le_bytes(), "{ memb(r4+#37) -= r22 }");
    test_display(&0b0011_1110000_00100_11_0_1_0010_110_10110u32.to_le_bytes(), "{ memb(r4+#37) &= r22 }");
    test_display(&0b0011_1110000_00100_11_0_1_0010_111_10110u32.to_le_bytes(), "{ memb(r4+#37) |= r22 }");
    test_display(&0b0011_1110001_00100_11_0_1_0010_100_10110u32.to_le_bytes(), "{ memh(r4+#74) += r22 }");
    test_display(&0b0011_1110001_00100_11_0_1_0010_101_10110u32.to_le_bytes(), "{ memh(r4+#74) -= r22 }");
    test_display(&0b0011_1110001_00100_11_0_1_0010_110_10110u32.to_le_bytes(), "{ memh(r4+#74) &= r22 }");
    test_display(&0b0011_1110001_00100_11_0_1_0010_111_10110u32.to_le_bytes(), "{ memh(r4+#74) |= r22 }");
    test_display(&0b0011_1110010_00100_11_0_1_0010_100_10110u32.to_le_bytes(), "{ memw(r4+#148) += r22 }");
    test_display(&0b0011_1110010_00100_11_0_1_0010_101_10110u32.to_le_bytes(), "{ memw(r4+#148) -= r22 }");
    test_display(&0b0011_1110010_00100_11_0_1_0010_110_10110u32.to_le_bytes(), "{ memw(r4+#148) &= r22 }");
    test_display(&0b0011_1110010_00100_11_0_1_0010_111_10110u32.to_le_bytes(), "{ memw(r4+#148) |= r22 }");
    test_invalid(&0b0011_1110011_00100_11_0_1_0010_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0011_1111000_00100_11_0_1_0010_100_10110u32.to_le_bytes(), "{ memb(r4+#37) += #0x16 }");
    test_display(&0b0011_1111000_00100_11_0_1_0010_101_10110u32.to_le_bytes(), "{ memb(r4+#37) -= #0x16 }");
    test_display(&0b0011_1111000_00100_11_0_1_0010_110_10110u32.to_le_bytes(), "{ memb(r4+#37) = clrbit(#0x16) }");
    test_display(&0b0011_1111000_00100_11_0_1_0010_111_10110u32.to_le_bytes(), "{ memb(r4+#37) = setbit(#0x16) }");
    test_display(&0b0011_1111001_00100_11_0_1_0010_100_10110u32.to_le_bytes(), "{ memh(r4+#74) += #0x16 }");
    test_display(&0b0011_1111001_00100_11_0_1_0010_101_10110u32.to_le_bytes(), "{ memh(r4+#74) -= #0x16 }");
    test_display(&0b0011_1111001_00100_11_0_1_0010_110_10110u32.to_le_bytes(), "{ memh(r4+#74) = clrbit(#0x16) }");
    test_display(&0b0011_1111001_00100_11_0_1_0010_111_10110u32.to_le_bytes(), "{ memh(r4+#74) = setbit(#0x16) }");
    test_display(&0b0011_1111010_00100_11_0_1_0010_100_10110u32.to_le_bytes(), "{ memw(r4+#148) += #0x16 }");
    test_display(&0b0011_1111010_00100_11_0_1_0010_101_10110u32.to_le_bytes(), "{ memw(r4+#148) -= #0x16 }");
    test_display(&0b0011_1111010_00100_11_0_1_0010_110_10110u32.to_le_bytes(), "{ memw(r4+#148) = clrbit(#0x16) }");
    test_display(&0b0011_1111010_00100_11_0_1_0010_111_10110u32.to_le_bytes(), "{ memw(r4+#148) = setbit(#0x16) }");
    test_invalid(&0b0011_1111011_00100_11_0_1_0010_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
}

#[test]
fn inst_0100() {
    test_display(&0b0100_0000_000_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2) memb(r10+#45) = r7 }");
    test_display(&0b0100_0000_010_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2) memh(r10+#90) = r7 }");
    test_display(&0b0100_0000_011_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2) memh(r10+#90) = r7.h }");
    test_display(&0b0100_0000_100_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2) memw(r10+#180) = r7 }");
    test_display(&0b0100_0000_101_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2) memb(r10+#45) = r7.new }");
    test_display(&0b0100_0000_101_01010_11_1_01111_011_01010u32.to_le_bytes(), "{ if (p2) memh(r10+#90) = r7.new }");
    test_display(&0b0100_0000_101_01010_11_1_10111_011_01010u32.to_le_bytes(), "{ if (p2) memw(r10+#180) = r7.new }");
    test_invalid(&0b0100_0000_101_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0000_110_01010_11_1_00110_011_01010u32.to_le_bytes(), "{ if (p2) memd(r10+#360) = r7:6 }");
    test_invalid(&0b0100_0000_111_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_0010_000_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2) memb(r10+#45) = r7 }");
    test_display(&0b0100_0010_010_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2) memh(r10+#90) = r7 }");
    test_display(&0b0100_0010_011_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2) memh(r10+#90) = r7.h }");
    test_display(&0b0100_0010_100_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2) memw(r10+#180) = r7 }");
    test_display(&0b0100_0010_101_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2) memb(r10+#45) = r7.new }");
    test_display(&0b0100_0010_101_01010_11_1_01111_011_01010u32.to_le_bytes(), "{ if (!p2) memh(r10+#90) = r7.new }");
    test_display(&0b0100_0010_101_01010_11_1_10111_011_01010u32.to_le_bytes(), "{ if (!p2) memw(r10+#180) = r7.new }");
    test_invalid(&0b0100_0010_101_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0010_110_01010_11_1_00110_011_01010u32.to_le_bytes(), "{ if (!p2) memd(r10+#360) = r7:6 }");
    test_invalid(&0b0100_0010_111_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_0100_000_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2.new) memb(r10+#45) = r7 }");
    test_display(&0b0100_0100_010_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2.new) memh(r10+#90) = r7 }");
    test_display(&0b0100_0100_011_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2.new) memh(r10+#90) = r7.h }");
    test_display(&0b0100_0100_100_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2.new) memw(r10+#180) = r7 }");
    test_display(&0b0100_0100_101_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (p2.new) memb(r10+#45) = r7.new }");
    test_display(&0b0100_0100_101_01010_11_1_01111_011_01010u32.to_le_bytes(), "{ if (p2.new) memh(r10+#90) = r7.new }");
    test_display(&0b0100_0100_101_01010_11_1_10111_011_01010u32.to_le_bytes(), "{ if (p2.new) memw(r10+#180) = r7.new }");
    test_invalid(&0b0100_0100_101_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0100_110_01010_11_1_00110_011_01010u32.to_le_bytes(), "{ if (p2.new) memd(r10+#360) = r7:6 }");
    test_invalid(&0b0100_0100_111_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_0110_000_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memb(r10+#45) = r7 }");
    test_display(&0b0100_0110_010_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memh(r10+#90) = r7 }");
    test_display(&0b0100_0110_011_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memh(r10+#90) = r7.h }");
    test_display(&0b0100_0110_100_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memw(r10+#180) = r7 }");
    test_display(&0b0100_0110_101_01010_11_1_00111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memb(r10+#45) = r7.new }");
    test_display(&0b0100_0110_101_01010_11_1_01111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memh(r10+#90) = r7.new }");
    test_display(&0b0100_0110_101_01010_11_1_10111_011_01010u32.to_le_bytes(), "{ if (!p2.new) memw(r10+#180) = r7.new }");
    test_invalid(&0b0100_0110_101_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0110_110_01010_11_1_00110_011_01010u32.to_le_bytes(), "{ if (!p2.new) memd(r10+#360) = r7:6 }");
    test_invalid(&0b0100_0110_111_01010_11_1_11111_011_01010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    // now for some loads
    test_display(&0b0100_0001_000_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2) r8 = memb(r10+#45) }");
    test_display(&0b0100_0001_001_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2) r8 = memub(r10+#45) }");
    test_display(&0b0100_0001_010_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2) r8 = memh(r10+#90) }");
    test_display(&0b0100_0001_011_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2) r8 = memuh(r10+#90) }");
    test_display(&0b0100_0001_100_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2) r8 = memw(r10+#180) }");
    test_invalid(&0b0100_0001_101_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0001_110_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2) r9:8 = memd(r10+#360) }");
    test_invalid(&0b0100_0001_111_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_0011_000_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2) r8 = memb(r10+#45) }");
    test_display(&0b0100_0011_001_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2) r8 = memub(r10+#45) }");
    test_display(&0b0100_0011_010_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2) r8 = memh(r10+#90) }");
    test_display(&0b0100_0011_011_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2) r8 = memuh(r10+#90) }");
    test_display(&0b0100_0011_100_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2) r8 = memw(r10+#180) }");
    test_invalid(&0b0100_0011_101_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0011_110_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2) r9:8 = memd(r10+#360) }");
    test_invalid(&0b0100_0011_111_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_0101_000_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2.new) r8 = memb(r10+#45) }");
    test_display(&0b0100_0101_001_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2.new) r8 = memub(r10+#45) }");
    test_display(&0b0100_0101_010_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2.new) r8 = memh(r10+#90) }");
    test_display(&0b0100_0101_011_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2.new) r8 = memuh(r10+#90) }");
    test_display(&0b0100_0101_100_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2.new) r8 = memw(r10+#180) }");
    test_invalid(&0b0100_0101_101_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0101_110_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (p2.new) r9:8 = memd(r10+#360) }");
    test_invalid(&0b0100_0101_111_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_0111_000_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2.new) r8 = memb(r10+#45) }");
    test_display(&0b0100_0111_001_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2.new) r8 = memub(r10+#45) }");
    test_display(&0b0100_0111_010_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2.new) r8 = memh(r10+#90) }");
    test_display(&0b0100_0111_011_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2.new) r8 = memuh(r10+#90) }");
    test_display(&0b0100_0111_100_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2.new) r8 = memw(r10+#180) }");
    test_invalid(&0b0100_0111_101_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_0111_110_01010_11_1_10101_101_01000u32.to_le_bytes(), "{ if (!p2.new) r9:8 = memd(r10+#360) }");
    test_invalid(&0b0100_0111_111_01010_11_1_11101_101_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_100_0000_01010_11_1_00110_001_10011u32.to_le_bytes(), "{ memb(gp+#0x1533) = r6 }");
    test_display(&0b0100_100_0010_01010_11_1_00110_001_10011u32.to_le_bytes(), "{ memh(gp+#0x2a66) = r6 }");
    test_display(&0b0100_100_0011_01010_11_1_00110_001_10011u32.to_le_bytes(), "{ memh(gp+#0x2a66) = r6.h }");
    test_display(&0b0100_100_0100_01010_11_1_00110_001_10011u32.to_le_bytes(), "{ memw(gp+#0x54cc) = r6 }");
    test_display(&0b0100_100_0101_01010_11_1_00110_001_10011u32.to_le_bytes(), "{ memb(gp+#0x1533) = r6.new }");
    test_display(&0b0100_100_0101_01010_11_1_01110_001_10011u32.to_le_bytes(), "{ memh(gp+#0x2a66) = r6.new }");
    test_display(&0b0100_100_0101_01010_11_1_10110_001_10011u32.to_le_bytes(), "{ memw(gp+#0x54cc) = r6.new }");
    test_invalid(&0b0100_100_0101_01010_11_1_11110_001_10011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_100_0110_01010_11_1_00110_001_10011u32.to_le_bytes(), "{ memd(gp+#0xa998) = r7:6 }");
    test_invalid(&0b0100_100_0111_01010_11_1_11110_001_10011u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0100_100_1000_01010_11_1_00110011_00110u32.to_le_bytes(), "{ r6 = memb(gp+#0x1533) }");
    test_display(&0b0100_100_1001_01010_11_1_00110011_00110u32.to_le_bytes(), "{ r6 = memub(gp+#0x1533) }");
    test_display(&0b0100_100_1010_01010_11_1_00110011_00110u32.to_le_bytes(), "{ r6 = memh(gp+#0x2a66) }");
    test_display(&0b0100_100_1011_01010_11_1_00110011_00110u32.to_le_bytes(), "{ r6 = memuh(gp+#0x2a66) }");
    test_display(&0b0100_100_1100_01010_11_1_00110011_00110u32.to_le_bytes(), "{ r6 = memw(gp+#0x54cc) }");
    test_invalid(&0b0100_100_1101_01010_11_1_00110011_00110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0100_100_1110_01010_11_1_00110011_00110u32.to_le_bytes(), "{ r7:6 = memd(gp+#0xa998) }");
    test_invalid(&0b0100_100_1111_01010_11_1_00110011_00110u32.to_le_bytes(), DecodeError::InvalidOpcode);
}

#[test]
fn inst_0101() {
    test_invalid(&0b0101_000_0100_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0101_000_0101_00001_11_0_00000_000_00000u32.to_le_bytes(), "{ callr r1 }");
    test_display(&0b0101_000_0110_00001_11_0_00000_000_00000u32.to_le_bytes(), "{ callrh r1 }");
    test_invalid(&0b0101_000_0111_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0101_000_1000_00001_11_0_00010_000_00000u32.to_le_bytes(), "{ if (p2) callr r1 }");
    test_display(&0b0101_000_1001_00001_11_0_00010_000_00000u32.to_le_bytes(), "{ if (!p2) callr r1 }");
    test_invalid(&0b0101_000_1010_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_invalid(&0b0101_001_0011_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0101_001_0100_00001_11_0_00000_000_00000u32.to_le_bytes(), "{ jumpr r1 }");
    test_display(&0b0101_001_0101_00001_11_0_00000_000_00000u32.to_le_bytes(), "{ hintjr(r1) }");
    test_display(&0b0101_001_0110_00001_11_0_00000_000_00000u32.to_le_bytes(), "{ jumprh r1 }");
    test_invalid(&0b0101_001_0111_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0101_001_1000_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0101_001_1001_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0101_001_1010_00001_11_0_01011_000_00000u32.to_le_bytes(), "{ if (p3.new) jumpr:nt r1 }");
    test_display(&0b0101_001_1011_00001_11_0_01011_000_00000u32.to_le_bytes(), "{ if (!p3.new) jumpr:nt r1 }");
    test_invalid(&0b0101_001_1100_00001_11_0_00000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0101_010_0000_00000_11_0_01000_000_00010u32.to_le_bytes(), "{ trap0(#0x40) }");
    test_display(&0b0101_010_0010_00010_11_0_01000_000_00010u32.to_le_bytes(), "{ pause(#0x240) }");
    test_display(&0b0101_010_0100_00010_11_0_01000_000_00010u32.to_le_bytes(), "{ trap1(r2, #0x40) }");
    test_invalid(&0b0101_010_0110_00010_11_0_01000_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_invalid(&0b0101_011_0101_00010_11_0_01000_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0101_011_0110_00010_11_0_00000_000_00000u32.to_le_bytes(), "{ icinva(r2) }");
    test_display(&0b0101_011_1110_00000_11_0_00000_000_00010u32.to_le_bytes(), "{ isync }");
    test_display(&0b0101_011_1111_00000_11_0_10000_000_00010u32.to_le_bytes(), "{ unpause }");

    test_display(&0b0101_100_0000_00000_11_0_00000_000_00010u32.to_le_bytes(), "{ jump $+0x4 }");
    test_display(&0b0101_101_0000_00000_11_0_00000_000_00010u32.to_le_bytes(), "{ call $+0x4 }");

    test_display(&0b0101_110_0000_00000_11_0_00001_000_00010u32.to_le_bytes(), "{ if (p1) jump:nt $+0x4 }");
    test_display(&0b0101_110_0001_00000_11_0_01001_000_00010u32.to_le_bytes(), "{ if (!p1.new) jump:nt $+0x4 }");
    test_display(&0b0101_110_1001_00000_11_0_00001_000_00010u32.to_le_bytes(), "{ if (!p1) call $+0x4 }");
    test_invalid(&0b0101_110_1001_00000_11_0_01001_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
}

#[test]
fn inst_0110() {
    test_display(&0b0110_0000000_00110_11_0_00010_000_01000u32.to_le_bytes(), "{ loop0($+0x24, r6) }");
    test_display(&0b0110_0000001_00110_11_0_00010_000_01000u32.to_le_bytes(), "{ loop1($+0x24, r6) }");
    test_invalid(&0b0110_0000010_00110_11_0_00010_000_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b0110_0000011_00110_11_0_00010_000_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b0110_0000101_00110_11_0_00010_000_01000u32.to_le_bytes(), "{ p3 = sp1loop0($+0x24, r6) }");
    test_display(&0b0110_0000110_00110_11_0_00010_000_01000u32.to_le_bytes(), "{ p3 = sp2loop0($+0x24, r6) }");
    test_display(&0b0110_0000111_00110_11_0_00010_000_01000u32.to_le_bytes(), "{ p3 = sp3loop0($+0x24, r6) }");

    // TODO: test signed (negative) offsets
    test_display(&0b0110_0001001_00110_11_1_000101_00_10110u32.to_le_bytes(), "{ if (r6!=#0) jump:nt $-0x1ad4 }");
    test_display(&0b0110_0001001_00110_11_1_100101_00_10110u32.to_le_bytes(), "{ if (r6!=#0) jump:t $-0x1ad4 }");
    test_display(&0b0110_0001011_00110_11_1_000101_00_10110u32.to_le_bytes(), "{ if (r6>=#0) jump:nt $-0x1ad4 }");
    test_display(&0b0110_0001011_00110_11_1_100101_00_10110u32.to_le_bytes(), "{ if (r6>=#0) jump:t $-0x1ad4 }");
    test_display(&0b0110_0001101_00110_11_1_000101_00_10110u32.to_le_bytes(), "{ if (r6==#0) jump:nt $-0x1ad4 }");
    test_display(&0b0110_0001101_00110_11_1_100101_00_10110u32.to_le_bytes(), "{ if (r6==#0) jump:t $-0x1ad4 }");
    test_display(&0b0110_0001111_00110_11_1_000101_00_10110u32.to_le_bytes(), "{ if (r6<=#0) jump:nt $-0x1ad4 }");
    test_display(&0b0110_0001111_00110_11_1_100101_00_10110u32.to_le_bytes(), "{ if (r6<=#0) jump:t $-0x1ad4 }");

    test_display(&0b0110_0010001_00110_11_0_000101_00_10110u32.to_le_bytes(), "{ c22 = r6 }");
    test_display(&0b0110_0010010_00110_11_0_00000_000_01000u32.to_le_bytes(), "{ trace(r6) }");
    test_display(&0b0110_0010010_00110_11_0_00000_001_01000u32.to_le_bytes(), "{ diag(r6) }");
    test_display(&0b0110_0010010_00110_11_0_00100_010_01000u32.to_le_bytes(), "{ diag0(r7:6, r5:4) }");
    test_display(&0b0110_0010010_00110_11_0_00100_011_01000u32.to_le_bytes(), "{ diag1(r7:6, r5:4) }");

    test_display(&0b0110_0011001_00110_11_0_000101_00_10110u32.to_le_bytes(), "{ c23:22 = r7:6 }");

    test_display(&0b0110_1000000_00110_11_0_000101_00_10110u32.to_le_bytes(), "{ r23:22 = c7:6 }");

    test_display(&0b0110_1001000_00110_11_0_000101_00_01010u32.to_le_bytes(), "{ loop0($+0x24, #0xd2) }");
    test_display(&0b0110_1001001_00110_11_0_000101_00_01010u32.to_le_bytes(), "{ loop1($+0x24, #0xd2) }");
    test_display(&0b0110_1001101_00110_11_0_000101_00_01010u32.to_le_bytes(), "{ p3 = sp1loop0($+0x24, #0xd2) }");
    test_display(&0b0110_1001110_00110_11_0_000101_00_01010u32.to_le_bytes(), "{ p3 = sp2loop0($+0x24, #0xd2) }");
    test_display(&0b0110_1001111_00110_11_0_000101_00_01010u32.to_le_bytes(), "{ p3 = sp3loop0($+0x24, #0xd2) }");

    test_display(&0b0110_1010000_00110_11_0_000101_00_10110u32.to_le_bytes(), "{ r22 = m0 }");
    test_display(&0b0110_1010010_01001_11_0_000101_00_10110u32.to_le_bytes(), "{ r22 = add(pc, #0x5) }");

    test_display(&0b0110_1011000_00011_11_0_000100_00_00001u32.to_le_bytes(), "{ p1 = and(p2, p3) }");
    test_display(&0b0110_1011000_00011_11_1_000101_00_10001u32.to_le_bytes(), "{ p1 = fastcorner9(p3, p2) }");
    test_display(&0b0110_1011000_10011_11_0_000100_00_00001u32.to_le_bytes(), "{ p1 = and(p2, and(p3, p0)) }");
    test_display(&0b0110_1011000_10011_11_1_000101_00_10001u32.to_le_bytes(), "{ p1 = !fastcorner9(p3, p2) }");
    test_display(&0b0110_1011001_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = or(p2, p3) }");
    test_display(&0b0110_1011001_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = and(p3, or(p2, p0)) }");
    test_display(&0b0110_1011010_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = xor(p2, p3) }");
    test_display(&0b0110_1011010_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = or(p3, and(p2, p0)) }");
    test_display(&0b0110_1011011_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = and(p2, !p3) }");
    test_display(&0b0110_1011011_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = or(p3, or(p2, p0)) }");
    test_display(&0b0110_1011100_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = any8(p3) }");
    test_display(&0b0110_1011100_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = and(p3, and(p2, !p0)) }");
    test_display(&0b0110_1011101_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = all8(p3) }");
    test_display(&0b0110_1011101_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = and(p3, or(p2, !p0)) }");
    test_display(&0b0110_1011110_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = not(p3) }");
    test_display(&0b0110_1011110_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = or(p3, and(p2, !p0)) }");
    test_display(&0b0110_1011111_00011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = or(p2, !p3) }");
    test_display(&0b0110_1011111_10011_11_0_000100_00_10001u32.to_le_bytes(), "{ p1 = or(p3, or(p2, !p0)) }");

    test_display(&0b0110_1111111_01010_11_0_001100_10_00011u32.to_le_bytes(), "{ r3 = movlen(r6, r11:10) }");
}

#[test]
fn inst_0111() {
    test_invalid(&0b0111_0000010_00000_11_0_0_0000_000_00000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0111_0000000_00011_11_1_0_1101_000_00100u32.to_le_bytes(), "{ if (!p1.new) r4 = aslh(r3) }");
    test_display(&0b0111_0000011_00001_11_0_0_0000_000_00100u32.to_le_bytes(), "{ r4 = r1 }");
    test_invalid(&0b0111_0000011_00001_11_1_0_0000_000_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0111_0001011_00010_11_0_0_0000_001_00000u32.to_le_bytes(), "{ r2.l = #0x4020 }");
    test_display(&0b0111_0001101_00010_11_0_0_0000_001_00000u32.to_le_bytes(), "{ r2.l = #0x8020 }");
    test_display(&0b0111_0010101_00010_11_0_0_0000_001_00000u32.to_le_bytes(), "{ r2.h = #0x8020 }");

    test_display(&0b0111_0011001_00110_11_0_0_0000_111_10000u32.to_le_bytes(), "{ r16 = mux(p1, r6, #7) }");
    test_display(&0b0111_0011101_00110_11_0_0_0000_111_10000u32.to_le_bytes(), "{ r16 = mux(p1, #7, r6) }");

    test_display(&0b0111_0011000_00110_11_1_0_0000_111_10000u32.to_le_bytes(), "{ r17:16 = combine(r6, #7) }");
    test_display(&0b0111_0011001_00110_11_1_0_0000_111_10000u32.to_le_bytes(), "{ r17:16 = combine(#7, r6) }");
    test_display(&0b0111_0011010_00110_11_1_0_0000_111_10000u32.to_le_bytes(), "{ r16 = cmp.eq(r6, #7) }");
    test_display(&0b0111_0011011_00110_11_1_0_0000_111_10000u32.to_le_bytes(), "{ r16 = !cmp.eq(r6, #7) }");

    test_display(&0b0111_0100010_00110_11_0_0_0000_111_10000u32.to_le_bytes(), "{ if (p2) r16 = add(r6, #7) }");
    test_display(&0b0111_0100010_00110_11_1_0_0000_111_10000u32.to_le_bytes(), "{ if (p2.new) r16 = add(r6, #7) }");
    test_display(&0b0111_0100110_00110_11_1_0_0000_111_10000u32.to_le_bytes(), "{ if (!p2.new) r16 = add(r6, #7) }");

    test_display(&0b0111_0101001_00110_11_1_0_0000_111_00001u32.to_le_bytes(), "{ p1 = cmp.eq(r6, #-249) }");
    test_display(&0b0111_0101001_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ p1 = !cmp.eq(r6, #-249) }");
    test_display(&0b0111_0101011_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ p1 = !cmp.gt(r6, #-249) }");
    test_display(&0b0111_0101100_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ p1 = !cmp.gtu(r6, #0x107) }");
    test_invalid(&0b0111_0101101_00110_11_1_0_0000_111_10001u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b0111_0101110_00110_11_1_0_0000_111_10001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0111_0110001_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ r17 = and(r6, #-249) }");
    test_display(&0b0111_0110011_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ r17 = sub(#-249, r6) }");
    test_display(&0b0111_0110101_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ r17 = or(r6, #-249) }");
    test_invalid(&0b0111_0110111_00110_11_1_0_0000_111_10001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_invalid(&0b0111_0111111_00110_11_1_0_0000_111_10001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0111_1000110_00110_11_1_0_0000_111_10001u32.to_le_bytes(), "{ r17 = #-15929 }");

    test_display(&0b0111_101_01_0100111_11_1_00000111_10001u32.to_le_bytes(),  "{ r17 = mux(p1, #7, #79) }");

    test_display(&0b0111_1100010_00000_11_1_0_0000_111_10000u32.to_le_bytes(), "{ r17:16 = combine(#7, #-127) }");
    test_display(&0b0111_1100100_10000_11_1_0_0000_111_10000u32.to_le_bytes(), "{ r17:16 = combine(#7, #0x21) }");

    test_invalid(&0b0111_1101100_10000_11_1_0_0000_111_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b0111_1110010_00100_11_0_0_0000_111_10000u32.to_le_bytes(), "{ if (p2) r16 = #1031 }");
    test_display(&0b0111_1110110_00100_11_1_0_0000_111_10000u32.to_le_bytes(), "{ if (!p2.new) r16 = #1031 }");
}

#[test]
fn inst_1000() {
    test_display(&0b1000_0000000_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = asr(r5:4, #0x6) }");
    test_display(&0b1000_0000000_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = lsr(r5:4, #0x6) }");
    test_display(&0b1000_0000000_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = asl(r5:4, #0x6) }");
    test_display(&0b1000_0000000_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = rol(r5:4, #0x6) }");
    test_display(&0b1000_0000000_00100_11_000000_100_10110u32.to_le_bytes(), "{ r23:22 = vsathub(r5:4) }");
    test_display(&0b1000_0000000_00100_11_000000_101_10110u32.to_le_bytes(), "{ r23:22 = vsatwuh(r5:4) }");
    test_display(&0b1000_0000000_00100_11_000000_110_10110u32.to_le_bytes(), "{ r23:22 = vsatwh(r5:4) }");
    test_display(&0b1000_0000000_00100_11_000000_111_10110u32.to_le_bytes(), "{ r23:22 = vsathb(r5:4) }");
    test_display(&0b1000_0000001_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vasrh(r5:4, #0x6):raw }");
    test_invalid(&0b1000_0000001_00100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000001_00100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000001_00100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000001_00100_11_010110_000_10110u32.to_le_bytes(), DecodeError::InvalidOperand);

    test_display(&0b1000_0000010_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vasrw(r5:4, #0x6) }");
    test_display(&0b1000_0000010_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vlsrw(r5:4, #0x6) }");
    test_display(&0b1000_0000010_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vaslw(r5:4, #0x6) }");
    test_invalid(&0b1000_0000010_00100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1000_0000010_00100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vabsh(r5:4) }");
    test_display(&0b1000_0000010_00100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vabsh(r5:4):sat }");
    test_display(&0b1000_0000010_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vabsw(r5:4) }");
    test_display(&0b1000_0000010_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vabsw(r5:4):sat }");

    test_invalid(&0b1000_0000011_00100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1000_0000100_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vasrh(r5:4, #0x6) }");
    test_display(&0b1000_0000100_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vlsrh(r5:4, #0x6) }");
    test_display(&0b1000_0000100_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vaslh(r5:4, #0x6) }");
    test_invalid(&0b1000_0000100_00100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1000_0000100_00100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = not(r5:4) }");
    test_display(&0b1000_0000100_00100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = neg(r5:4) }");
    test_display(&0b1000_0000100_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = abs(r5:4) }");
    test_display(&0b1000_0000100_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vconj(r5:4):sat }");

    test_invalid(&0b1000_0000101_00100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_invalid(&0b1000_0000101_00100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000101_00100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000101_00100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000101_00100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1000_0000110_00100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = deinterleave(r5:4) }");
    test_display(&0b1000_0000110_00100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = interleave(r5:4) }");
    test_display(&0b1000_0000110_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = brev(r5:4) }");
    test_display(&0b1000_0000110_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = asr(r5:4, #0x6):rnd }");

    test_display(&0b1000_0000111_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = convert_df2d(r5:4) }");
    test_display(&0b1000_0000111_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = convert_df2ud(r5:4) }");
    test_display(&0b1000_0000111_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = convert_ud2df(r5:4) }");
    test_display(&0b1000_0000111_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = convert_d2df(r5:4) }");

    test_invalid(&0b1000_0000111_00100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1000_0000111_00100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1000_0000111_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = convert_df2d(r5:4):chop }");
    test_display(&0b1000_0000111_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = convert_df2ud(r5:4):chop }");

    test_display(&0b1000_0001101_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = extractu(r5:4, #0x6, #0x2f) }");

    test_display(&0b1000_0010000_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= asr(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= lsr(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= asl(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= rol(r5:4, #0x6) }");

    test_display(&0b1000_0010000_00100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += asr(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += lsr(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += asl(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += rol(r5:4, #0x6) }");

    test_display(&0b1000_0010010_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 &= asr(r5:4, #0x6) }");
    test_display(&0b1000_0010010_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 &= lsr(r5:4, #0x6) }");
    test_display(&0b1000_0010010_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 &= asl(r5:4, #0x6) }");
    test_display(&0b1000_0010010_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 &= rol(r5:4, #0x6) }");

    test_display(&0b1000_0010010_00100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 |= asr(r5:4, #0x6) }");
    test_display(&0b1000_0010010_00100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 |= lsr(r5:4, #0x6) }");
    test_display(&0b1000_0010010_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 |= asl(r5:4, #0x6) }");
    test_display(&0b1000_0010010_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 |= rol(r5:4, #0x6) }");

    test_display(&0b1000_0010100_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 ^= asr(r5:4, #0x6) }");
    test_display(&0b1000_0010100_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 ^= lsr(r5:4, #0x6) }");
    test_display(&0b1000_0010100_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 ^= asl(r5:4, #0x6) }");
    test_display(&0b1000_0010100_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 ^= rol(r5:4, #0x6) }");

    test_display(&0b1000_0010000_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= asr(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= lsr(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= asl(r5:4, #0x6) }");
    test_display(&0b1000_0010000_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= rol(r5:4, #0x6) }");

    test_display(&0b1000_0011101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = insert(r21:20, #0x6, #0x2f) }");

    test_display(&0b1000_0100_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vsxtbh(r20) }");
    test_display(&0b1000_0100_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vzxtbh(r20) }");
    test_display(&0b1000_0100_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vsxthw(r20) }");
    test_display(&0b1000_0100_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vzxthw(r20) }");
    test_display(&0b1000_0100_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vsplath(r20) }");
    test_display(&0b1000_0100_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vsplatb(r20) }");
    test_display(&0b1000_0100_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = convert_sf2df(r20) }");
    test_display(&0b1000_0100_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = convert_uw2df(r20) }");
    test_display(&0b1000_0100_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = convert_w2df(r20) }");
    test_display(&0b1000_0100_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = convert_sf2ud(r20) }");
    test_display(&0b1000_0100_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = convert_sf2d(r20) }");
    test_display(&0b1000_0100_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = convert_sf2ud(r20):chop }");
    test_display(&0b1000_0100_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = convert_sf2d(r20):chop }");
    test_invalid(&0b1000_0100_100_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1000_0101_000_10100_11_000110_111_00010u32.to_le_bytes(), "{ p2 = tstbit(r20, #0x6) }");
    test_display(&0b1000_0101_001_10100_11_000110_111_00010u32.to_le_bytes(), "{ p2 = !tstbit(r20, #0x6) }");
    test_display(&0b1000_0101_010_10100_11_000110_111_00010u32.to_le_bytes(), "{ p2 = r20 }");
    test_invalid(&0b1000_0101_011_10100_11_000110_111_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1000_0101_100_10100_11_000110_111_00010u32.to_le_bytes(), "{ p2 = bitsclr(r20, #0x6) }");
    test_display(&0b1000_0101_101_10100_11_000110_111_00010u32.to_le_bytes(), "{ p2 = !bitsclr(r20, #0x6) }");
    test_invalid(&0b1000_0101_110_10100_11_000110_111_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1000_0101_111_10100_11_000110_111_00010u32.to_le_bytes(), "{ p2 = sfclass(r20, #0x6) }");

    test_display(&0b1000_0110_000_00000_11_000010_111_01010u32.to_le_bytes(), "{ r11:10 = mask(p2) }");

    test_display(&0b1000_0111_001_00001_11_000010_001_01010u32.to_le_bytes(), "{ r10 = tableidxb(r1, #0x9, #2):raw }");
    test_display(&0b1000_0111_011_00001_11_000010_001_01010u32.to_le_bytes(), "{ r10 = tableidxh(r1, #0x9, #2):raw }");
    test_display(&0b1000_0111_101_00001_11_000010_001_01010u32.to_le_bytes(), "{ r10 = tableidxw(r1, #0x9, #2):raw }");
    test_display(&0b1000_0111_111_00001_11_000010_001_01010u32.to_le_bytes(), "{ r10 = tableidxd(r1, #0x9, #2):raw }");

    test_display(&0b1000_1000_000_00010_11_000111_000_00110u32.to_le_bytes(), "{ r6 = vsathub(r3:2) }");
    test_display(&0b1000_1000_000_00010_11_000111_001_00110u32.to_le_bytes(), "{ r6 = convert_df2sf(r3:2) }");
    test_display(&0b1000_1000_000_00010_11_000111_010_00110u32.to_le_bytes(), "{ r6 = vsatwh(r3:2) }");
    test_display(&0b1000_1000_000_00010_11_000111_100_00110u32.to_le_bytes(), "{ r6 = vsatwuh(r3:2) }");
    test_display(&0b1000_1000_000_00010_11_000111_110_00110u32.to_le_bytes(), "{ r6 = vsathb(r3:2) }");
    test_display(&0b1000_1000_001_00010_11_000111_001_00110u32.to_le_bytes(), "{ r6 = convert_ud2sf(r3:2) }");
    test_display(&0b1000_1000_010_00010_11_000111_000_00110u32.to_le_bytes(), "{ r6 = clb(r3:2) }");
    test_display(&0b1000_1000_010_00010_11_000111_001_00110u32.to_le_bytes(), "{ r6 = convert_d2sf(r3:2) }");
    test_display(&0b1000_1000_010_00010_11_000111_010_00110u32.to_le_bytes(), "{ r6 = cl0(r3:2) }");
    test_display(&0b1000_1000_010_00010_11_000111_100_00110u32.to_le_bytes(), "{ r6 = cl1(r3:2) }");
    test_display(&0b1000_1000_011_00010_11_000111_000_00110u32.to_le_bytes(), "{ r6 = normamt(r3:2) }");
    test_display(&0b1000_1000_011_00010_11_000111_001_00110u32.to_le_bytes(), "{ r7:6 = convert_sf2ud(r2) }");
    test_display(&0b1000_1000_011_00010_11_000111_010_00110u32.to_le_bytes(), "{ r6 = add(clb(r3:2), #7) }");
    test_display(&0b1000_1000_011_00010_11_000111_011_00110u32.to_le_bytes(), "{ r6 = popcount(r3:2) }");
    test_display(&0b1000_1000_011_00010_11_000111_100_00110u32.to_le_bytes(), "{ r6 = vasrhub(r3:2, #0x7):raw }");
    test_display(&0b1000_1000_011_00010_11_000111_101_00110u32.to_le_bytes(), "{ r6 = vasrhub(r3:2, #0x7):sat }");
    test_display(&0b1000_1000_100_00010_11_000111_000_00110u32.to_le_bytes(), "{ r6 = vtrunohb(r3:2) }");
    test_display(&0b1000_1000_100_00010_11_000111_001_00110u32.to_le_bytes(), "{ r7:6 = convert_sf2d(r2) }");
    test_display(&0b1000_1000_100_00010_11_000111_010_00110u32.to_le_bytes(), "{ r6 = vtrunehb(r3:2) }");
    test_display(&0b1000_1000_100_00010_11_000111_100_00110u32.to_le_bytes(), "{ r6 = vrndwh(r3:2) }");
    test_display(&0b1000_1000_100_00010_11_000111_110_00110u32.to_le_bytes(), "{ r6 = vrndwh(r3:2):sat }");
    test_display(&0b1000_1000_101_00010_11_000111_001_00110u32.to_le_bytes(), "{ r7:6 = convert_sf2ud(r2):chop }");
    test_display(&0b1000_1000_110_00010_11_000111_000_00110u32.to_le_bytes(), "{ r6 = sat(r3:2) }");
    test_display(&0b1000_1000_110_00010_11_000111_001_00110u32.to_le_bytes(), "{ r6 = round(r3:2):sat }");
    test_display(&0b1000_1000_110_00010_11_000111_010_00110u32.to_le_bytes(), "{ r6 = vasrw(r3:2, #7) }");
    test_display(&0b1000_1000_110_00010_11_000111_100_00110u32.to_le_bytes(), "{ r7:6 = bitsplit(r2, #0x7) }");
    test_display(&0b1000_1000_110_00010_11_000111_101_00110u32.to_le_bytes(), "{ r6 = clip(r2, #0x7) }");
    test_display(&0b1000_1000_110_00010_11_000111_110_00110u32.to_le_bytes(), "{ r7:6 = vclip(r3:2, #0x7) }");
    test_display(&0b1000_1000_111_00010_11_000111_001_00110u32.to_le_bytes(), "{ r7:6 = convert_sf2d(r2):chop }");
    test_display(&0b1000_1000_111_00010_11_000111_010_00110u32.to_le_bytes(), "{ r6 = ct0(r3:2) }");
    test_display(&0b1000_1000_111_00010_11_000111_100_00110u32.to_le_bytes(), "{ r6 = ct1(r3:2) }");

    test_display(&0b1000_1001_000_00011_11_000001_000_00110u32.to_le_bytes(), "{ r6 = vitpack(p3, p1) }");
    test_display(&0b1000_1001_010_00011_11_000000_000_00110u32.to_le_bytes(), "{ r6 = p3 }");

    test_display(&0b1000_1010_101_00010_11_011010_101_00110u32.to_le_bytes(), "{ r7:6 = extract(r3:2, #0x1a, #0x2d) }");

    test_display(&0b1000_1011_001_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = convert_uw2sf(r2) }");
    test_display(&0b1000_1011_010_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = convert_w2sf(r2) }");
    test_display(&0b1000_1011_011_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = convert_sf2uw(r2) }");
    test_display(&0b1000_1011_011_00010_11_011010_001_00110u32.to_le_bytes(), "{ r6 = convert_sf2uw(r2):chop }");
    test_display(&0b1000_1011_100_00010_11_011010_010_00110u32.to_le_bytes(), "{ r6 = convert_sf2w(r2) }");
    test_display(&0b1000_1011_100_00010_11_011010_011_00110u32.to_le_bytes(), "{ r6 = convert_sf2w(r2):chop }");
    test_display(&0b1000_1011_101_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = sffixupr(r2) }");
    test_display(&0b1000_1011_111_00010_11_011010_011_00110u32.to_le_bytes(), "{ r6, p3 = sfinvsqrta(r2) }");

    test_display(&0b1000_1100_000_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = asr(r2, #0x1a) }");
    test_display(&0b1000_1100_000_00010_11_011010_001_00110u32.to_le_bytes(), "{ r6 = lsr(r2, #0x1a) }");
    test_display(&0b1000_1100_000_00010_11_011010_010_00110u32.to_le_bytes(), "{ r6 = asl(r2, #0x1a) }");
    test_display(&0b1000_1100_000_00010_11_011010_011_00110u32.to_le_bytes(), "{ r6 = rol(r2, #0x1a) }");
    test_display(&0b1000_1100_000_00010_11_011010_100_00110u32.to_le_bytes(), "{ r6 = clb(r2) }");
    test_display(&0b1000_1100_000_00010_11_011010_101_00110u32.to_le_bytes(), "{ r6 = cl0(r2) }");
    test_display(&0b1000_1100_000_00010_11_011010_110_00110u32.to_le_bytes(), "{ r6 = cl1(r2) }");
    test_display(&0b1000_1100_000_00010_11_011010_111_00110u32.to_le_bytes(), "{ r6 = normamt(r2) }");

    test_display(&0b1000_1100_001_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = add(clb(r2), #26) }");

    test_display(&0b1000_1100_010_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = asr(r2, #0x1a):rnd }");
    test_display(&0b1000_1100_010_00010_11_011010_010_00110u32.to_le_bytes(), "{ r6 = asl(r2, #0x1a):sat }");
    test_display(&0b1000_1100_010_00010_11_011010_100_00110u32.to_le_bytes(), "{ r6 = ct0(r2) }");
    test_display(&0b1000_1100_010_00010_11_011010_101_00110u32.to_le_bytes(), "{ r6 = ct1(r2) }");
    test_display(&0b1000_1100_010_00010_11_011010_110_00110u32.to_le_bytes(), "{ r6 = brev(r2) }");
    test_display(&0b1000_1100_010_00010_11_011010_111_00110u32.to_le_bytes(), "{ r6 = vsplatb(r2) }");

    test_display(&0b1000_1100_100_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = vsathb(r2) }");
    test_display(&0b1000_1100_100_00010_11_011010_010_00110u32.to_le_bytes(), "{ r6 = vsathub(r2) }");
    test_display(&0b1000_1100_100_00010_11_011010_100_00110u32.to_le_bytes(), "{ r6 = abs(r2) }");
    test_display(&0b1000_1100_100_00010_11_011010_101_00110u32.to_le_bytes(), "{ r6 = abs(r2):sat }");
    test_display(&0b1000_1100_100_00010_11_011010_110_00110u32.to_le_bytes(), "{ r6 = neg(r2):sat }");
    test_display(&0b1000_1100_100_00010_11_011010_111_00110u32.to_le_bytes(), "{ r6 = swiz(r2) }");

    test_display(&0b1000_1100_110_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = setbit(r2, #0x1a) }");
    test_display(&0b1000_1100_110_00010_11_011010_001_00110u32.to_le_bytes(), "{ r6 = clrbit(r2, #0x1a) }");
    test_display(&0b1000_1100_110_00010_11_011010_010_00110u32.to_le_bytes(), "{ r6 = togglebit(r2, #0x1a) }");

    test_display(&0b1000_1100_110_00010_11_011010_100_00110u32.to_le_bytes(), "{ r6 = sath(r2) }");
    test_display(&0b1000_1100_110_00010_11_011010_101_00110u32.to_le_bytes(), "{ r6 = satuh(r2) }");
    test_display(&0b1000_1100_110_00010_11_011010_110_00110u32.to_le_bytes(), "{ r6 = satub(r2) }");
    test_display(&0b1000_1100_110_00010_11_011010_111_00110u32.to_le_bytes(), "{ r6 = satb(r2) }");

    test_display(&0b1000_1100_111_00010_11_011010_000_00110u32.to_le_bytes(), "{ r6 = cround(r2, #0x1a) }");
    test_display(&0b1000_1100_111_00010_11_011010_010_00110u32.to_le_bytes(), "{ r7:6 = cround(r3:2, #0x1a) }");
    test_display(&0b1000_1100_111_00010_11_011010_100_00110u32.to_le_bytes(), "{ r6 = round(r2, #0x1a) }");
    test_display(&0b1000_1100_111_00010_11_011010_110_00110u32.to_le_bytes(), "{ r6 = round(r2, #0x1a):sat }");

    test_display(&0b1000_1101011_00100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = extractu(r4, #0x6, #0x18) }");
    test_display(&0b1000_1101011_00100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = mask(#0x6, #0x18) }");
    test_display(&0b1000_1101111_00100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = extract(r4, #0x6, #0x18) }");
    test_invalid(&0b1000_1101111_00100_11_100110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1000_1110000_00100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= asr(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= lsr(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= asl(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= rol(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += asr(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += lsr(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += asl(r5:4, #0x6) }");
    test_display(&0b1000_1110000_00100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += rol(r5:4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_000_10110u32.to_le_bytes(), "{ r22 &= asr(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_001_10110u32.to_le_bytes(), "{ r22 &= lsr(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_010_10110u32.to_le_bytes(), "{ r22 &= asl(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_011_10110u32.to_le_bytes(), "{ r22 &= rol(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_100_10110u32.to_le_bytes(), "{ r22 |= asr(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_101_10110u32.to_le_bytes(), "{ r22 |= lsr(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_110_10110u32.to_le_bytes(), "{ r22 |= asl(r4, #0x6) }");
    test_display(&0b1000_1110010_00100_11_000110_111_10110u32.to_le_bytes(), "{ r22 |= rol(r4, #0x6) }");
    test_display(&0b1000_1110100_00100_11_000110_000_10110u32.to_le_bytes(), "{ r22 ^= asr(r4, #0x6) }");
    test_display(&0b1000_1110100_00100_11_000110_001_10110u32.to_le_bytes(), "{ r22 ^= lsr(r4, #0x6) }");
    test_display(&0b1000_1110100_00100_11_000110_010_10110u32.to_le_bytes(), "{ r22 ^= asl(r4, #0x6) }");
    test_display(&0b1000_1110100_00100_11_000110_011_10110u32.to_le_bytes(), "{ r22 ^= rol(r4, #0x6) }");
    test_invalid(&0b1000_1110100_00100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1000_1111011_00100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = insert(r4, #0x6, #0x1f) }");
}

#[test]
fn inst_1001() {
    test_display(&0b1001_0000000_00010_11_0_00000_000_11110u32.to_le_bytes(), "{ r31:30 = deallocframe(r2):raw }");
    test_display(&0b1001_0010000_00010_11_000_000_000_00011u32.to_le_bytes(), "{ r3 = memw_locked(r2) }");
    test_display(&0b1001_0010000_00010_11_001_000_000_00011u32.to_le_bytes(), "{ r3 = memw_aq(r2) }");
    test_display(&0b1001_0010000_00010_11_010_000_000_00100u32.to_le_bytes(), "{ r5:4 = memd_locked(r2) }");
    test_display(&0b1001_0010000_00010_11_011_000_000_00100u32.to_le_bytes(), "{ r5:4 = memd_aq(r2) }");
    test_invalid(&0b1001_0010000_00010_11_000_000_001_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_001_000_001_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_010_000_001_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_011_000_001_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_000_000_010_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_001_000_010_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_010_000_010_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_011_000_010_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_000_000_011_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_001_000_011_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_010_000_011_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1001_0010000_00010_11_011_000_011_00100u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_0100000_00010_11_000_111_111_11111u32.to_le_bytes(), "{ dcfetch(r2+#16376) }");
    test_display(&0b1001_0110000_00010_11_0000_00_000_10000u32.to_le_bytes(), "{ r17:16 = dealloc_return(r2):raw }");
    test_invalid(&0b1001_0110000_00010_11_0001_00_000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_0110000_00010_11_0010_01_000_10000u32.to_le_bytes(), "{ if (p1.new) r17:16 = dealloc_return(r2):nt:raw }");
    test_display(&0b1001_0110000_00010_11_0100_01_000_10000u32.to_le_bytes(), "{ if (p1) r17:16 = dealloc_return(r2):raw }");
    test_display(&0b1001_0110000_00010_11_0110_01_000_10000u32.to_le_bytes(), "{ if (p1.new) r17:16 = dealloc_return(r2):t:raw }");
    test_invalid(&0b1001_0110000_00010_11_1000_01_000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_0110000_00010_11_1010_01_000_10000u32.to_le_bytes(), "{ if (!p1.new) r17:16 = dealloc_return(r2):nt:raw }");
    test_display(&0b1001_0110000_00010_11_1100_01_000_10000u32.to_le_bytes(), "{ if (!p1) r17:16 = dealloc_return(r2):raw }");
    test_display(&0b1001_0110000_00010_11_1110_01_000_10000u32.to_le_bytes(), "{ if (!p1.new) r17:16 = dealloc_return(r2):t:raw }");
    test_display(&0b1001_0110001_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = membh(r2+#3648) }");
    test_display(&0b1001_0110010_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2+#3648) }");
    test_display(&0b1001_0110011_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = memubh(r2+#3648) }");
    test_display(&0b1001_0110100_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2+#1824) }");
    test_display(&0b1001_0110101_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2+#7296) }");
    test_invalid(&0b1001_0000110_00010_11_0_00100_000_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_0110111_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r17:16 = membh(r2+#7296) }");
    test_display(&0b1001_0111000_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = memb(r2+#1824) }");
    test_display(&0b1001_0111001_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = memub(r2+#1824) }");
    test_display(&0b1001_0111010_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = memh(r2+#3648) }");
    test_display(&0b1001_0111011_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = memuh(r2+#3648) }");
    test_display(&0b1001_0111100_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r16 = memw(r2+#7296) }");
    test_invalid(&0b1001_0001101_00010_11_0_00100_000_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_0111110_00010_11_1001_00_000_10000u32.to_le_bytes(), "{ r17:16 = memd(r2+#14592) }");
    test_invalid(&0b1001_0001111_00010_11_0_00100_000_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);

    // TODO: exercise these
    test_display(&0b1001_1000001_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = membh(r2++#0xe:circ(m1)) }");
    test_display(&0b1001_1000010_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2++#0xe:circ(m1)) }");
    test_display(&0b1001_1000011_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = memubh(r2++#0xe:circ(m1)) }");
    test_display(&0b1001_1000100_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2++#0x7:circ(m1)) }");
    test_display(&0b1001_1000101_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2++#0x1c:circ(m1)) }");
    test_display(&0b1001_1000111_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r17:16 = membh(r2++#0x1c:circ(m1)) }");

    test_display(&0b1001_1000001_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = membh(r2++I:circ(m1)) }");
    test_display(&0b1001_1000010_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2++I:circ(m1)) }");
    test_display(&0b1001_1000011_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = memubh(r2++I:circ(m1)) }");
    test_display(&0b1001_1000100_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2++I:circ(m1)) }");
    test_display(&0b1001_1000101_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2++I:circ(m1)) }");
    test_display(&0b1001_1000111_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r17:16 = membh(r2++I:circ(m1)) }");

    test_display(&0b1001_1001000_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = memb(r2++#0x7:circ(m1)) }");
    test_display(&0b1001_1001001_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = memub(r2++#0x7:circ(m1)) }");
    test_display(&0b1001_1001010_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = memh(r2++#0xe:circ(m1)) }");
    test_display(&0b1001_1001011_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = memuh(r2++#0xe:circ(m1)) }");
    test_display(&0b1001_1001100_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r16 = memw(r2++#0x1c:circ(m1)) }");
    test_display(&0b1001_1001110_00010_11_1000_00111_10000u32.to_le_bytes(), "{ r17:16 = memd(r2++#0x38:circ(m1)) }");

    test_display(&0b1001_1001000_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = memb(r2++I:circ(m1)) }");
    test_display(&0b1001_1001001_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = memub(r2++I:circ(m1)) }");
    test_display(&0b1001_1001010_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = memh(r2++I:circ(m1)) }");
    test_display(&0b1001_1001011_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = memuh(r2++I:circ(m1)) }");
    test_display(&0b1001_1001100_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r16 = memw(r2++I:circ(m1)) }");
    test_display(&0b1001_1001110_00010_11_1000_10000_10000u32.to_le_bytes(), "{ r17:16 = memd(r2++I:circ(m1)) }");
    test_display(&0b1001_1001111_00010_11_0010_00000_10000u32.to_le_bytes(), "{ r17:16 = pmemcpy(r8, r3:2) }");
    test_display(&0b1001_1001111_00010_11_0010_00001_10000u32.to_le_bytes(), "{ r17:16 = linecpy(r8, r3:2) }");
    test_invalid(&0b1001_1001111_00010_11_0010_00010_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1001_1010001_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = membh(r2++#0xe) }");
    test_display(&0b1001_1010010_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2++#0xe) }");
    test_display(&0b1001_1010011_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = memubh(r2++#0xe) }");
    test_display(&0b1001_1010100_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2++#0x7) }");
    test_display(&0b1001_1010101_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2++#0x1c) }");
    test_display(&0b1001_1010111_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r17:16 = membh(r2++#0x1c) }");

    test_display(&0b1001_1010001_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = membh(r2=#0x23) }");
    test_display(&0b1001_1010010_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2=#0x23) }");
    test_display(&0b1001_1010011_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = memubh(r2=#0x23) }");
    test_display(&0b1001_1010100_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2=#0x23) }");
    test_display(&0b1001_1010101_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2=#0x23) }");
    test_display(&0b1001_1010111_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r17:16 = membh(r2=#0x23) }");

    test_display(&0b1001_1011000_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = memb(r2++#0x7) }");
    test_display(&0b1001_1011001_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = memub(r2++#0x7) }");
    test_display(&0b1001_1011010_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = memh(r2++#0xe) }");
    test_display(&0b1001_1011011_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = memuh(r2++#0xe) }");
    test_display(&0b1001_1011100_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r16 = memw(r2++#0x1c) }");
    test_display(&0b1001_1011110_00010_11_0000_00111_10000u32.to_le_bytes(), "{ r17:16 = memd(r2++#0x38) }");

    test_display(&0b1001_1011000_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = memb(r2=#0x23) }");
    test_display(&0b1001_1011001_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = memub(r2=#0x23) }");
    test_display(&0b1001_1011010_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = memh(r2=#0x23) }");
    test_display(&0b1001_1011011_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = memuh(r2=#0x23) }");
    test_display(&0b1001_1011100_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r16 = memw(r2=#0x23) }");
    test_display(&0b1001_1011110_00010_11_0110_00011_10000u32.to_le_bytes(), "{ r17:16 = memd(r2=#0x23) }");

    test_display(&0b1001_1011000_00010_11_1001_00011_10000u32.to_le_bytes(), "{ if (p2) r16 = memb(r2++#0x3) }");
    test_display(&0b1001_1011000_00010_11_1011_00011_10000u32.to_le_bytes(), "{ if (!p2) r16 = memb(r2++#0x3) }");
    test_display(&0b1001_1011000_00010_11_1101_00011_10000u32.to_le_bytes(), "{ if (p2.new) r16 = memb(r2++#0x3) }");
    test_display(&0b1001_1011000_00010_11_1111_00011_10000u32.to_le_bytes(), "{ if (!p2.new) r16 = memb(r2++#0x3) }");
    test_display(&0b1001_1011011_00010_11_1001_00011_10000u32.to_le_bytes(), "{ if (p2) r16 = memuh(r2++#0x6) }");
    test_display(&0b1001_1011011_00010_11_1011_00011_10000u32.to_le_bytes(), "{ if (!p2) r16 = memuh(r2++#0x6) }");
    test_display(&0b1001_1011011_00010_11_1101_00011_10000u32.to_le_bytes(), "{ if (p2.new) r16 = memuh(r2++#0x6) }");
    test_display(&0b1001_1011011_00010_11_1111_00011_10000u32.to_le_bytes(), "{ if (!p2.new) r16 = memuh(r2++#0x6) }");
    test_display(&0b1001_1011110_00010_11_1001_00011_10000u32.to_le_bytes(), "{ if (p2) r17:16 = memd(r2++#0x18) }");
    test_display(&0b1001_1011110_00010_11_1011_00011_10000u32.to_le_bytes(), "{ if (!p2) r17:16 = memd(r2++#0x18) }");
    test_display(&0b1001_1011110_00010_11_1101_00011_10000u32.to_le_bytes(), "{ if (p2.new) r17:16 = memd(r2++#0x18) }");
    test_display(&0b1001_1011110_00010_11_1111_00011_10000u32.to_le_bytes(), "{ if (!p2.new) r17:16 = memd(r2++#0x18) }");

    // 1001_1100
    test_display(&0b1001_1100001_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = membh(r2++m1) }");
    test_display(&0b1001_1100010_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2++m1) }");
    test_display(&0b1001_1100011_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = memubh(r2++m1) }");
    test_display(&0b1001_1100100_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2++m1) }");
    test_display(&0b1001_1100101_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2++m1) }");
    test_display(&0b1001_1100111_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r17:16 = membh(r2++m1) }");

    test_display(&0b1001_1100001_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = membh(r2<<1 + 0x23) }");
    test_display(&0b1001_1100010_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2<<1 + 0x23) }");
    test_display(&0b1001_1100011_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = memubh(r2<<1 + 0x23) }");
    test_display(&0b1001_1100100_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2<<1 + 0x23) }");
    test_display(&0b1001_1100101_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2<<1 + 0x23) }");
    test_display(&0b1001_1100111_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r17:16 = membh(r2<<1 + 0x23) }");

    // 1001_1101
    test_display(&0b1001_1101000_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = memb(r2++m1) }");
    test_display(&0b1001_1101001_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = memub(r2++m1) }");
    test_display(&0b1001_1101010_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = memh(r2++m1) }");
    test_display(&0b1001_1101011_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = memuh(r2++m1) }");
    test_display(&0b1001_1101100_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r16 = memw(r2++m1) }");
    test_invalid(&0b1001_1101101_00010_11_1000_00000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_1101110_00010_11_1000_00000_10000u32.to_le_bytes(), "{ r17:16 = memd(r2++m1) }");
    test_invalid(&0b1001_1101111_00010_11_1000_00000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1001_1101000_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = memb(r2<<1 + 0x23) }");
    test_display(&0b1001_1101001_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = memub(r2<<1 + 0x23) }");
    test_display(&0b1001_1101010_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = memh(r2<<1 + 0x23) }");
    test_display(&0b1001_1101011_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = memuh(r2<<1 + 0x23) }");
    test_display(&0b1001_1101100_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r16 = memw(r2<<1 + 0x23) }");
    test_invalid(&0b1001_1101101_00010_11_0110_00111_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_1101110_00010_11_0110_00111_10000u32.to_le_bytes(), "{ r17:16 = memd(r2<<1 + 0x23) }");
    test_invalid(&0b1001_1101111_00010_11_0110_00111_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    // skipped forward to 1001_1110
    test_invalid(&0b1001_1110000_00010_11_1001_01000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_1110001_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = membh(r2++m1:brev) }");
    test_display(&0b1001_1110010_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r17:16 = memh_fifo(r2++m1:brev) }");
    test_display(&0b1001_1110011_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = memubh(r2++m1:brev) }");
    test_display(&0b1001_1110100_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r17:16 = memb_fifo(r2++m1:brev) }");
    test_display(&0b1001_1110101_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r17:16 = memubh(r2++m1:brev) }");
    test_invalid(&0b1001_1110110_00010_11_1001_01000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_1110111_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r17:16 = membh(r2++m1:brev) }");

    test_invalid(&0b1001_1110000_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110001_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110010_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110011_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110100_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110101_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110110_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1001_1110111_00010_11_1001_01100_10000u32.to_le_bytes(), DecodeError::InvalidOperand);

    test_display(&0b1001_1111000_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = memb(r2++m1:brev) }");
    test_display(&0b1001_1111001_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = memub(r2++m1:brev) }");
    test_display(&0b1001_1111010_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = memh(r2++m1:brev) }");
    test_display(&0b1001_1111011_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = memuh(r2++m1:brev) }");
    test_display(&0b1001_1111100_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r16 = memw(r2++m1:brev) }");
    test_invalid(&0b1001_1111101_00010_11_1001_01000_10000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1001_1111110_00010_11_1001_01000_10000u32.to_le_bytes(), "{ r17:16 = memd(r2++m1:brev) }");

    test_display(&0b1001_1111000_00010_11_1001_01100_10000u32.to_le_bytes(), "{ if (p2) r16 = memb(#5) }");
    test_display(&0b1001_1111000_00010_11_1011_01100_10000u32.to_le_bytes(), "{ if (!p2) r16 = memb(#5) }");
    test_display(&0b1001_1111000_00010_11_1101_01100_10000u32.to_le_bytes(), "{ if (p2.new) r16 = memb(#5) }");
    test_display(&0b1001_1111000_00010_11_1111_01100_10000u32.to_le_bytes(), "{ if (!p2.new) r16 = memb(#5) }");
    test_display(&0b1001_1111011_00010_11_1001_01100_10000u32.to_le_bytes(), "{ if (p2) r16 = memuh(#5) }");
    test_display(&0b1001_1111011_00010_11_1011_01100_10000u32.to_le_bytes(), "{ if (!p2) r16 = memuh(#5) }");
    test_display(&0b1001_1111011_00010_11_1101_01100_10000u32.to_le_bytes(), "{ if (p2.new) r16 = memuh(#5) }");
    test_display(&0b1001_1111011_00010_11_1111_01100_10000u32.to_le_bytes(), "{ if (!p2.new) r16 = memuh(#5) }");
    test_display(&0b1001_1111110_00010_11_1001_01100_10000u32.to_le_bytes(), "{ if (p2) r17:16 = memd(#5) }");
    test_display(&0b1001_1111110_00010_11_1011_01100_10000u32.to_le_bytes(), "{ if (!p2) r17:16 = memd(#5) }");
    test_display(&0b1001_1111110_00010_11_1101_01100_10000u32.to_le_bytes(), "{ if (p2.new) r17:16 = memd(#5) }");
    test_display(&0b1001_1111110_00010_11_1111_01100_10000u32.to_le_bytes(), "{ if (!p2.new) r17:16 = memd(#5) }");
}

#[test]
fn inst_1010() {
    test_display(&0b1010_0000000_00010_11_0_00100_000_00011u32.to_le_bytes(), "{ dccleana(r2) }");
    test_display(&0b1010_0000001_00010_11_0_00100_000_00011u32.to_le_bytes(), "{ dcinva(r2) }");
    test_display(&0b1010_0000010_00010_11_0_00100_000_00011u32.to_le_bytes(), "{ dccleaninva(r2) }");
    test_invalid(&0b1010_0000011_00010_11_0_00100_000_00011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_0000011_00010_11_0_00100_000_01111u32.to_le_bytes(), "{ release(r2):at }");
    test_display(&0b1010_0000011_00010_11_0_00100_001_01111u32.to_le_bytes(), "{ release(r2):st }");
    test_display(&0b1010_0000100_00010_11_0_00000_001_01111u32.to_le_bytes(), "{ allocframe(r2, #0x178):raw }");
    test_invalid(&0b1010_0000100_00010_11_0_01000_001_01111u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_display(&0b1010_0000101_00010_11_0_00100_000_00011u32.to_le_bytes(), "{ memw_locked(r2, p3) = r4 }");
    test_invalid(&0b1010_0000101_00010_11_0_00100_000_00111u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_0000101_00010_11_0_00100_000_01011u32.to_le_bytes(), "{ memw_rl(r2):at = r4 }");
    test_display(&0b1010_0000101_00010_11_0_00100_001_01011u32.to_le_bytes(), "{ memw_rl(r2):st = r4 }");
    test_display(&0b1010_0000110_00010_11_0_00000_001_01111u32.to_le_bytes(), "{ dczeroa(r2) }");
    test_invalid(&0b1010_0000110_00010_11_1_00000_001_01111u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_0000111_00010_11_0_00100_000_00011u32.to_le_bytes(), "{ memd_locked(r2, p3) = r5:4 }");
    test_invalid(&0b1010_0000111_00010_11_0_00100_000_00111u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_0000111_00010_11_0_00100_000_01011u32.to_le_bytes(), "{ memd_rl(r2):at = r5:4 }");
    test_display(&0b1010_0000111_00010_11_0_00100_001_01011u32.to_le_bytes(), "{ memd_rl(r2):st = r5:4 }");
    test_display(&0b1010_0010000_00010_11_0_00100_001_01011u32.to_le_bytes(), "{ dckill }");
    test_display(&0b1010_0110000_00010_11_0_00100_000_01011u32.to_le_bytes(), "{ l2fetch(r2, r4) }");
    test_invalid(&0b1010_0110000_00010_11_0_00100_001_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_0110100_00010_11_0_00100_000_01011u32.to_le_bytes(), "{ l2fetch(r2, r5:4) }");
    test_display(&0b1010_0110101_00010_11_0_00100_000_01011u32.to_le_bytes(), "{ l2gclean(r5:4) }");
    test_display(&0b1010_0110110_00010_11_0_00100_000_01011u32.to_le_bytes(), "{ l2gcleaninv(r5:4) }");
    test_display(&0b1010_1000001_00010_11_0_00000_000_01011u32.to_le_bytes(), "{ l2kill }");
    test_display(&0b1010_1000001_00010_11_0_01000_000_01011u32.to_le_bytes(), "{ l2gunlock }");
    test_display(&0b1010_1000001_00010_11_0_10000_000_01011u32.to_le_bytes(), "{ l2gclean }");
    test_display(&0b1010_1000001_00010_11_0_11000_000_01011u32.to_le_bytes(), "{ l2gcleaninv }");

    test_display(&0b1010_0101000_00010_11_1_00100_000_01011u32.to_le_bytes(), "{ memb(r2+#1291) = r4 }");
    test_display(&0b1010_0101010_00010_11_1_00100_000_01011u32.to_le_bytes(), "{ memh(r2+#2582) = r4 }");
    test_display(&0b1010_0101011_00010_11_1_00100_000_01011u32.to_le_bytes(), "{ memh(r2+#2582) = r4.h }");
    test_display(&0b1010_0101100_00010_11_1_00100_000_01011u32.to_le_bytes(), "{ memw(r2+#5164) = r4 }");
    test_display(&0b1010_0101101_00010_11_1_00100_000_01011u32.to_le_bytes(), "{ memb(r2+#1291) = r4.new }");
    test_display(&0b1010_0101101_00010_11_1_01100_000_01011u32.to_le_bytes(), "{ memh(r2+#2582) = r4.new }");
    test_display(&0b1010_0101101_00010_11_1_10100_000_01011u32.to_le_bytes(), "{ memw(r2+#5164) = r4.new }");
    test_invalid(&0b1010_0101101_00010_11_1_11100_000_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_0101110_00010_11_1_00100_000_01011u32.to_le_bytes(), "{ memd(r2+#10328) = r5:4 }");
    test_invalid(&0b1010_0101111_00010_11_1_11100_000_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1000000_00010_11_1_00000_000_01011u32.to_le_bytes(), "{ barrier }");
    test_display(&0b1010_1000000_00010_11_1_00000_111_01011u32.to_le_bytes(), "{ r11 = dmsyncht }");
    test_invalid(&0b1010_1000000_00010_11_1_00000_001_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1000000_00010_11_1_00000_010_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1000000_00010_11_1_00000_100_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1000010_00010_11_1_00000_111_01011u32.to_le_bytes(), "{ syncht }");

    test_display(&0b1010_1001000_00010_11_1_00011_000_00010u32.to_le_bytes(), "{ memb(r2++I:circ(m1)) = r3 }");
    test_invalid(&0b1010_1001001_00010_11_1_00011_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1001010_00010_11_1_00011_000_00010u32.to_le_bytes(), "{ memh(r2++I:circ(m1)) = r3 }");
    test_display(&0b1010_1001011_00010_11_1_00011_000_00010u32.to_le_bytes(), "{ memh(r2++I:circ(m1)) = r3.h }");
    test_display(&0b1010_1001100_00010_11_1_00011_000_00010u32.to_le_bytes(), "{ memw(r2++I:circ(m1)) = r3 }");
    test_display(&0b1010_1001101_00010_11_1_00011_000_00010u32.to_le_bytes(), "{ memb(r2++I:circ(m1)) = r3.new }");
    test_display(&0b1010_1001101_00010_11_1_01011_000_00010u32.to_le_bytes(), "{ memh(r2++I:circ(m1)) = r3.new }");
    test_display(&0b1010_1001101_00010_11_1_10011_000_00010u32.to_le_bytes(), "{ memw(r2++I:circ(m1)) = r3.new }");
    test_display(&0b1010_1001101_00010_11_0_10011_000_00010u32.to_le_bytes(), "{ memw(r2++I:circ(m0)) = r3.new }");
    test_invalid(&0b1010_1001101_00010_11_1_11011_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1001110_00010_11_1_00100_000_00010u32.to_le_bytes(), "{ memd(r2++I:circ(m1)) = r5:4 }");
    test_invalid(&0b1010_1001111_00010_11_1_00100_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1001000_00010_11_1_00011_010_01000u32.to_le_bytes(), "{ memb(r2++#0x9:circ(m1)) = r3 }");
    test_invalid(&0b1010_1001001_00010_11_1_00011_010_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1001010_00010_11_1_00011_010_01000u32.to_le_bytes(), "{ memh(r2++#0x12:circ(m1)) = r3 }");
    test_display(&0b1010_1001011_00010_11_1_00011_010_01000u32.to_le_bytes(), "{ memh(r2++#0x12:circ(m1)) = r3.h }");
    test_display(&0b1010_1001100_00010_11_1_00011_010_01000u32.to_le_bytes(), "{ memw(r2++#0x24:circ(m1)) = r3 }");
    test_display(&0b1010_1001101_00010_11_1_00011_010_01000u32.to_le_bytes(), "{ memb(r2++#0x9:circ(m1)) = r3.new }");
    test_display(&0b1010_1001101_00010_11_1_01011_010_01000u32.to_le_bytes(), "{ memh(r2++#0x12:circ(m1)) = r3.new }");
    test_display(&0b1010_1001101_00010_11_1_10011_010_01000u32.to_le_bytes(), "{ memw(r2++#0x24:circ(m1)) = r3.new }");
    test_display(&0b1010_1001101_00010_11_0_10011_010_01000u32.to_le_bytes(), "{ memw(r2++#0x24:circ(m0)) = r3.new }");
    test_invalid(&0b1010_1001101_00010_11_1_11011_010_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1001110_00010_11_1_00100_010_01000u32.to_le_bytes(), "{ memd(r2++#0x48:circ(m1)) = r5:4 }");
    test_invalid(&0b1010_1001111_00010_11_1_00100_010_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1011000_00010_11_0_00011_010_01000u32.to_le_bytes(), "{ memb(r2+#9) = r3 }");
    test_invalid(&0b1010_1011001_00010_11_0_00011_010_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1011010_00010_11_0_00011_010_01000u32.to_le_bytes(), "{ memh(r2+#18) = r3 }");
    test_display(&0b1010_1011011_00010_11_0_00011_010_01000u32.to_le_bytes(), "{ memh(r2+#18) = r3.h }");
    test_display(&0b1010_1011100_00010_11_0_00011_010_01000u32.to_le_bytes(), "{ memw(r2+#36) = r3 }");
    test_display(&0b1010_1011101_00010_11_0_00011_010_01000u32.to_le_bytes(), "{ memb(r2+#9) = r3.new }");
    test_display(&0b1010_1011101_00010_11_0_01011_010_01000u32.to_le_bytes(), "{ memh(r2+#18) = r3.new }");
    test_display(&0b1010_1011101_00010_11_0_10011_010_01000u32.to_le_bytes(), "{ memw(r2+#36) = r3.new }");
    test_display(&0b1010_1011101_00010_11_0_10011_010_01000u32.to_le_bytes(), "{ memw(r2+#36) = r3.new }");
    test_invalid(&0b1010_1011101_00010_11_0_11011_010_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1011110_00010_11_0_00100_010_01000u32.to_le_bytes(), "{ memd(r2+#72) = r5:4 }");
    test_invalid(&0b1010_1011111_00010_11_0_00100_010_01000u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1011000_00010_11_0_00011_101_01001u32.to_le_bytes(), "{ memb(r2=#0x29) = r3 }");
    test_invalid(&0b1010_1011001_00010_11_0_00011_101_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1011010_00010_11_0_00011_101_01001u32.to_le_bytes(), "{ memh(r2=#0x29) = r3 }");
    test_display(&0b1010_1011011_00010_11_0_00011_101_01001u32.to_le_bytes(), "{ memh(r2=#0x29) = r3.h }");
    test_display(&0b1010_1011100_00010_11_0_00011_101_01001u32.to_le_bytes(), "{ memw(r2=#0x29) = r3 }");
    test_display(&0b1010_1011101_00010_11_0_00011_101_01001u32.to_le_bytes(), "{ memb(r2=#0x29) = r3.new }");
    test_display(&0b1010_1011101_00010_11_0_01011_101_01001u32.to_le_bytes(), "{ memh(r2=#0x29) = r3.new }");
    test_display(&0b1010_1011101_00010_11_0_10011_101_01001u32.to_le_bytes(), "{ memw(r2=#0x29) = r3.new }");
    test_display(&0b1010_1011101_00010_11_0_10011_101_01001u32.to_le_bytes(), "{ memw(r2=#0x29) = r3.new }");
    test_invalid(&0b1010_1011101_00010_11_0_11011_101_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1011110_00010_11_0_00100_101_01001u32.to_le_bytes(), "{ memd(r2=#0x29) = r5:4 }");
    test_invalid(&0b1010_1011111_00010_11_0_00100_101_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1011000_00010_11_1_00100_010_01011u32.to_le_bytes(), "{ if (p3) memb(r2++#0x9) = r4 }");
    test_display(&0b1010_1011000_00010_11_1_00100_010_01111u32.to_le_bytes(), "{ if (!p3) memb(r2++#0x9) = r4 }");
    test_display(&0b1010_1011010_00010_11_1_00100_010_01011u32.to_le_bytes(), "{ if (p3) memh(r2++#0x12) = r4 }");
    test_display(&0b1010_1011010_00010_11_1_00100_010_01111u32.to_le_bytes(), "{ if (!p3) memh(r2++#0x12) = r4 }");
    test_display(&0b1010_1011011_00010_11_1_00100_010_01011u32.to_le_bytes(), "{ if (p3) memh(r2++#0x12) = r4.h }");
    test_display(&0b1010_1011011_00010_11_1_00100_010_01111u32.to_le_bytes(), "{ if (!p3) memh(r2++#0x12) = r4.h }");
    test_display(&0b1010_1011100_00010_11_1_00100_010_01011u32.to_le_bytes(), "{ if (p3) memw(r2++#0x24) = r4 }");
    test_display(&0b1010_1011100_00010_11_1_00100_010_01111u32.to_le_bytes(), "{ if (!p3) memw(r2++#0x24) = r4 }");

    test_display(&0b1010_1011000_00010_11_1_00100_110_01011u32.to_le_bytes(), "{ if (p3.new) memb(r2++#0x9) = r4 }");
    test_display(&0b1010_1011000_00010_11_1_00100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memb(r2++#0x9) = r4 }");
    test_display(&0b1010_1011010_00010_11_1_00100_110_01011u32.to_le_bytes(), "{ if (p3.new) memh(r2++#0x12) = r4 }");
    test_display(&0b1010_1011010_00010_11_1_00100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memh(r2++#0x12) = r4 }");
    test_display(&0b1010_1011011_00010_11_1_00100_110_01011u32.to_le_bytes(), "{ if (p3.new) memh(r2++#0x12) = r4.h }");
    test_display(&0b1010_1011011_00010_11_1_00100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memh(r2++#0x12) = r4.h }");
    test_display(&0b1010_1011100_00010_11_1_00100_110_01011u32.to_le_bytes(), "{ if (p3.new) memw(r2++#0x24) = r4 }");
    test_display(&0b1010_1011100_00010_11_1_00100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memw(r2++#0x24) = r4 }");

    test_display(&0b1010_1011101_00010_11_1_00100_010_01011u32.to_le_bytes(), "{ if (p3) memb(r2++#0x9) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_00100_010_01111u32.to_le_bytes(), "{ if (!p3) memb(r2++#0x9) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_00100_110_01011u32.to_le_bytes(), "{ if (p3.new) memb(r2++#0x9) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_00100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memb(r2++#0x9) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_01100_010_01011u32.to_le_bytes(), "{ if (p3) memh(r2++#0x12) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_01100_010_01111u32.to_le_bytes(), "{ if (!p3) memh(r2++#0x12) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_01100_110_01011u32.to_le_bytes(), "{ if (p3.new) memh(r2++#0x12) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_01100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memh(r2++#0x12) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_10100_010_01011u32.to_le_bytes(), "{ if (p3) memw(r2++#0x24) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_10100_010_01111u32.to_le_bytes(), "{ if (!p3) memw(r2++#0x24) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_10100_110_01011u32.to_le_bytes(), "{ if (p3.new) memw(r2++#0x24) = r4.new }");
    test_display(&0b1010_1011101_00010_11_1_10100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memw(r2++#0x24) = r4.new }");
    test_invalid(&0b1010_1011101_00010_11_1_11100_010_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1011101_00010_11_1_11100_010_01111u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1011101_00010_11_1_11100_110_01011u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1011101_00010_11_1_11100_110_01111u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1011110_00010_11_1_10100_010_01011u32.to_le_bytes(), "{ if (p3) memd(r2++#0x48) = r21:20 }");
    test_display(&0b1010_1011110_00010_11_1_10100_010_01111u32.to_le_bytes(), "{ if (!p3) memd(r2++#0x48) = r21:20 }");
    test_display(&0b1010_1011110_00010_11_1_10100_110_01011u32.to_le_bytes(), "{ if (p3.new) memd(r2++#0x48) = r21:20 }");
    test_display(&0b1010_1011110_00010_11_1_10100_110_01111u32.to_le_bytes(), "{ if (!p3.new) memd(r2++#0x48) = r21:20 }");

    test_display(&0b1010_1101000_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memb(r2++m1) = r6 }");
    test_invalid(&0b1010_1101001_00010_11_1_00110_001_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1101010_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memh(r2++m1) = r6 }");
    test_display(&0b1010_1101011_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memh(r2++m1) = r6.h }");
    test_display(&0b1010_1101100_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memw(r2++m1) = r6 }");
    test_display(&0b1010_1101101_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memb(r2++m1) = r6.new }");
    test_display(&0b1010_1101101_00010_11_1_01110_001_01001u32.to_le_bytes(), "{ memh(r2++m1) = r6.new }");
    test_display(&0b1010_1101101_00010_11_1_10110_001_01001u32.to_le_bytes(), "{ memw(r2++m1) = r6.new }");
    test_invalid(&0b1010_1101101_00010_11_1_11110_001_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1101110_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memd(r2++m1) = r7:6 }");
    test_invalid(&0b1010_1101111_00010_11_1_11110_001_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1101000_00010_11_1_00110_101_01001u32.to_le_bytes(), "{ memb(r2<<2 + 0x29) = r6 }");
    test_invalid(&0b1010_1101001_00010_11_1_00110_101_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1101010_00010_11_1_00110_101_01001u32.to_le_bytes(), "{ memh(r2<<2 + 0x29) = r6 }");
    test_display(&0b1010_1101011_00010_11_1_00110_101_01001u32.to_le_bytes(), "{ memh(r2<<2 + 0x29) = r6.h }");
    test_display(&0b1010_1101100_00010_11_1_00110_101_01001u32.to_le_bytes(), "{ memw(r2<<2 + 0x29) = r6 }");
    test_display(&0b1010_1101101_00010_11_1_00110_101_01001u32.to_le_bytes(), "{ memb(r2<<2 + 0x29) = r6.new }");
    test_display(&0b1010_1101101_00010_11_1_01110_101_01001u32.to_le_bytes(), "{ memh(r2<<2 + 0x29) = r6.new }");
    test_display(&0b1010_1101101_00010_11_1_10110_101_01001u32.to_le_bytes(), "{ memw(r2<<2 + 0x29) = r6.new }");
    test_invalid(&0b1010_1101101_00010_11_1_11110_101_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1101110_00010_11_1_00110_101_01001u32.to_le_bytes(), "{ memd(r2<<2 + 0x29) = r7:6 }");
    test_invalid(&0b1010_1101111_00010_11_1_11110_101_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1111000_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memb(r2++m1:brev) = r6 }");
    test_invalid(&0b1010_1111001_00010_11_1_00110_001_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1111010_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memh(r2++m1:brev) = r6 }");
    test_display(&0b1010_1111011_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memh(r2++m1:brev) = r6.h }");
    test_display(&0b1010_1111100_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memw(r2++m1:brev) = r6 }");
    test_display(&0b1010_1111101_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memb(r2++m1:brev) = r6.new }");
    test_display(&0b1010_1111101_00010_11_1_01110_001_01001u32.to_le_bytes(), "{ memh(r2++m1:brev) = r6.new }");
    test_display(&0b1010_1111101_00010_11_1_10110_001_01001u32.to_le_bytes(), "{ memw(r2++m1:brev) = r6.new }");
    test_invalid(&0b1010_1111101_00010_11_1_11110_001_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1111110_00010_11_1_00110_001_01001u32.to_le_bytes(), "{ memd(r2++m1:brev) = r7:6 }");
    test_invalid(&0b1010_1111111_00010_11_1_11110_001_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1111000_00010_11_0_00110_110_01001u32.to_le_bytes(), "{ if (p1) memb(#0x29) = r6 }");
    test_display(&0b1010_1111000_00010_11_0_00110_110_01101u32.to_le_bytes(), "{ if (!p1) memb(#0x29) = r6 }");
    test_display(&0b1010_1111000_00010_11_1_00110_110_01001u32.to_le_bytes(), "{ if (p1.new) memb(#0x29) = r6 }");
    test_display(&0b1010_1111000_00010_11_1_00110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memb(#0x29) = r6 }");
    test_invalid(&0b1010_1111001_00010_11_0_00110_110_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1111001_00010_11_0_00110_110_01101u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1111001_00010_11_1_00110_110_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1111001_00010_11_1_00110_110_01101u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1010_1111010_00010_11_0_00110_110_01001u32.to_le_bytes(), "{ if (p1) memh(#0x29) = r6 }");
    test_display(&0b1010_1111010_00010_11_0_00110_110_01101u32.to_le_bytes(), "{ if (!p1) memh(#0x29) = r6 }");
    test_display(&0b1010_1111010_00010_11_1_00110_110_01001u32.to_le_bytes(), "{ if (p1.new) memh(#0x29) = r6 }");
    test_display(&0b1010_1111010_00010_11_1_00110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memh(#0x29) = r6 }");
    test_display(&0b1010_1111011_00010_11_0_00110_110_01001u32.to_le_bytes(), "{ if (p1) memh(#0x29) = r6.h }");
    test_display(&0b1010_1111011_00010_11_0_00110_110_01101u32.to_le_bytes(), "{ if (!p1) memh(#0x29) = r6.h }");
    test_display(&0b1010_1111011_00010_11_1_00110_110_01001u32.to_le_bytes(), "{ if (p1.new) memh(#0x29) = r6.h }");
    test_display(&0b1010_1111011_00010_11_1_00110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memh(#0x29) = r6.h }");
    test_display(&0b1010_1111100_00010_11_0_00110_110_01001u32.to_le_bytes(), "{ if (p1) memw(#0x29) = r6 }");
    test_display(&0b1010_1111100_00010_11_0_00110_110_01101u32.to_le_bytes(), "{ if (!p1) memw(#0x29) = r6 }");
    test_display(&0b1010_1111100_00010_11_1_00110_110_01001u32.to_le_bytes(), "{ if (p1.new) memw(#0x29) = r6 }");
    test_display(&0b1010_1111100_00010_11_1_00110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memw(#0x29) = r6 }");

    test_display(&0b1010_1111101_00010_11_000_110_110_01001u32.to_le_bytes(), "{ if (p1) memb(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_000_110_110_01101u32.to_le_bytes(), "{ if (!p1) memb(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_001_110_110_01001u32.to_le_bytes(), "{ if (p1) memh(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_001_110_110_01101u32.to_le_bytes(), "{ if (!p1) memh(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_010_110_110_01001u32.to_le_bytes(), "{ if (p1) memw(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_010_110_110_01101u32.to_le_bytes(), "{ if (!p1) memw(#0x29) = r6.new }");
    test_invalid(&0b1010_1111101_00010_11_011_110_110_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1111101_00010_11_011_110_110_01101u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1111101_00010_11_100_110_110_01001u32.to_le_bytes(), "{ if (p1.new) memb(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_100_110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memb(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_101_110_110_01001u32.to_le_bytes(), "{ if (p1.new) memh(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_101_110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memh(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_110_110_110_01001u32.to_le_bytes(), "{ if (p1.new) memw(#0x29) = r6.new }");
    test_display(&0b1010_1111101_00010_11_110_110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memw(#0x29) = r6.new }");
    test_invalid(&0b1010_1111101_00010_11_111_110_110_01001u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1010_1111101_00010_11_111_110_110_01101u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1010_1111110_00010_11_0_00110_110_01001u32.to_le_bytes(), "{ if (p1) memd(#0x29) = r7:6 }");
    test_display(&0b1010_1111110_00010_11_0_00110_110_01101u32.to_le_bytes(), "{ if (!p1) memd(#0x29) = r7:6 }");
    test_display(&0b1010_1111110_00010_11_1_00110_110_01001u32.to_le_bytes(), "{ if (p1.new) memd(#0x29) = r7:6 }");
    test_display(&0b1010_1111110_00010_11_1_00110_110_01101u32.to_le_bytes(), "{ if (!p1.new) memd(#0x29) = r7:6 }");
}


#[test]
fn inst_1011() {
    test_display(&0b1011_1000001_00100_11_1_0_0000_001_10110u32.to_le_bytes(), "{ r22 = add(r4, #-31999) }");
}

#[test]
fn inst_1100() {
    test_display(&0b1100_0000_000_00100_11_0_1_0000_010_10110u32.to_le_bytes(), "{ r23:22 = valignb(r17:16, r5:4, #0x2) }");
    test_display(&0b1100_0000_100_00100_11_0_1_0000_010_10110u32.to_le_bytes(), "{ r23:22 = vspliceb(r5:4, r17:16, #0x2) }");
    test_display(&0b1100_0001_000_00100_11_0_1_0000_000_10110u32.to_le_bytes(), "{ r23:22 = extractu(r5:4, r17:16) }");
    test_display(&0b1100_0001_000_00100_11_0_1_0000_010_10110u32.to_le_bytes(), "{ r23:22 = shuffeb(r5:4, r17:16) }");
    test_display(&0b1100_0001_000_00100_11_0_1_0000_100_10110u32.to_le_bytes(), "{ r23:22 = shuffob(r17:16, r5:4) }");
    test_display(&0b1100_0001_000_00100_11_0_1_0000_110_10110u32.to_le_bytes(), "{ r23:22 = shuffeh(r17:16, r5:4) }");

    test_display(&0b1100_0001_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vxaddsubw(r21:20, r7:6):sat }");
    test_display(&0b1100_0001_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = vaddhub(r21:20, r7:6):sat }");
    test_display(&0b1100_0001_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vxsubaddw(r21:20, r7:6):sat }");
    test_invalid(&0b1100_0001_010_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0001_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vxaddsubh(r21:20, r7:6):sat }");
    test_invalid(&0b1100_0001_010_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0001_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vxsubaddh(r21:20, r7:6):sat }");
    test_invalid(&0b1100_0001_010_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1100_0001_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = shuffoh(r7:6, r21:20) }");
    test_invalid(&0b1100_0001_100_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0001_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vtrunewh(r21:20, r7:6) }");
    test_display(&0b1100_0001_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = vtrunehb(r21:20, r7:6) }");
    test_display(&0b1100_0001_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vtrunowh(r21:20, r7:6) }");
    test_display(&0b1100_0001_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vtrunohb(r21:20, r7:6) }");
    test_display(&0b1100_0001_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = lfs(r21:20, r7:6) }");
    test_invalid(&0b1100_0001_100_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1100_0001_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vxaddsubh(r21:20, r7:6):rnd:>>1:sat }");
    test_display(&0b1100_0001_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vxsubaddh(r21:20, r7:6):rnd:>>1:sat }");
    test_display(&0b1100_0001_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = extractu(r21:20, r7:6) }");
    test_display(&0b1100_0001_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = decbin(r21:20, r7:6) }");

    test_display(&0b1100_0010_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = valignb(r7:6, r21:20, p1) }");
    test_display(&0b1100_0010_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = valignb(r7:6, r21:20, p1) }");
    test_display(&0b1100_0010_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = valignb(r7:6, r21:20, p1) }");
    test_display(&0b1100_0010_011_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = valignb(r7:6, r21:20, p1) }");
    test_display(&0b1100_0010_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vspliceb(r21:20, r7:6, p1) }");
    test_invalid(&0b1100_0010_101_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0010_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = add(r21:20, r7:6, p1):carry }");
    test_display(&0b1100_0010_111_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = sub(r21:20, r7:6, p1):carry }");

    test_display(&0b1100_0011_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vasrw(r21:20, r6) }");
    test_display(&0b1100_0011_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vlsrw(r21:20, r6) }");
    test_display(&0b1100_0011_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vaslw(r21:20, r6) }");
    test_display(&0b1100_0011_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vlslw(r21:20, r6) }");
    test_display(&0b1100_0011_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vasrh(r21:20, r6) }");
    test_display(&0b1100_0011_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vlsrh(r21:20, r6) }");
    test_display(&0b1100_0011_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vaslh(r21:20, r6) }");
    test_display(&0b1100_0011_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vlslh(r21:20, r6) }");
    test_display(&0b1100_0011_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = asr(r21:20, r6) }");
    test_display(&0b1100_0011_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = lsr(r21:20, r6) }");
    test_display(&0b1100_0011_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = asl(r21:20, r6) }");
    test_display(&0b1100_0011_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = lsl(r21:20, r6) }");

    test_display(&0b1100_0011_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vcrotate(r21:20, r6) }");
    test_display(&0b1100_0011_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vcnegh(r21:20, r6) }");
    test_invalid(&0b1100_0011_110_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0011_110_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vrcrotate(r21:20, r6, #0x2) }");

    test_display(&0b1100_0100_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 = addasl(r6, r20, #0x3) }");
    test_invalid(&0b1100_0100_001_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0100_011_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0100_101_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0100_111_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_invalid(&0b1100_0101_000_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0101_000_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0101_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = vasrw(r20, r6) }");
    test_invalid(&0b1100_0101_000_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0101_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = cmpyiwh(r21:20, r6):<<1:rnd:sat }");
    test_display(&0b1100_0101_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 = cmpyiwh(r21:20, r6*):<<1:rnd:sat }");
    test_display(&0b1100_0101_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = cmpyrwh(r21:20, r6):<<1:rnd:sat }");
    test_display(&0b1100_0101_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = cmpyrwh(r21:20, r6*):<<1:rnd:sat }");

    test_display(&0b1100_0110_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = asr(r20, r6):sat }");
    test_invalid(&0b1100_0110_000_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0110_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = asl(r20, r6):sat }");
    test_invalid(&0b1100_0110_000_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0110_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = asr(r20, r6) }");
    test_display(&0b1100_0110_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = lsr(r20, r6) }");
    test_display(&0b1100_0110_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = asl(r20, r6) }");
    test_display(&0b1100_0110_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = lsl(r20, r6) }");

    test_invalid(&0b1100_0110_100_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0110_100_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0110_100_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0110_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = lsl(#-24, r6) }");
    test_display(&0b1100_0110_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = lsl(#-23, r6) }");

    test_display(&0b1100_0110_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cround(r20, r6) }");
    test_display(&0b1100_0110_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = cround(r21:20, r6) }");
    test_display(&0b1100_0110_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = round(r20, r6) }");
    test_display(&0b1100_0110_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = round(r20, r6):sat }");

    test_display(&0b1100_0111_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = tstbit(r20, r6) }");
    test_display(&0b1100_0111_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = !tstbit(r20, r6) }");
    test_display(&0b1100_0111_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = bitsset(r20, r6) }");
    test_display(&0b1100_0111_011_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = !bitsset(r20, r6) }");
    test_display(&0b1100_0111_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = bitsclr(r20, r6) }");
    test_display(&0b1100_0111_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = !bitsclr(r20, r6) }");
    test_invalid(&0b1100_0111_110_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0111_110_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0111_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ p2 = cmpb.gt(r20, r6) }");
    test_display(&0b1100_0111_110_10100_11_000110_011_10110u32.to_le_bytes(), "{ p2 = cmph.gt(r20, r6) }");
    test_display(&0b1100_0111_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ p2 = cmph.eq(r20, r6) }");
    test_display(&0b1100_0111_110_10100_11_000110_101_10110u32.to_le_bytes(), "{ p2 = cmph.gtu(r20, r6) }");
    test_display(&0b1100_0111_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = cmpb.eq(r20, r6) }");
    test_display(&0b1100_0111_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ p2 = cmpb.gtu(r20, r6) }");
    test_display(&0b1100_0111_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ p2 = sfcmp.ge(r20, r6) }");
    test_display(&0b1100_0111_111_10100_11_000110_001_10110u32.to_le_bytes(), "{ p2 = sfcmp.uo(r20, r6) }");
    test_invalid(&0b1100_0111_111_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_0111_111_10100_11_000110_011_10110u32.to_le_bytes(), "{ p2 = sfcmp.eq(r20, r6) }");
    test_display(&0b1100_0111_111_10100_11_000110_100_10110u32.to_le_bytes(), "{ p2 = sfcmp.gt(r20, r6) }");
    test_invalid(&0b1100_0111_111_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0111_111_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_0111_111_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1100_1000_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = insert(r20, r7:6) }");

    test_invalid(&0b1100_1001_000_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1001_010_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1001_100_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_1001_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = extractu(r20, r7:6) }");
    test_display(&0b1100_1001_111_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = extract(r20, r7:6) }");
    test_invalid(&0b1100_1001_111_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1001_111_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1100_1010_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = insert(r21:20, r7:6) }");
    test_invalid(&0b1100_1010_000_10100_11_100110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1100_1010_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 ^= xor(r21:20, r7:6) }");
    test_invalid(&0b1100_1010_100_10100_11_100110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1010_100_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1010_100_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1010_100_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1100_1010_110_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);


    test_display(&0b1100_1011_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 |= asr(r21:20, r6) }");
    test_display(&0b1100_1011_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 |= lsr(r21:20, r6) }");
    test_display(&0b1100_1011_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 |= asl(r21:20, r6) }");
    test_display(&0b1100_1011_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 |= lsl(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vrmaxh(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vrmaxw(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vrminh(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vrminw(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vrmaxuh(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vrmaxuw(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = vrminuh(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vrminuw(r21:20, r6) }");
    test_display(&0b1100_1011_001_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 += vrcnegh(r21:20, r6) }");
    test_display(&0b1100_1011_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 &= asr(r21:20, r6) }");
    test_display(&0b1100_1011_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 &= lsr(r21:20, r6) }");
    test_display(&0b1100_1011_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 &= asl(r21:20, r6) }");
    test_display(&0b1100_1011_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 &= lsl(r21:20, r6) }");
    test_display(&0b1100_1011_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= asr(r21:20, r6) }");
    test_display(&0b1100_1011_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= lsr(r21:20, r6) }");
    test_display(&0b1100_1011_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 -= asl(r21:20, r6) }");
    test_display(&0b1100_1011_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 -= lsl(r21:20, r6) }");
    test_display(&0b1100_1011_101_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 += vrcrotate(r21:20, r6, #0x2) }");
    test_display(&0b1100_1011_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += asr(r21:20, r6) }");
    test_display(&0b1100_1011_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += lsr(r21:20, r6) }");
    test_display(&0b1100_1011_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += asl(r21:20, r6) }");
    test_display(&0b1100_1011_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += lsl(r21:20, r6) }");

    test_display(&0b1100_1100_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 |= asr(r20, r6) }");
    test_display(&0b1100_1100_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 |= lsr(r20, r6) }");
    test_display(&0b1100_1100_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 |= asl(r20, r6) }");
    test_display(&0b1100_1100_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 |= lsl(r20, r6) }");
    test_display(&0b1100_1100_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 &= asr(r20, r6) }");
    test_display(&0b1100_1100_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 &= lsr(r20, r6) }");
    test_display(&0b1100_1100_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 &= asl(r20, r6) }");
    test_display(&0b1100_1100_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 &= lsl(r20, r6) }");
    test_display(&0b1100_1100_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 -= asr(r20, r6) }");
    test_display(&0b1100_1100_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 -= lsr(r20, r6) }");
    test_display(&0b1100_1100_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 -= asl(r20, r6) }");
    test_display(&0b1100_1100_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 -= lsl(r20, r6) }");
    test_display(&0b1100_1100_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 += asr(r20, r6) }");
    test_display(&0b1100_1100_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 += lsr(r20, r6) }");
    test_display(&0b1100_1100_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 += asl(r20, r6) }");
    test_display(&0b1100_1100_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 += lsl(r20, r6) }");
}

#[test]
fn inst_1101() {
    test_display(&0b1101_0000_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = parity(r21:20, r7:6) }");
    // bit 7 is `-` in the listing...
    test_display(&0b1101_0001_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vmux(p2, r21:20, r7:6) }");
    // bits 2, 3, 4 are `-` in the listing
    test_display(&0b1101_0010_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ p2 = vcmpw.eq(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ p2 = vcmpw.gt(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ p2 = vcmpw.gtu(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ p2 = vcmph.eq(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ p2 = vcmph.gt(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ p2 = vcmph.gtu(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ p2 = vcmpb.eq(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ p2 = vcmpb.gtu(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_100110_000_10110u32.to_le_bytes(), "{ p2 = any8(vcmpb.eq(r21:20, r7:6)) }");
    test_display(&0b1101_0010_000_10100_11_100110_001_10110u32.to_le_bytes(), "{ p2 = !any8(vcmpb.eq(r21:20, r7:6)) }");
    test_display(&0b1101_0010_000_10100_11_100110_010_10110u32.to_le_bytes(), "{ p2 = vcmpb.gt(r21:20, r7:6) }");
    test_display(&0b1101_0010_000_10100_11_100110_011_10110u32.to_le_bytes(), "{ p2 = tlbmatch(r21:20, r6) }");
    test_display(&0b1101_0010_000_10100_11_100110_100_10110u32.to_le_bytes(), "{ p2 = boundscheck(r21:20, r7:6):raw:lo }");
    test_display(&0b1101_0010_000_10100_11_100110_101_10110u32.to_le_bytes(), "{ p2 = boundscheck(r21:20, r7:6):raw:hi }");

    test_display(&0b1101_0010_100_10100_11_100110_000_10110u32.to_le_bytes(), "{ p2 = cmp.gt(r21:20, r7:6) }");
    test_display(&0b1101_0010_100_10100_11_100110_010_10110u32.to_le_bytes(), "{ p2 = cmp.eq(r21:20, r7:6) }");
    test_display(&0b1101_0010_100_10100_11_100110_100_10110u32.to_le_bytes(), "{ p2 = cmp.gtu(r21:20, r7:6) }");

    test_display(&0b1101_0011_000_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vaddub(r21:20, r7:6) }");
    test_display(&0b1101_0011_000_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vaddub(r21:20, r7:6):sat }");
    test_display(&0b1101_0011_000_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vaddh(r21:20, r7:6) }");
    test_display(&0b1101_0011_000_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vaddh(r21:20, r7:6):sat }");
    test_display(&0b1101_0011_000_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = vadduh(r21:20, r7:6):sat }");
    test_display(&0b1101_0011_000_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = vaddw(r21:20, r7:6) }");
    test_display(&0b1101_0011_000_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vaddw(r21:20, r7:6):sat }");
    test_display(&0b1101_0011_000_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 = add(r21:20, r7:6) }");
    test_display(&0b1101_0011_001_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vsubub(r7:6, r21:20) }");
    test_display(&0b1101_0011_001_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vsubub(r7:6, r21:20):sat }");
    test_display(&0b1101_0011_001_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vsubh(r7:6, r21:20) }");
    test_display(&0b1101_0011_001_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vsubh(r7:6, r21:20):sat }");
    test_display(&0b1101_0011_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = vsubuh(r7:6, r21:20):sat }");
    test_display(&0b1101_0011_001_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = vsubw(r7:6, r21:20) }");
    test_display(&0b1101_0011_001_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vsubw(r7:6, r21:20):sat }");
    test_display(&0b1101_0011_001_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 = sub(r7:6, r21:20) }");

    test_display(&0b1101_0011_010_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vavgub(r21:20, r7:6) }");
    test_display(&0b1101_0011_010_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vavgub(r21:20, r7:6):rnd }");
    test_display(&0b1101_0011_010_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vavgh(r21:20, r7:6) }");
    test_display(&0b1101_0011_010_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vavgh(r21:20, r7:6):rnd }");
    test_display(&0b1101_0011_010_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = vavgh(r21:20, r7:6):crnd }");
    test_display(&0b1101_0011_010_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = vavguh(r21:20, r7:6) }");
    test_display(&0b1101_0011_010_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vavguh(r21:20, r7:6):rnd }");

    test_display(&0b1101_0011_011_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vavgw(r21:20, r7:6) }");
    test_display(&0b1101_0011_011_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vavgw(r21:20, r7:6):rnd }");
    test_display(&0b1101_0011_011_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vavgw(r21:20, r7:6):crnd }");
    test_display(&0b1101_0011_011_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vavguw(r21:20, r7:6) }");
    test_display(&0b1101_0011_011_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = vavguw(r21:20, r7:6):rnd }");
    test_display(&0b1101_0011_011_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = add(r21:20, r7:6):sat }");
    test_display(&0b1101_0011_011_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = add(r21:20, r7:6):raw:lo }");
    test_display(&0b1101_0011_011_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 = add(r21:20, r7:6):raw:hi }");

    test_display(&0b1101_0011_100_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vnavgh(r7:6, r21:20) }");
    test_display(&0b1101_0011_100_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vnavgh(r7:6, r21:20):rnd:sat }");
    test_display(&0b1101_0011_100_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vnavgh(r7:6, r21:20):crnd:sat }");
    test_display(&0b1101_0011_100_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vnavgw(r7:6, r21:20) }");
    test_display(&0b1101_0011_100_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = vnavgw(r7:6, r21:20):rnd:sat }");
    test_display(&0b1101_0011_100_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = vnavgw(r7:6, r21:20):rnd:sat }");
    test_display(&0b1101_0011_100_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vnavgw(r7:6, r21:20):crnd:sat }");
    test_display(&0b1101_0011_100_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 = vnavgw(r7:6, r21:20):crnd:sat }");

    test_display(&0b1101_0011_101_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vminub(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vminh(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vminuh(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vminw(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = vminuw(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = vmaxuw(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = min(r7:6, r21:20) }");
    test_display(&0b1101_0011_101_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 = minu(r7:6, r21:20) }");

    test_display(&0b1101_0011_110_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = vmaxub(r7:6, r21:20) }");
    test_display(&0b1101_0011_110_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = vmaxh(r7:6, r21:20) }");
    test_display(&0b1101_0011_110_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = vmaxuh(r7:6, r21:20) }");
    test_display(&0b1101_0011_110_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = vmaxw(r7:6, r21:20) }");
    test_display(&0b1101_0011_110_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = max(r21:20, r7:6) }");
    test_display(&0b1101_0011_110_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = maxu(r21:20, r7:6) }");
    test_display(&0b1101_0011_110_10100_11_100110_110_10110u32.to_le_bytes(), "{ r23:22 = vmaxb(r7:6, r21:20) }");
    test_display(&0b1101_0011_110_10100_11_100110_111_10110u32.to_le_bytes(), "{ r23:22 = vminb(r7:6, r21:20) }");

    test_display(&0b1101_0011_111_10100_11_100110_000_10110u32.to_le_bytes(), "{ r23:22 = and(r21:20, r7:6) }");
    test_display(&0b1101_0011_111_10100_11_100110_001_10110u32.to_le_bytes(), "{ r23:22 = and(r21:20, ~r7:6) }");
    test_display(&0b1101_0011_111_10100_11_100110_010_10110u32.to_le_bytes(), "{ r23:22 = or(r21:20, r7:6) }");
    test_display(&0b1101_0011_111_10100_11_100110_011_10110u32.to_le_bytes(), "{ r23:22 = or(r21:20, ~r7:6) }");
    test_display(&0b1101_0011_111_10100_11_100110_100_10110u32.to_le_bytes(), "{ r23:22 = xor(r21:20, r7:6) }");
    test_invalid(&0b1101_0011_111_10100_11_100110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1101_0011_111_10100_11_100110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1101_0011_111_10100_11_100110_111_10110u32.to_le_bytes(), "{ r22 = modwrap(r20, r6) }");

    test_invalid(&0b1101_0100_000_10100_11_100110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1101_0100_001_10100_11_100110_101_10110u32.to_le_bytes(), "{ r23:22 = bitsplit(r20, r6) }");

    test_display(&0b1101_0101_000_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.l) }");
    test_display(&0b1101_0101_000_10100_11_100110_010_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.h) }");
    test_display(&0b1101_0101_000_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.l):sat }");
    test_display(&0b1101_0101_000_10100_11_100110_110_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.h):sat }");
    test_display(&0b1101_0101_001_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = sub(r6.l, r20.l) }");
    test_display(&0b1101_0101_001_10100_11_100110_010_10110u32.to_le_bytes(), "{ r22 = sub(r6.l, r20.h) }");
    test_display(&0b1101_0101_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = sub(r6.l, r20.l):sat }");
    test_display(&0b1101_0101_001_10100_11_100110_110_10110u32.to_le_bytes(), "{ r22 = sub(r6.l, r20.h):sat }");
    test_display(&0b1101_0101_010_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.l):<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_001_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.h):<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_010_10110u32.to_le_bytes(), "{ r22 = add(r6.h, r20.l):<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_011_10110u32.to_le_bytes(), "{ r22 = add(r6.h, r20.h):<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.l):sat:<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_101_10110u32.to_le_bytes(), "{ r22 = add(r6.l, r20.h):sat:<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_110_10110u32.to_le_bytes(), "{ r22 = add(r6.h, r20.l):sat:<<16 }");
    test_display(&0b1101_0101_010_10100_11_100110_111_10110u32.to_le_bytes(), "{ r22 = add(r6.h, r20.h):sat:<<16 }");

    test_display(&0b1101_0101_100_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = add(r20, r6):sat:deprecated }");
    test_display(&0b1101_0101_100_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = sub(r6, r20):sat:deprecated }");
    test_display(&0b1101_0101_101_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = min(r20, r6) }");
    test_display(&0b1101_0101_101_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = minu(r20, r6) }");
    test_display(&0b1101_0101_110_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = max(r20, r6) }");
    test_display(&0b1101_0101_110_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = maxu(r20, r6) }");
    test_display(&0b1101_0101_111_10100_11_100110_000_10110u32.to_le_bytes(), "{ r22 = parity(r20, r6) }");
    test_display(&0b1101_0101_111_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = parity(r20, r6) }");

    test_display(&0b1101_0110_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = sfmake(#0x334):pos }");
    test_display(&0b1101_0110_011_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = sfmake(#0x334):neg }");
    test_display(&0b1101_0110_111_10100_11_100110_000_10110u32.to_le_bytes(), "{ p2 = dfcmp.eq(r21:20, r7:6) }");
    test_display(&0b1101_0110_111_10100_11_100110_001_10110u32.to_le_bytes(), "{ p2 = dfcmp.gt(r21:20, r7:6) }");
    test_display(&0b1101_0110_111_10100_11_100110_011_10110u32.to_le_bytes(), "{ p2 = dfcmp.ge(r21:20, r7:6) }");
    test_display(&0b1101_0110_111_10100_11_100110_100_10110u32.to_le_bytes(), "{ p2 = dfcmp.uo(r21:20, r7:6) }");

    test_display(&0b1101_0111_010_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = add(#0x2c, mpyi(r20, r6)) }");
    test_invalid(&0b1101_0111_110_10100_11_100110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1101_1000_110_10100_11_100110_100_10110u32.to_le_bytes(), "{ r6 = add(#0x2c, mpyi(r20, #0x36)) }");

    test_display(&0b1101_1001_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = dfmake(#0x334):pos }");
    test_display(&0b1101_1001_011_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 = dfmake(#0x334):neg }");
    test_invalid(&0b1101_1001_101_10100_11_100110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1101_1001_111_10100_11_100110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1101_1010_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 |= and(r20, #-204) }");
    test_display(&0b1101_1010_011_10100_11_100110_100_10110u32.to_le_bytes(), "{ r20 = or(r22, and(r20, #-204)) }");
    test_display(&0b1101_1010_101_10100_11_100110_100_10110u32.to_le_bytes(), "{ r22 |= or(r20, #-204) }");
    test_invalid(&0b1101_1010_111_10100_11_100110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1101_1011_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ r6 = add(r20, add(r22, #28)) }");
    test_display(&0b1101_1011_101_10100_11_100110_100_10110u32.to_le_bytes(), "{ r6 = add(r20, sub(#28, r22)) }");

    test_display(&0b1101_1100_000_10100_11_100110_100_00110u32.to_le_bytes(), "{ p2 = vcmpb.eq(r21:20, #0x34) }");
    test_display(&0b1101_1100_000_10100_11_100110_100_01110u32.to_le_bytes(), "{ p2 = vcmph.eq(r21:20, #0x34) }");
    test_display(&0b1101_1100_000_10100_11_100110_100_10110u32.to_le_bytes(), "{ p2 = vcmpw.eq(r21:20, #0x34) }");
    test_invalid(&0b1101_1100_000_10100_11_100110_100_11110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1101_1100_001_10100_11_100110_100_00110u32.to_le_bytes(), "{ p2 = vcmpb.gt(r21:20, #0x34) }");
    test_display(&0b1101_1100_001_10100_11_100110_100_01110u32.to_le_bytes(), "{ p2 = vcmph.gt(r21:20, #0x34) }");
    test_display(&0b1101_1100_001_10100_11_100110_100_10110u32.to_le_bytes(), "{ p2 = vcmpw.gt(r21:20, #0x34) }");
    test_invalid(&0b1101_1100_001_10100_11_100110_100_11110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1101_1100_010_10100_11_100110_100_00110u32.to_le_bytes(), "{ p2 = vcmpb.gtu(r21:20, #0x34) }");
    test_display(&0b1101_1100_010_10100_11_100110_100_01110u32.to_le_bytes(), "{ p2 = vcmph.gtu(r21:20, #0x34) }");
    test_display(&0b1101_1100_010_10100_11_100110_100_10110u32.to_le_bytes(), "{ p2 = vcmpw.gtu(r21:20, #0x34) }");
    test_invalid(&0b1101_1100_010_10100_11_100110_100_11110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    // top bit of the immediate must be 0
    test_invalid(&0b1101_1100_010_10100_11_110110_100_00110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1101_1100_010_10100_11_110110_100_01110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1101_1100_010_10100_11_110110_100_10110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1101_1100_010_10100_11_110110_100_11110u32.to_le_bytes(), DecodeError::InvalidOperand);

    test_display(&0b1101_1100_100_10100_11_100010_100_10110u32.to_le_bytes(), "{ p2 = dfclass(r21:20, #0x14) }");

    test_display(&0b1101_1101_000_10100_11_100110_100_00110u32.to_le_bytes(), "{ p2 = cmpb.gt(r20, #0x34) }");
    test_display(&0b1101_1101_000_10100_11_100110_100_01110u32.to_le_bytes(), "{ p2 = cmph.gt(r20, #0x34) }");
    test_display(&0b1101_1101_001_10100_11_100110_100_00110u32.to_le_bytes(), "{ p2 = cmpb.eq(r20, #0x34) }");
    test_display(&0b1101_1101_001_10100_11_100110_100_01110u32.to_le_bytes(), "{ p2 = cmph.eq(r20, #0x34) }");
    test_display(&0b1101_1101_010_10100_11_100110_100_00110u32.to_le_bytes(), "{ p2 = cmpb.gtu(r20, #0x34) }");
    test_display(&0b1101_1101_010_10100_11_100110_100_01110u32.to_le_bytes(), "{ p2 = cmph.gtu(r20, #0x34) }");
    test_invalid(&0b1101_1101_010_10100_11_110110_100_00110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1101_1101_010_10100_11_110110_100_01110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_invalid(&0b1101_1101_011_10100_11_110110_100_00110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1101_1101_011_10100_11_110110_100_01110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1101_1110_010_10100_11_100110_100_00000u32.to_le_bytes(), "{ r20 = and(#0x98, asl(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_00010u32.to_le_bytes(), "{ r20 = or(#0x98, asl(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_00100u32.to_le_bytes(), "{ r20 = add(#0x98, asl(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_00110u32.to_le_bytes(), "{ r20 = sub(#0x98, asl(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_10000u32.to_le_bytes(), "{ r20 = and(#0x98, lsr(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_10010u32.to_le_bytes(), "{ r20 = or(#0x98, lsr(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_10100u32.to_le_bytes(), "{ r20 = add(#0x98, lsr(r20, #0x6)) }");
    test_display(&0b1101_1110_010_10100_11_100110_100_10110u32.to_le_bytes(), "{ r20 = sub(#0x98, lsr(r20, #0x6)) }");

    test_display(&0b1101_1111_010_10100_11_100110_100_10110u32.to_le_bytes(), "{ r6 = add(r22, mpyi(#0xb0, r20)) }");
    test_display(&0b1101_1111_110_10100_11_100110_100_10110u32.to_le_bytes(), "{ r6 = add(r22, mpyi(r20, #0xb0)) }");
}

#[test]
fn inst_1110() {
    test_display(&0b1110_0000_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = +mpyi(r20, #0x34) }");
    test_display(&0b1110_0000_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = -mpyi(r20, #0x34) }");
    test_display(&0b1110_0001_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 += mpyi(r20, #0x34) }");
    test_display(&0b1110_0001_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 -= mpyi(r20, #0x34) }");
    test_display(&0b1110_0010_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 += add(r20, #52) }");
    test_display(&0b1110_0010_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 -= add(r20, #52) }");
    test_display(&0b1110_0011_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r6 = add(r22, mpyi(r6, r20)) }");

    test_display(&0b1110_0100_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.l) }");
    test_display(&0b1110_0100_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.l):<<1 }");
    test_display(&0b1110_0100_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.h) }");
    test_display(&0b1110_0100_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.h):<<1 }");
    test_display(&0b1110_0100_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.l) }");
    test_display(&0b1110_0100_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.l):<<1 }");
    test_display(&0b1110_0100_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.h) }");
    test_display(&0b1110_0100_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.h):<<1 }");

    test_display(&0b1110_0100_001_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.l):rnd }");
    test_display(&0b1110_0100_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.l):<<1:rnd }");
    test_display(&0b1110_0100_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.h):rnd }");
    test_display(&0b1110_0100_101_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.l, r6.h):<<1:rnd }");
    test_display(&0b1110_0100_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.l):rnd }");
    test_display(&0b1110_0100_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.l):<<1:rnd }");
    test_display(&0b1110_0100_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.h):rnd }");
    test_display(&0b1110_0100_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20.h, r6.h):<<1:rnd }");

    test_display(&0b1110_0100_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.l, r6.l) }");
    test_display(&0b1110_0100_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.l, r6.l):<<1 }");
    test_display(&0b1110_0100_010_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.l, r6.h) }");
    test_display(&0b1110_0100_110_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.l, r6.h):<<1 }");
    test_display(&0b1110_0100_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.h, r6.l) }");
    test_display(&0b1110_0100_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.h, r6.l):<<1 }");
    test_display(&0b1110_0100_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.h, r6.h) }");
    test_display(&0b1110_0100_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20.h, r6.h):<<1 }");

    test_invalid(&0b1110_0100_011_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_111_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_011_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_111_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_011_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_111_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_011_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_0100_111_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1110_0101_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = mpy(r20, r6) }");
    test_display(&0b1110_0101_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = cmpyi(r20, r6) }");
    test_display(&0b1110_0101_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = cmpyr(r20, r6) }");
    test_invalid(&0b1110_0101_000_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1110_0101_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = mpyu(r20, r6) }");
    test_display(&0b1110_0101_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vmpybsu(r20, r6) }");
    test_display(&0b1110_0101_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = pmpyw(r20, r6) }");

    test_display(&0b1110_0101_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vmpybu(r20, r6) }");
    test_display(&0b1110_0101_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vpmpyh(r20, r6) }");

    test_display(&0b1110_0101_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyh(r21:20, r7:6):sat }");
    test_display(&0b1110_0101_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = cmpy(r20, r6):sat }");
    test_display(&0b1110_0101_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpyhsu(r20, r6):sat }");
    test_display(&0b1110_0101_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = cmpy(r20, r6*):sat }");
    test_display(&0b1110_0101_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_0101_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = cmpy(r20, r6):<<1:sat }");
    test_display(&0b1110_0101_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpyhsu(r20, r6):<<1:sat }");
    test_display(&0b1110_0101_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = cmpy(r20, r6*):<<1:sat }");

    test_display(&0b1110_0110_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.l, r6.l) }");
    test_display(&0b1110_0110_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.l, r6.h) }");
    test_display(&0b1110_0110_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.h, r6.l) }");
    test_display(&0b1110_0110_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.h, r6.h) }");
    test_display(&0b1110_0110_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.l, r6.l) }");
    test_display(&0b1110_0110_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.l, r6.h) }");
    test_display(&0b1110_0110_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.h, r6.l) }");
    test_display(&0b1110_0110_001_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.h, r6.h) }");
    test_display(&0b1110_0110_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.l, r6.l) }");
    test_display(&0b1110_0110_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.l, r6.h) }");
    test_display(&0b1110_0110_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.h, r6.l) }");
    test_display(&0b1110_0110_010_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.h, r6.h) }");
    test_display(&0b1110_0110_011_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.l, r6.l) }");
    test_display(&0b1110_0110_011_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.l, r6.h) }");
    test_display(&0b1110_0110_011_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.h, r6.l) }");
    test_display(&0b1110_0110_011_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.h, r6.h) }");
    test_display(&0b1110_0110_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.l, r6.l):<<1 }");
    test_display(&0b1110_0110_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.l, r6.h):<<1 }");
    test_display(&0b1110_0110_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.h, r6.l):<<1 }");
    test_display(&0b1110_0110_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20.h, r6.h):<<1 }");
    test_display(&0b1110_0110_101_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.l, r6.l):<<1 }");
    test_display(&0b1110_0110_101_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.l, r6.h):<<1 }");
    test_display(&0b1110_0110_101_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.h, r6.l):<<1 }");
    test_display(&0b1110_0110_101_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20.h, r6.h):<<1 }");
    test_display(&0b1110_0110_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.l, r6.l):<<1 }");
    test_display(&0b1110_0110_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.l, r6.h):<<1 }");
    test_display(&0b1110_0110_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.h, r6.l):<<1 }");
    test_display(&0b1110_0110_110_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20.h, r6.h):<<1 }");
    test_display(&0b1110_0110_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.l, r6.l):<<1 }");
    test_display(&0b1110_0110_111_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.l, r6.h):<<1 }");
    test_display(&0b1110_0110_111_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.h, r6.l):<<1 }");
    test_display(&0b1110_0110_111_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20.h, r6.h):<<1 }");

    test_display(&0b1110_0111_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += mpy(r20, r6) }");
    test_display(&0b1110_0111_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= mpy(r20, r6) }");
    test_display(&0b1110_0111_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 += mpyu(r20, r6) }");
    test_display(&0b1110_0111_011_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 -= mpyu(r20, r6) }");
    test_display(&0b1110_0111_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += cmpyi(r20, r6) }");
    test_display(&0b1110_0111_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vmpyh(r21:20, r7:6) }");
    test_display(&0b1110_0111_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vmpybu(r21:20, r7:6) }");
    test_display(&0b1110_0111_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vmpybsu(r21:20, r7:6) }");
    test_display(&0b1110_0111_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += cmpyr(r20, r6) }");
    test_display(&0b1110_0111_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 ^= pmpyw(r20, r6) }");
    test_display(&0b1110_0111_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 ^= vpmpyh(r20, r6) }");

    test_display(&0b1110_0111_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyh(r21:20, r7:6):sat }");
    test_display(&0b1110_0111_011_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyhsu(r20, r6):sat }");
    test_display(&0b1110_0111_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += cmpy(r20, r6):sat }");
    test_display(&0b1110_0111_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += cmpy(r20, r6*):sat }");
    test_display(&0b1110_0111_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 -= cmpy(r20, r6):sat }");
    test_display(&0b1110_0111_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 -= cmpy(r20, r6*):sat }");
    test_display(&0b1110_0111_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_0111_111_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyhsu(r20, r6):<<1:sat }");
    test_display(&0b1110_0111_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += cmpy(r20, r6):<<1:sat }");
    test_display(&0b1110_0111_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += cmpy(r20, r6*):<<1:sat }");
    test_display(&0b1110_0111_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 -= cmpy(r20, r6):<<1:sat }");
    test_display(&0b1110_0111_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 -= cmpy(r20, r6*):<<1:sat }");

    test_display(&0b1110_1000_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vrmpyh(r21:20, r7:6) }");
    test_display(&0b1110_1000_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = dfadd(r21:20, r7:6) }");
    test_display(&0b1110_1000_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vabsdiffw(r7:6, r21:20) }");
    test_display(&0b1110_1000_001_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = dfmax(r21:20, r7:6) }");
    test_display(&0b1110_1000_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vraddub(r21:20, r7:6) }");
    test_display(&0b1110_1000_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vrsadub(r21:20, r7:6) }");
    test_display(&0b1110_1000_010_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = dfmpyfix(r21:20, r7:6) }");
    test_display(&0b1110_1000_011_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vabsdiffh(r7:6, r21:20) }");
    test_display(&0b1110_1000_011_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = cmpyiw(r21:20, r7:6) }");
    test_display(&0b1110_1000_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vrmpyu(r21:20, r7:6) }");
    test_display(&0b1110_1000_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = cmpyrw(r21:20, r7:6) }");
    test_display(&0b1110_1000_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = dfsub(r21:20, r7:6) }");
    test_display(&0b1110_1000_101_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vabsdiffub(r7:6, r21:20) }");
    test_display(&0b1110_1000_101_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vdmpybsu(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_101_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = dfmpyll(r21:20, r7:6) }");
    test_display(&0b1110_1000_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 = vrmpysu(r21:20, r7:6) }");
    test_display(&0b1110_1000_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = cmpyrw(r21:20, r7:6*) }");
    test_display(&0b1110_1000_110_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 = dfmin(r21:20, r7:6) }");
    test_display(&0b1110_1000_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ r23:22 = vabsdiffb(r7:6, r21:20) }");
    test_display(&0b1110_1000_111_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = cmpyiw(r21:20, r7:6*) }");
    test_display(&0b1110_1000_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vrcmpys(r21:20, r7:6):<<1:sat:raw:hi }");
    test_display(&0b1110_1000_111_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vrcmpys(r21:20, r7:6):<<1:sat:raw:lo }");

    test_display(&0b1110_1000_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vdmpy(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweh(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vmpyeh(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywoh(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vrmpywoh(r21:20, r7:6) }");
    test_display(&0b1110_1000_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweh(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1000_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vcmpyr(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywoh(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1000_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vrmpywoh(r21:20, r7:6) }");
    test_display(&0b1110_1000_010_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweuh(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vcmpyi(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywouh(r21:20, r7:6):sat }");
    test_display(&0b1110_1000_011_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweuh(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1000_011_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywouh(r21:20, r7:6):rnd:sat }");

    test_display(&0b1110_1000_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vdmpy(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vmpyeh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywoh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_101_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 = vrmpywoh(r21:20, r7:6):<<1 }");
    test_display(&0b1110_1000_101_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweh(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1000_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vcmpyr(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywoh(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1000_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 = vrmpywoh(r21:20, r7:6):<<1 }");
    test_display(&0b1110_1000_110_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweuh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 = vcmpyi(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywouh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1000_111_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 = vmpyweuh(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1000_111_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 = vmpywouh(r21:20, r7:6):<<1:rnd:sat }");

    test_display(&0b1110_1001_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = vradduh(r21:20, r7:6) }");
    test_display(&0b1110_1001_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = vraddh(r21:20, r7:6) }");
    test_display(&0b1110_1001_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = cmpyiw(r21:20, r7:6*):<<1:sat }");
    test_display(&0b1110_1001_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cmpyiw(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1001_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cmpyrw(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1001_011_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cmpyrw(r21:20, r7:6*):<<1:sat }");
    test_display(&0b1110_1001_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = vrcmpys(r21:20, r7:6):<<1:rnd:sat:raw:hi }");
    test_display(&0b1110_1001_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = vrcmpys(r21:20, r7:6):<<1:rnd:sat:raw:lo }");
    test_display(&0b1110_1001_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = cmpyiw(r21:20, r7:6*):<<1:rnd:sat }");
    test_display(&0b1110_1001_101_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cmpyiw(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1001_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cmpyrw(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1001_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = cmpyrw(r21:20, r7:6*):<<1:rnd:sat }");

    test_display(&0b1110_1001_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = vdmpy(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1001_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = vdmpy(r21:20, r7:6):<<1:rnd:sat }");

    test_display(&0b1110_1010_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += vrmpyh(r21:20, r7:6) }");
    test_display(&0b1110_1010_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 += dfmpylh(r21:20, r7:6) }");
    test_display(&0b1110_1010_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vdmpybsu(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += vmpyeh(r21:20, r7:6) }");
    test_display(&0b1110_1010_001_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += vcmpyr(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vraddub(r21:20, r7:6) }");
    test_display(&0b1110_1010_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += vrsadub(r21:20, r7:6) }");
    test_display(&0b1110_1010_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += vcmpyi(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += cmpyiw(r21:20, r7:6*) }");
    test_display(&0b1110_1010_011_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += cmpyiw(r21:20, r7:6) }");

    test_display(&0b1110_1010_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vrmpybu(r21:20, r7:6) }");
    test_display(&0b1110_1010_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += cmpyrw(r21:20, r7:6) }");
    test_display(&0b1110_1010_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r23:22 += dfmpyhh(r21:20, r7:6) }");
    test_display(&0b1110_1010_101_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22, p1 = vacsh(r21:20, r7:6) }");
    test_display(&0b1110_1010_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += vrcmpys(r21:20, r7:6):<<1:sat:raw:hi }");

    test_display(&0b1110_1010_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22 += vrmpybsu(r21:20, r7:6) }");
    test_display(&0b1110_1010_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r23:22 += cmpyrw(r21:20, r7:6*) }");
    test_display(&0b1110_1010_111_10100_11_000110_001_10110u32.to_le_bytes(), "{ r23:22, p1 = vminub(r21:20, r7:6) }");
    test_display(&0b1110_1010_111_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += vrcmpys(r21:20, r7:6):<<1:sat:raw:lo }");

    test_display(&0b1110_1010_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += vdmpy(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweh(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += vmpyeh(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywoh(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweh(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1010_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += vrmpyweh(r21:20, r7:6) }");
    test_display(&0b1110_1010_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywoh(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1010_010_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweuh(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywouh(r21:20, r7:6):sat }");
    test_display(&0b1110_1010_011_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweuh(r21:20, r7:6):rnd:sat }");
    test_display(&0b1110_1010_011_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += vrmpywoh(r21:20, r7:6) }");
    test_display(&0b1110_1010_011_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywouh(r21:20, r7:6):rnd:sat }");

    test_display(&0b1110_1010_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r23:22 += vdmpy(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1010_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1010_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += vmpyeh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1010_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywoh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1010_101_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweh(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1010_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += vrmpyweh(r21:20, r7:6):<<1 }");
    test_display(&0b1110_1010_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywoh(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1010_110_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweuh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1010_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywouh(r21:20, r7:6):<<1:sat }");
    test_display(&0b1110_1010_111_10100_11_000110_101_10110u32.to_le_bytes(), "{ r23:22 += vmpyweuh(r21:20, r7:6):<<1:rnd:sat }");
    test_display(&0b1110_1010_111_10100_11_000110_110_10110u32.to_le_bytes(), "{ r23:22 += vrmpywoh(r21:20, r7:6):<<1 }");
    test_display(&0b1110_1010_111_10100_11_000110_111_10110u32.to_le_bytes(), "{ r23:22 += vmpywouh(r21:20, r7:6):<<1:rnd:sat }");

    test_invalid(&0b1110_1011_000_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1110_1011_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = sfsub(r20, r6) }");
    test_display(&0b1110_1011_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 = sfadd(r20, r6) }");
    test_display(&0b1110_1011_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = sfmpy(r20, r6) }");
    test_display(&0b1110_1011_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = sfmax(r20, r6) }");
    test_display(&0b1110_1011_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = sfmin(r20, r6) }");
    test_display(&0b1110_1011_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = sffixupn(r20, r6) }");
    test_display(&0b1110_1011_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = sffixupd(r20, r6) }");
    test_display(&0b1110_1011_111_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22, p1 = sfrecipa(r20, r6) }");

    test_display(&0b1110_1100_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l) }");
    test_display(&0b1110_1100_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h) }");
    test_display(&0b1110_1100_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l) }");
    test_display(&0b1110_1100_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h) }");
    test_display(&0b1110_1100_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):sat }");
    test_display(&0b1110_1100_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):sat }");
    test_display(&0b1110_1100_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):sat }");
    test_display(&0b1110_1100_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):sat }");
    test_display(&0b1110_1100_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):rnd }");
    test_display(&0b1110_1100_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):rnd }");
    test_display(&0b1110_1100_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):rnd }");
    test_display(&0b1110_1100_001_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):rnd }");
    test_display(&0b1110_1100_001_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):rnd:sat }");
    test_display(&0b1110_1100_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):rnd:sat }");
    test_display(&0b1110_1100_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):rnd:sat }");
    test_display(&0b1110_1100_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):rnd:sat }");
    test_display(&0b1110_1100_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):<<1 }");
    test_display(&0b1110_1100_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):<<1 }");
    test_display(&0b1110_1100_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):<<1 }");
    test_display(&0b1110_1100_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):<<1 }");
    test_display(&0b1110_1100_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):<<1:sat }");
    test_display(&0b1110_1100_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):<<1:sat }");
    test_display(&0b1110_1100_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):<<1:sat }");
    test_display(&0b1110_1100_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):<<1:sat }");
    test_display(&0b1110_1100_101_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):<<1:rnd }");
    test_display(&0b1110_1100_101_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):<<1:rnd }");
    test_display(&0b1110_1100_101_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):<<1:rnd }");
    test_display(&0b1110_1100_101_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):<<1:rnd }");
    test_display(&0b1110_1100_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.l):<<1:rnd:sat }");
    test_display(&0b1110_1100_101_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 = mpy(r20.l, r6.h):<<1:rnd:sat }");
    test_display(&0b1110_1100_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.l):<<1:rnd:sat }");
    test_display(&0b1110_1100_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = mpy(r20.h, r6.h):<<1:rnd:sat }");

    test_display(&0b1110_1101_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpyi(r20, r6) }");
    test_display(&0b1110_1101_101_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6.h):<<1:sat }");
    test_display(&0b1110_1101_111_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6):<<1:sat }");
    test_display(&0b1110_1101_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6) }");
    test_display(&0b1110_1101_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6):rnd }");
    test_display(&0b1110_1101_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpyu(r20, r6) }");
    test_display(&0b1110_1101_011_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpysu(r20, r6) }");
    test_display(&0b1110_1101_101_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6.l):<<1:sat }");
    test_display(&0b1110_1101_101_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6):<<1 }");
    test_display(&0b1110_1101_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6.h):<<1:rnd:sat }");
    test_display(&0b1110_1101_111_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 = mpy(r20, r6.l):<<1:rnd:sat }");

    test_display(&0b1110_1101_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = cmpy(r20, r6):rnd:sat }");
    test_display(&0b1110_1101_011_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = cmpy(r20, r6*):rnd:sat }");
    test_display(&0b1110_1101_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = vmpyh(r20, r6):rnd:sat }");
    test_display(&0b1110_1101_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = cmpy(r20, r6):<<1:rnd:sat }");
    test_display(&0b1110_1101_111_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 = cmpy(r20, r6*):<<1:rnd:sat }");
    test_display(&0b1110_1101_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 = vmpyh(r20, r6):<<1:rnd:sat }");

    test_display(&0b1110_1110_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.l) }");
    test_display(&0b1110_1110_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.h) }");
    test_display(&0b1110_1110_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.l) }");
    test_display(&0b1110_1110_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.h) }");
    test_display(&0b1110_1110_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.l):sat }");
    test_display(&0b1110_1110_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.h):sat }");
    test_display(&0b1110_1110_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.l):sat }");
    test_display(&0b1110_1110_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.h):sat }");
    test_display(&0b1110_1110_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.l) }");
    test_display(&0b1110_1110_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.h) }");
    test_display(&0b1110_1110_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.l) }");
    test_display(&0b1110_1110_001_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.h) }");
    test_display(&0b1110_1110_001_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.l):sat }");
    test_display(&0b1110_1110_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.h):sat }");
    test_display(&0b1110_1110_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.l):sat }");
    test_display(&0b1110_1110_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.h):sat }");
    test_display(&0b1110_1110_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.l):<<1 }");
    test_display(&0b1110_1110_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.h):<<1 }");
    test_display(&0b1110_1110_100_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.l):<<1 }");
    test_display(&0b1110_1110_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.h):<<1 }");
    test_display(&0b1110_1110_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.l):<<1:sat }");
    test_display(&0b1110_1110_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 += mpy(r20.l, r6.h):<<1:sat }");
    test_display(&0b1110_1110_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.l):<<1:sat }");
    test_display(&0b1110_1110_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 += mpy(r20.h, r6.h):<<1:sat }");
    test_display(&0b1110_1110_101_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.l):<<1 }");
    test_display(&0b1110_1110_101_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.h):<<1 }");
    test_display(&0b1110_1110_101_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.l):<<1 }");
    test_display(&0b1110_1110_101_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.h):<<1 }");
    test_display(&0b1110_1110_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.l):<<1:sat }");
    test_display(&0b1110_1110_101_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.l, r6.h):<<1:sat }");
    test_display(&0b1110_1110_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.l):<<1:sat }");
    test_display(&0b1110_1110_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 -= mpy(r20.h, r6.h):<<1:sat }");

    test_invalid(&0b1110_1110_010_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_010_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_011_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_110_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_000_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_001_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_invalid(&0b1110_1110_111_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1110_1111_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 += mpyi(r20, r6) }");
    test_display(&0b1110_1111_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 += add(r20, r6) }");
    test_invalid(&0b1110_1111_000_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_display(&0b1110_1111_000_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 += sub(r6, r20) }");
    test_display(&0b1110_1111_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ r22 += sfmpy(r20, r6) }");
    test_display(&0b1110_1111_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 -= sfmpy(r20, r6) }");
    test_display(&0b1110_1111_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ r22 += sfmpy(r20, r6):lib }");
    test_display(&0b1110_1111_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ r22 -= sfmpy(r20, r6):lib }");
    test_display(&0b1110_1111_001_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 |= and(r20, ~r6) }");
    test_display(&0b1110_1111_001_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 &= and(r20, ~r6) }");
    test_display(&0b1110_1111_001_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 ^= and(r20, ~r6) }");
    test_display(&0b1110_1111_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 &= and(r20, r6) }");
    test_display(&0b1110_1111_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 &= or(r20, r6) }");
    test_display(&0b1110_1111_010_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 &= xor(r20, r6) }");
    test_display(&0b1110_1111_010_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 |= and(r20, r6) }");
    test_display(&0b1110_1111_011_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 += mpy(r20, r6):<<1:sat }");
    test_display(&0b1110_1111_011_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 -= mpy(r20, r6):<<1:sat }");
    test_display(&0b1110_1111_011_10100_11_000110_101_10110u32.to_le_bytes(), "{ r22 += sfmpy(r20, r6, p1):scale }");
    test_display(&0b1110_1111_100_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 -= mpyi(r20, r6) }");
    test_display(&0b1110_1111_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 -= add(r20, r6) }");
    test_invalid(&0b1110_1111_100_10100_11_000110_010_10110u32.to_le_bytes(), DecodeError::InvalidOperand);
    test_display(&0b1110_1111_100_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 ^= xor(r20, r6) }");
    test_display(&0b1110_1111_110_10100_11_000110_000_10110u32.to_le_bytes(), "{ r22 |= or(r20, r6) }");
    test_display(&0b1110_1111_110_10100_11_000110_001_10110u32.to_le_bytes(), "{ r22 |= xor(r20, r6) }");
    test_display(&0b1110_1111_110_10100_11_000110_010_10110u32.to_le_bytes(), "{ r22 ^= and(r20, r6) }");
    test_display(&0b1110_1111_110_10100_11_000110_011_10110u32.to_le_bytes(), "{ r22 ^= or(r20, r6) }");
}

#[test]
fn inst_1111() {
    test_display(&0b1111_0001000_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ r6 = and(r4, r3) }");
    test_display(&0b1111_0001001_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ r6 = or(r4, r3) }");
    test_display(&0b1111_0001011_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ r6 = xor(r4, r3) }");
    test_display(&0b1111_0001100_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ r6 = and(r3, ~r4) }");
    test_display(&0b1111_0001101_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ r6 = or(r3, ~r4) }");

    test_display(&0b1111_0010000_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ p2 = cmp.eq(r4, r3) }");
    test_display(&0b1111_0010000_00100_11_0_00011_000_10010u32.to_le_bytes(), "{ p2 = !cmp.eq(r4, r3) }");
    test_display(&0b1111_0010010_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ p2 = cmp.gt(r4, r3) }");
    test_display(&0b1111_0010010_00100_11_0_00011_000_10010u32.to_le_bytes(), "{ p2 = !cmp.gt(r4, r3) }");
    test_display(&0b1111_0010011_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ p2 = cmp.gtu(r4, r3) }");
    test_display(&0b1111_0010011_00100_11_0_00011_000_10010u32.to_le_bytes(), "{ p2 = !cmp.gtu(r4, r3) }");

    test_display(&0b1111_0011000_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = add(r4, r3) }");
    test_display(&0b1111_0011001_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = sub(r3, r4) }");
    test_display(&0b1111_0011010_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = cmp.eq(r4, r3) }");
    test_display(&0b1111_0011011_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = !cmp.eq(r4, r3) }");

    test_display(&0b1111_0011100_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = combine(r3.h, r4.h) }");
    test_display(&0b1111_0011101_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = combine(r3.h, r4.l) }");
    test_display(&0b1111_0011110_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = combine(r3.l, r4.h) }");
    test_display(&0b1111_0011111_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = combine(r3.l, r4.l) }");

    test_display(&0b1111_0100000_00100_11_0_00011_001_00010u32.to_le_bytes(), "{ r2 = mux(p1, r4, r3) }");
    test_display(&0b1111_0101000_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r3:2 = combine(r4, r3) }");
    test_display(&0b1111_0101100_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r3:2 = packhl(r4, r3) }");
    test_display(&0b1111_0110000_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vaddh(r4, r3) }");
    test_display(&0b1111_0110001_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vaddh(r4, r3):sat }");
    test_display(&0b1111_0110010_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = add(r4, r3):sat }");
    test_display(&0b1111_0110011_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vadduh(r4, r3):sat }");
    test_display(&0b1111_0110100_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vsubh(r3, r4) }");
    test_display(&0b1111_0110101_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vsubh(r3, r4):sat }");
    test_display(&0b1111_0110110_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = sub(r3, r4):sat }");
    test_display(&0b1111_0110111_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vsubuh(r3, r4):sat }");
    test_display(&0b1111_0111100_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vavgh(r4, r3) }");
    test_display(&0b1111_0111101_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vavgh(r4, r3):sat }");
    test_invalid(&0b1111_0111110_00100_11_0_00011_000_00010u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1111_0111111_00100_11_0_00011_000_00010u32.to_le_bytes(), "{ r2 = vnavgh(r4, r3) }");

    test_display(&0b1111_1001000_00100_11_1_00011_001_00110u32.to_le_bytes(), "{ if (p1.new) r6 = and(r4, r3) }");
    test_display(&0b1111_1001001_00100_11_1_00011_001_00110u32.to_le_bytes(), "{ if (p1.new) r6 = or(r4, r3) }");
    test_invalid(&0b1111_1001010_00100_11_1_00011_001_00110u32.to_le_bytes(), DecodeError::InvalidOpcode);
    test_display(&0b1111_1001011_00100_11_1_00011_001_00110u32.to_le_bytes(), "{ if (p1.new) r6 = xor(r4, r3) }");

    test_display(&0b1111_1011000_00100_11_1_00011_001_00110u32.to_le_bytes(), "{ if (p1.new) r6 = add(r4, r3) }");
    test_display(&0b1111_1011001_00100_11_1_00011_001_00110u32.to_le_bytes(), "{ if (p1.new) r6 = sub(r4, r3) }");
    test_invalid(&0b1111_1011101_00100_11_1_00011_001_00110u32.to_le_bytes(), DecodeError::InvalidOpcode);

    test_display(&0b1111_1101000_00100_11_1_00011_001_00110u32.to_le_bytes(), "{ if (p1.new) r7:6 = contains(r4, r3) }");
}

    // TODO: testcase for Rn=add(pc,#nn)