aboutsummaryrefslogtreecommitdiff
path: root/deps/lightning/lib/jit_hppa-cpu.c
blob: db5a36a197a6c7e3ddbe47b0713d5ef5cb00fbe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
/*
 * Copyright (C) 2013-2019  Free Software Foundation, Inc.
 *
 * This file is part of GNU lightning.
 *
 * GNU lightning is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * GNU lightning is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 * License for more details.
 *
 * Authors:
 *	Paulo Cesar Pereira de Andrade
 */

#if PROTO
typedef struct idiv {
    int			quo;
    int			rem;
} idiv_t;

typedef struct udiv {
    unsigned int	quo;
    unsigned int	rem;
} udiv_t;

/* 16 spill bytes; -52 for first actual stack argument */
#define params_offset		-32
/* Assume all callee save registers may need to be spilled */
#define alloca_offset		192
#define _R0_REGNO		0
#define _R1_REGNO		1
#define _RP_REGNO		2
#define _FP_REGNO		3
#define _R19_REGNO		19
#define _R23_REGNO		23
#define _R24_REGNO		24
#define _R25_REGNO		25
#define _R26_REGNO		26
#define _R28_REGNO		28
#define _R29_REGNO		29
#define _SP_REGNO		30
#define _R31_REGNO		31
#define _CR11_REGNO		11
#define ii(v)			*_jit->pc.ui++ = v
#define f1(o,b,t,i)			_f1(_jit,o,b,t,i)
static void _f1(jit_state_t*,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t);
#define f2(o,b,r,i,j)			_f2(_jit,o,b,r,i,j)
static void _f2(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f3(o,b,t,i,j)			_f3(_jit,o,b,t,i,j)
static void _f3(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t);
#define f4(o,b,x,s,u,y,c,z,m,t)		_f4(_jit,o,b,x,s,u,y,c,z,m,t)
static void _f4(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f5(o,b,i,s,a,y,c,z,m,t)		_f5(_jit,o,b,i,s,a,y,c,z,m,t)
static void _f5(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f6(o,b,r,s,a,x,c,y,m,i)		_f6(_jit,o,b,r,s,a,x,c,y,m,i)
static void _f6(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f7(o,r,i)			_f7(_jit,o,r,i)
static void _f7(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define f8(o,r2,r1,cf,e1,x,e2,y,d,t)	_f8(_jit,o,r2,r1,cf,e1,x,e2,y,d,t)
static void _f8(jit_state_t*,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t);
#define f9(o,r,t,cf,e1,im)		_f9(_jit,o,r,t,cf,e1,im)
static void _f9(jit_state_t*,
		jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t);
#define f10(o,r2,r1,u,v,w,x,sa,y,t)	_f10(_jit,o,r2,r1,u,v,w,x,sa,y,t)
static void _f10(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f11(o,r2,r1,c,x,y,z,u,t)	_f11(_jit,o,r2,r1,c,x,y,z,u,t)
static void _f11(jit_state_t*,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f12(o,r,t,c,x,se,y,c1,z,clen)	_f12(_jit,o,r,t,c,x,se,y,c1,z,clen)
static void _f12(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f13(o,t,r,c,x,nz,c1,clen)	_f13(_jit,o,t,r,c,x,nz,c1,clen)
static void _f13(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t);
#define f13x(o,t,i,c,x,nz,c1,clen)	_f13x(_jit,o,t,i,c,x,nz,c1,clen)
static void _f13x(jit_state_t*,jit_int32_t,jit_int32_t,
		  jit_int32_t,jit_int32_t,jit_int32_t,
		  jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f14(o,r2,r1,c,x,cp,y,cpos,t)	_f14(_jit,o,r2,r1,c,x,cp,y,cpos,t)
static void _f14(jit_state_t*,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f15(o,r,t,c,c1,p,se,pos,clen)	_f15(_jit,o,r,t,c,c1,p,se,pos,clen)
static void _f15(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f16(o,t,r,c,c1,cp,nz,cpos,clen)	_f16(_jit,o,t,r,c,c1,cp,nz,cpos,clen)
static void _f16(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f16x(o,t,i,c,c1,cp,nz,cpos,clen) _f16x(_jit,o,t,i,c,c1,cp,nz,cpos,clen)
static void _f16x(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f17(o,r2,r1,c,i,n)		_f17(_jit,o,r2,r1,c,i,n)
static void _f17(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f17x(o,r2,r1,c,i,n)		_f17x(_jit,o,r2,r1,c,i,n)
static void _f17x(jit_state_t*,jit_int32_t,jit_int32_t,
		  jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f18(o,p,r,c,i,n)		_f18(_jit,o,p,r,c,i,n)
static void _f18(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f19(o,b,s,i,n)			_f19(_jit,o,b,s,i,n)
static void _f19(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f20(o,t,i,g,n)			_f20(_jit,o,t,i,g,n)
static void _f20(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t);
#define f21(o,t,x,y,n)			_f21(_jit,o,t,x,y,n)
static void _f21(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t);
#define f22(o,b,x,r,n,p)		_f22(_jit,o,b,x,r,n,p)
static void _f22(jit_state_t*,jit_int32_t,jit_int32_t,
		jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f23(o,a,b,c,d,e,f,g,h)		_f23(_jit,o,a,b,c,d,e,f,g,h)
static void _f23(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f24(o,b,x,s,y,m,r)		_f24(_jit,o,b,x,s,y,m,r)
static void _f24(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f25(o,b,i,s,y,m,r)		_f25(_jit,o,b,i,s,y,m,r)
static void _f25(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f26(o,b,x,s,y,m,r)		_f26(_jit,o,b,x,s,y,m,r)
static void _f26(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f27(o,i,j)			_f27(_jit,o,i,j)
static void _f27(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f28(o,i)			_f28(_jit,o,i)
static void _f28(jit_state_t*,jit_int32_t,jit_int32_t) maybe_unused;
#define f29(o,r,x,s,y,t)		_f29(_jit,o,r,x,s,y,t)
static void _f29(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f30(o,b,r,s,x,y,t)		_f30(_jit,o,b,r,s,x,y,t)
static void _f30(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f31(o,t,r,v,x,y)		_f31(_jit,o,t,r,v,x,y)
static void _f31(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define f33(o,x,r,y,z,u)		_f33(_jit,o,x,r,y,z,u)
static void _f33(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f34(o,o1,x,sf,n,o2)		_f34(_jit,o,o1,x,sf,n,o2)
static void _f34(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f35(o,op,x,sf,n,t)		_f35(_jit,o,op,x,sf,n,t)
static void _f35(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f36(o,r,o1,x,sf,n,o2)		_f36(_jit,o,r,o1,x,sf,n,o2)
static void _f36(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f37(o,r2,r1,o1,x,sf,n,o2)	_f37(_jit,o,r2,r1,o1,x,sf,n,o2)
static void _f37(jit_state_t*,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
#define f38(o,s,u,n)			_f38(_jit,o,s,u,n)
static void _f38(jit_state_t*,jit_int32_t,
		 jit_int32_t,jit_int32_t,jit_int32_t) maybe_unused;
/* nulify next instruction if condition is met with addition */
#define ADD_CF_NV		0	/* never */
#define ADD_CF_EQ		2	/* O1 == -O2 (word) */
#define ADD_CF_LT		4	/* O1 <  -O2 (signed)*/
#define ADD_CF_LE		6	/* O1 <= -O2 (signed) */
#define ADD_CF_NUV		8	/* O1 +   O2 does not overflow (unsigned) */
#define ADD_CF_ZNV		10	/* O1 +   O2 is zero or no overflow (unsigned) */
#define ADD_CF_SV		12	/* O1 +   O2 overflows (signed) */
#define ADD_CF_OD		14	/* O1 +   O2 is odd */
#define ADD_CF_TR		1	/* always */
#define ADD_CF_NE		3	/* O1 != -O2 */
#define ADD_CF_GE		5	/* O1 >= -O2 (signed) */
#define ADD_CF_GT		7	/* O1 >  -O2 (signed) */
#define ADD_CF_UV		9	/* O1 +   O2 overflows (unsigned) */
#define ADD_CF_VNZ		11	/* O1 +   O2 is nonzero and overflows (unsigned) */
#define ADD_CF_NSV		13	/* O1 +   O2 does not overflow (signed) */
#define ADD_CF_EV		15	/* O1 +   O2 is even */
#define ADD_EN_NONE		6	/* none */
#define ADD_EN_C		7	/* with carry */
#define ADD_EN_L		10	/* logical */
#define ADD_EN_TSV		12	/* trap on signed overflow */
#define ADD_EN_C_TSV		13	/* with carry and trap on signed overflow */
#define ADDI_OE_TC		0	/* trap on condition */
#define ADDI_OE_TSV_TC		1	/* trap on signed overflow or condition */
#define ADDI_OE_NONE		2	/* none */
#define ADDI_OE_TSV		3	/* trap on signed overflow */
#define ADD_(en,cf,r1,r2,t)	f8(0x2,r2,r1,cf,en>>2,1,en&1,0,0,t)
#define ADD(r1,r2,t)		ADD_(ADD_EN_NONE,ADD_CF_NV,r1,r2,t)
#define ADD_C(r1,r2,t)		ADD_(ADD_EN_C,ADD_CF_NV,r1,r2,t)
#define ADD_L(r1,r2,t)		ADD_(ADD_EN_L,ADD_CF_NV,r1,r2,t)
#define ADDB_(cc,r1,r2,t)	f17(0x28|((cc&1)<<1),r2,r1,cc>>1,t,0)
#define ADDB(r1,r2,t)		ADDB_(ADD_CF_NV,r1,r2,t)
#define ADDB_EQ(r1,r2,t)	ADDB_(ADD_CF_EQ,r1,r2,t)
#define ADDB_LT(r1,r2,t)	ADDB_(ADD_CF_LT,r1,r2,t)
#define ADDB_LE(r1,r2,t)	ADDB_(ADD_CF_LE,r1,r2,t)
#define ADDB_NUV(r1,r2,t)	ADDB_(ADD_CF_NUV,r1,r2,t)
#define ADDB_ZNV(r1,r2,t)	ADDB_(ADD_CF_ZNV,r1,r2,t)
#define ADDB_SV(r1,r2,t)	ADDB_(ADD_CF_SV,r1,r2,t)
#define ADDB_OD(r1,r2,t)	ADDB_(ADD_CF_OD,r1,r2,t)
#define ADDB_TR(r1,r2,t)	ADDB_(ADD_CF_TR,r1,r2,t)
#define ADDB_NE(r1,r2,t)	ADDB_(ADD_CF_NE,r1,r2,t)
#define ADDB_GE(r1,r2,t)	ADDB_(ADD_CF_GE,r1,r2,t)
#define ADDB_GT(r1,r2,t)	ADDB_(ADD_CF_GT,r1,r2,t)
#define ADDB_UV(r1,r2,t)	ADDB_(ADD_CF_UV,r1,r2,t)
#define ADDB_VNZ(r1,r2,t)	ADDB_(ADD_CF_VNZ,r1,r2,t)
#define ADDB_NSV(r1,r2,t)	ADDB_(ADD_CF_NSV,r1,r2,t)
#define ADDB_EV(r1,r2,t)	ADDB_(ADD_CF_EV,r2,r1,t)
#define ADDB_N_(cc,r1,r2,t)	f17(0x28|((cc&1)<<1),r2,r1,cc>>1,t,1)
#define ADDB_N(r1,r2,t)		ADDB_N_(ADD_CF_NV,r1,r2,t)
#define ADDB_N_EQ(r1,r2,t)	ADDB_N_(ADD_CF_EQ,r1,r2,t)
#define ADDB_N_LT(r1,r2,t)	ADDB_N_(ADD_CF_LT,r1,r2,t)
#define ADDB_N_LE(r1,r2,t)	ADDB_N_(ADD_CF_LE,r1,r2,t)
#define ADDB_N_NUV(r1,r2,t)	ADDB_N_(ADD_CF_NUV,r1,r2,t)
#define ADDB_N_ZNV(r1,r2,t)	ADDB_N_(ADD_CF_ZNV,r1,r2,t)
#define ADDB_N_SV(r1,r2,t)	ADDB_N_(ADD_CF_SV,r1,r2,t)
#define ADDB_N_OD(r1,r2,t)	ADDB_N_(ADD_CF_OD,r1,r2,t)
#define ADDB_N_TR(r1,r2,t)	ADDB_N_(ADD_CF_TR,r1,r2,t)
#define ADDB_N_NE(r1,r2,t)	ADDB_N_(ADD_CF_NE,r1,r2,t)
#define ADDB_N_GE(r1,r2,t)	ADDB_N_(ADD_CF_GE,r1,r2,t)
#define ADDB_N_GT(r1,r2,t)	ADDB_N_(ADD_CF_GT,r1,r2,t)
#define ADDB_N_UV(r1,r2,t)	ADDB_N_(ADD_CF_UV,r1,r2,t)
#define ADDB_N_VNZ(r1,r2,t)	ADDB_N_(ADD_CF_VNZ,r1,r2,t)
#define ADDB_N_NSV(r1,r2,t)	ADDB_N_(ADD_CF_NSV,r1,r2,t)
#define ADDB_N_EV(r1,r2,t)	ADDB_N_(ADD_CF_EV,r1,r2,t)
#define ADDI_(ec,cf,i,r,t)	f9(0x2c|(ec>>1),r,t,cf,ec&1,i)
#define ADDI(i,r,t)		ADDI_(ADDI_OE_NONE,ADD_CF_NV,i,r,t)
#define ADDIB_(cc,i,r,t)	f17x(0x29|((cc&1)<<1),r,i,cc>>1,t,0)
#define ADDIB(i,r,t)		ADDIB_(ADD_CF_NV,i,r,t)
#define ADDIB_EQ(i,r,t)		ADDIB_(ADD_CF_EQ,i,r,t)
#define ADDIB_LT(i,r,t)		ADDIB_(ADD_CF_LT,i,r,t)
#define ADDIB_LE(i,r,t)		ADDIB_(ADD_CF_LE,i,r,t)
#define ADDIB_NUV(i,r,t)	ADDIB_(ADD_CF_NUV,i,r,t)
#define ADDIB_ZNV(i,r,t)	ADDIB_(ADD_CF_ZNV,i,r,t)
#define ADDIB_SV(i,r,t)		ADDIB_(ADD_CF_SV,i,r,t)
#define ADDIB_OD(i,r,t)		ADDIB_(ADD_CF_OD,i,r,t)
#define ADDIB_TR(i,r,t)		ADDIB_(ADD_CF_TR,i,r,t)
#define ADDIB_NE(i,r,t)		ADDIB_(ADD_CF_NE,i,r,t)
#define ADDIB_GE(i,r,t)		ADDIB_(ADD_CF_GE,i,r,t)
#define ADDIB_GT(i,r,t)		ADDIB_(ADD_CF_GT,i,r,t)
#define ADDIB_UV(i,r,t)		ADDIB_(ADD_CF_UV,i,r,t)
#define ADDIB_VNZ(i,r,t)	ADDIB_(ADD_CF_VNZ,i,r,t)
#define ADDIB_NSV(i,r,t)	ADDIB_(ADD_CF_NSV,i,r,t)
#define ADDIB_EV(i,r,t)		ADDIB_(ADD_CF_EV,i,r,t)
#define ADDIB_N_(cc,i,r,t)	f17x(0x29|((cc&1)<<1),r,i,cc>>1,t,1)
#define ADDIB_N(i,r,t)		ADDIB_N_(ADD_CF_NV,i,r,t)
#define ADDIB_N_EQ(i,r,t)	ADDIB_N_(ADD_CF_EQ,i,r,t)
#define ADDIB_N_LT(i,r,t)	ADDIB_N_(ADD_CF_LT,i,r,t)
#define ADDIB_N_LE(i,r,t)	ADDIB_N_(ADD_CF_LE,i,r,t)
#define ADDIB_N_NUV(i,r,t)	ADDIB_N_(ADD_CF_NUV,i,r,t)
#define ADDIB_N_ZNV(i,r,t)	ADDIB_N_(ADD_CF_ZNV,i,r,t)
#define ADDIB_N_SV(i,r,t)	ADDIB_N_(ADD_CF_SV,i,r,t)
#define ADDIB_N_OD(i,r,t)	ADDIB_N_(ADD_CF_OD,i,r,t)
#define ADDIB_N_TR(i,r,t)	ADDIB_N_(ADD_CF_TR,i,r,t)
#define ADDIB_N_NE(i,r,t)	ADDIB_N_(ADD_CF_NE,i,r,t)
#define ADDIB_N_GE(i,r,t)	ADDIB_N_(ADD_CF_GE,i,r,t)
#define ADDIB_N_GT(i,r,t)	ADDIB_N_(ADD_CF_GT,i,r,t)
#define ADDIB_N_UV(i,r,t)	ADDIB_N_(ADD_CF_UV,i,r,t)
#define ADDIB_N_VNZ(i,r,t)	ADDIB_N_(ADD_CF_VNZ,i,r,t)
#define ADDIB_N_NSV(i,r,t)	ADDIB_N_(ADD_CF_NSV,i,r,t)
#define ADDIB_N_EV(i,r,t)	ADDIB_N_(ADD_CF_EV,0,i,r,t)
#define ADDIL(i,r)		f7(0xa,r,i)
#define LOG_CC_NV		0	/* never */
#define LOG_CC_EQ		1	/* all bits are 0 */
#define LOG_CC_LT		2	/* leftmost bit is 1 */
#define LOG_CC_LE		3	/* leftmost bit is 1 or all bits are 0 */
#define LOG_CC_OD		7	/* rightmost bit is 1 */
#define LOG_CC_TR		8	/* always */
#define LOG_CC_NE		9	/* some bits are 1 */
#define LOG_CC_GE		10	/* leftmost bit is 0 */
#define LOG_CC_GT		11	/* leftmost bit is 0 or some bits are 1 */
#define LOG_CC_EV		15	/* rightmost bit is 0 */
#define AND_(cc,r1,r2,t)	f8(0x2,r2,r1,cc,0,1,0,0,0,t)
#define AND(r1,r2,t)		AND_(LOG_CC_NV,r1,r2,t)
#define ANDCM_(cc,r1,r2,t)	f8(0x2,r2,r1,cc,0,0,0,0,0,t)
#define ANDCM(r1,r2,t)		ANDCM_(LOG_CC_NV,r1,r2,t)
#define B_(n,i,t)		f20(0x3a,t,i,0,n)
#define B(i,t)			B_(0,i,t)
#define B_N(i,t)		B_(1,i,t)
#define B_L(i)			B_(0,i,_RP_REGNO)
#define B_L_N(i)		B_(1,i,_RP_REGNO)
#define BB_CC_LT		0	/* leftmost bit in word is 1 */
#define BB_CC_GE		1	/* leftmost bit in word is 0 */
#define BB_(c,r,i)		f18(0x30,0,r,c,i,0)
#define BB_N_(c,r,i)		f18(0x30,0,r,c,i,1)
#define BBI_(c,r,p,i)		f18(0x31,p,r,c,i,0)
#define BBI_N_(c,r,p,i)		f18(0x31,p,r,c,i,1)
#define BB(c,r,i)		BB_(c,r,i)
#define BBI_LT(r,p,i)		BBI_(BB_CC_LT,r,p,i)
#define BBI_GE(r,p,i)		BBI_(BB_CC_GE,r,p,i)
#define BB_N(c,r,i)		BB_(c,r,i)
#define BBI_N_LT(r,p,i)		BBI_N_(BB_CC_LT,r,p,i)
#define BBI_N_GE(r,p,i)		BBI_N_(BB_CC_GE,r,p,i)
#define BE(i,s,b)		f19(0x38,b,s,i,0)
#define BE_L(i,s,b)		f19(0x39,b,s,i,0)
#define BE_L_N(i,s,b)		f19(0x39,b,s,i,1)
#define BLR(x,t)		f21(0x3a,t,x,2,0)
#define BLR_N(x,t)		f21(0x3a,t,x,2,1)
#define BREAK(i,j)		f27(0,j,i)
#define BV(x,b)			f21(0x3a,b,x,6,0)
#define BV_N(x,b)		f21(0x3a,b,x,6,1)
#define BVE(b)			f22(0x3a,b,6,0,0,0)
#define BVE_N(b)		f22(0x3a,b,6,0,1,0)
#define BVE_L(b)		f22(0x3a,b,7,0,0,0)
#define BVE_L_N(b)		f22(0x3a,b,7,0,0,1)
#define II_C_NONE		0
#define II_C_M			(1<<5)
#define II_C_S			(1<<13)
#define II_C_SM			(II_C_S|II_C_M)
#define II_AU_NONE		0
#define II_AU_PRE		((1<<13)|II_C_M)
#define II_AU_POS		II_C_M
#define LD_CC_H_NONE		0	/* No hint */
#define LD_CC_H_SPL		2	/* Spatial Locality */
#define CLRBTS()		f23(0x3a,0,0,2,0,0,1,0,1)
#define CS_CC_NV		0	/* never */
#define CS_CC_EQ		2	/* O1 =  O2 */
#define CS_CC_LT		4	/* O1 <  O2 (signed) */
#define CS_CC_LE		6	/* O1 <= O2 (signed) */
#define CS_CC_ULT		8	/* O1 <  O2 (unsigned) */
#define CS_CC_ULE		10	/* O1 <= O2 (unsigned) */
#define CS_CC_SV		12	/* O1 -  O2 overflows (signed) */
#define CS_CC_OD		14	/* O1 -  O2 is odd */
#define CS_CC_TR		1	/* always */
#define CS_CC_NE		3	/* O1 != O2 */
#define CS_CC_GE		5	/* O1 >= O2 (signed) */
#define CS_CC_GT		7	/* O1 >  O2 (signed) */
#define CS_CC_UGE		9	/* O1 >= O2 (unsigned) */
#define CS_CC_UGT		11	/* O1 >  O2 (unsigned) */
#define CS_CC_NSV		13	/* O1 -  O2 does not overflows (signed) */
#define CS_CC_EV		15	/* O1 -  O2 is even */
#define CMPB_(c,r1,r2,i)	f17((c)&1?0x22:0x20,r2,r1,(c)>>1,i,0)
#define CMPB(r1,r2,i)		CMPB_(CS_CC_NV,r1,r2,i)
#define CMPB_EQ(r1,r2,i)	CMPB_(CS_CC_EQ,r1,r2,i)
#define CMPB_LT(r1,r2,i)	CMPB_(CS_CC_LT,r1,r2,i)
#define CMPB_LE(r1,r2,i)	CMPB_(CS_CC_LE,r1,r2,i)
#define CMPB_ULT(r1,r2,i)	CMPB_(CS_CC_ULT,r1,r2,i)
#define CMPB_ULE(r1,r2,i)	CMPB_(CS_CC_ULE,r1,r2,i)
#define CMPB_SV(r1,r2,i)	CMPB_(CS_CC_SV,r1,r2,i)
#define CMPB_OD(r1,r2,i)	CMPB_(CS_CC_OD,r1,r2,i)
#define CMPB_TR(r1,r2,i)	CMPB_(CS_CC_TR,r1,r2,i)
#define CMPB_NE(r1,r2,i)	CMPB_(CS_CC_NE,r1,r2,i)
#define CMPB_GE(r1,r2,i)	CMPB_(CS_CC_GE,r1,r2,i)
#define CMPB_GT(r1,r2,i)	CMPB_(CS_CC_GT,r1,r2,i)
#define CMPB_UGE(r1,r2,i)	CMPB_(CS_CC_UGE,r1,r2,i)
#define CMPB_UGT(r1,r2,i)	CMPB_(CS_CC_UGT,r1,r2,i)
#define CMPB_NSV(r1,r2,i)	CMPB_(CS_CC_NSV,r1,r2,i)
#define CMPB_EV(r1,r2,i)	CMPB_(CS_CC_EV,r1,r2,i)
#define CMPB_N_(c,r1,r2,i)	f17((c)&1?0x22:0x20,r2,r1,(c)>>1,i,1)
#define CMPB_N(r1,r2,i)		CMPB_N_(CS_CC_NV,r1,r2,i)
#define CMPB_EQ_N(r1,r2,i)	CMPB_N_(CS_CC_EQ,r1,r2,i)
#define CMPB_LT_N(r1,r2,i)	CMPB_N_(CS_CC_LT,r1,r2,i)
#define CMPB_LE_N(r1,r2,i)	CMPB_N_(CS_CC_LE,r1,r2,i)
#define CMPB_ULT_N(r1,r2,i)	CMPB_N_(CS_CC_ULT,r1,r2,i)
#define CMPB_ULE_N(r1,r2,i)	CMPB_N_(CS_CC_ULE,r1,r2,i)
#define CMPB_SV_N(r1,r2,i)	CMPB_N_(CS_CC_SV,r1,r2,i)
#define CMPB_OD_N(r1,r2,i)	CMPB_N_(CS_CC_OD,r1,r2,i)
#define CMPB_TR_N(r1,r2,i)	CMPB_N_(CS_CC_TR,r1,r2,i)
#define CMPB_NE_N(r1,r2,i)	CMPB_N_(CS_CC_NE,r1,r2,i)
#define CMPB_GE_N(r1,r2,i)	CMPB_N_(CS_CC_GE,r1,r2,i)
#define CMPB_GT_N(r1,r2,i)	CMPB_N_(CS_CC_GT,r1,r2,i)
#define CMPB_UGE_N(r1,r2,i)	CMPB_N_(CS_CC_UGE,r1,r2,i)
#define CMPB_UGT_N(r1,r2,i)	CMPB_N_(CS_CC_UGT,r1,r2,i)
#define CMPB_NSV_N(r1,r2,i)	CMPB_N_(CS_CC_NSV,r1,r2,i)
#define CMPB_EV_N(r1,r2,i)	CMPB_N_(CS_CC_EV,r1,r2,i)
#define CMPCLR_(c,r1,r2,i)	f8(0x2,r2,r1,c,2,0,0,2,0,i)
#define CMPCLR(r1,r2,i)		CMPCLR_(CS_CC_NV,r1,r2,i)
#define CMPCLR_EQ(r1,r2,i)	CMPCLR_(CS_CC_EQ,r1,r2,i)
#define CMPCLR_LT(r1,r2,i)	CMPCLR_(CS_CC_LT,r1,r2,i)
#define CMPCLR_LE(r1,r2,i)	CMPCLR_(CS_CC_LE,r1,r2,i)
#define CMPCLR_ULT(r1,r2,i)	CMPCLR_(CS_CC_ULT,r1,r2,i)
#define CMPCLR_ULE(r1,r2,i)	CMPCLR_(CS_CC_ULE,r1,r2,i)
#define CMPCLR_SV(r1,r2,i)	CMPCLR_(CS_CC_SV,r1,r2,i)
#define CMPCLR_OD(r1,r2,i)	CMPCLR_(CS_CC_OD,r1,r2,i)
#define CMPCLR_TR(r1,r2,i)	CMPCLR_(CS_CC_TR,r1,r2,i)
#define CMPCLR_NE(r1,r2,i)	CMPCLR_(CS_CC_NE,r1,r2,i)
#define CMPCLR_GE(r1,r2,i)	CMPCLR_(CS_CC_GE,r1,r2,i)
#define CMPCLR_GT(r1,r2,i)	CMPCLR_(CS_CC_GT,r1,r2,i)
#define CMPCLR_UGE(r1,r2,i)	CMPCLR_(CS_CC_UGE,r1,r2,i)
#define CMPCLR_UGT(r1,r2,i)	CMPCLR_(CS_CC_UGT,r1,r2,i)
#define CMPCLR_NSV(r1,r2,i)	CMPCLR_(CS_CC_NSV,r1,r2,i)
#define CMPCLR_EV(r1,r2,i)	CMPCLR_(CS_CC_EV,r1,r2,i)
#define CMPIB_(c,i,r,t)		f17x((c)&1?0x23:0x21,r,i,(c)>>1,t,0)
#define CMPIB_NONE(i,r,t)	CMPIB_(CS_CC_NV,i,r,t)
#define CMPIB_EQ(i,r,t)		CMPIB_(CS_CC_EQ,i,r,t)
#define CMPIB_LT(i,r,t)		CMPIB_(CS_CC_LT,i,r,t)
#define CMPIB_LE(i,r,t)		CMPIB_(CS_CC_LE,i,r,t)
#define CMPIB_ULT(i,r,t)	CMPIB_(CS_CC_ULT,i,r,t)
#define CMPIB_ULE(i,r,t)	CMPIB_(CS_CC_ULE,i,r,t)
#define CMPIB_SV(i,r,t)		CMPIB_(CS_CC_SV,i,r,t)
#define CMPIB_OD(i,r,t)		CMPIB_(CS_CC_OD,i,r,t)
#define CMPIB(i,r,t)		CMPIB_(CS_CC_TR,i,r,t)
#define CMPIB_NE(i,r,t)		CMPIB_(CS_CC_NE,i,r,t)
#define CMPIB_GE(i,r,t)		CMPIB_(CS_CC_GE,i,r,t)
#define CMPIB_GT(i,r,t)		CMPIB_(CS_CC_GT,i,r,t)
#define CMPIB_UGE(i,r,t)	CMPIB_(CS_CC_UGE,i,r,t)
#define CMPIB_UGT(i,r,t)	CMPIB_(CS_CC_UGT,i,r,t)
#define CMPIB_NSV(i,r,t)	CMPIB_(CS_CC_NSV,i,r,t)
#define CMPIB_EV(i,r,t)		CMPIB_(CS_CC_EV,i,r,t)
#define CMPIB_N_(c,i,r,t)	f17x((c)&1?0x23:0x21,r,i,(c)>>1,t,1)
#define CMPIB_NONE_N(i,r,t)	CMPIB_N_(CS_CC_NV,i,r,t)
#define CMPIB_EQ_N(i,r,t)	CMPIB_N_(CS_CC_EQ,i,r,t)
#define CMPIB_LT_N(i,r,t)	CMPIB_N_(CS_CC_LT,i,r,t)
#define CMPIB_LE_N(i,r,t)	CMPIB_N_(CS_CC_LE,i,r,t)
#define CMPIB_ULT_N(i,r,t)	CMPIB_N_(CS_CC_ULT,i,r,t)
#define CMPIB_ULE_N(i,r,t)	CMPIB_N_(CS_CC_ULE,i,r,t)
#define CMPIB_SV_N(i,r,t)	CMPIB_N_(CS_CC_SV,i,r,t)
#define CMPIB_OD_N(i,r,t)	CMPIB_N_(CS_CC_OD,i,r,t)
#define CMPIB_N(i,r,t)		CMPIB_N_(CS_CC_TR,i,r,t)
#define CMPIB_NE_N(i,r,t)	CMPIB_N_(CS_CC_NE,i,r,t)
#define CMPIB_GE_N(i,r,t)	CMPIB_N_(CS_CC_GE,i,r,t)
#define CMPIB_GT_N(i,r,t)	CMPIB_N_(CS_CC_GT,i,r,t)
#define CMPIB_UGE_N(i,r,t)	CMPIB_N_(CS_CC_UGE,i,r,t)
#define CMPIB_UGT_N(i,r,t)	CMPIB_N_(CS_CC_UGT,i,r,t)
#define CMPIB_NSV_N(i,r,t)	CMPIB_N_(CS_CC_NSV,i,r,t)
#define CMPIB_EV_N(i,r,t)	CMPIB_N_(CS_CC_EV,i,r,t)
#define CMPICLR_(c,i,r,t)	f9(0x24,r,t,c,0,i)
#define CMPICLR(i,r,t)		CMPICLR_(CS_CC_NV,i,r,t)
#define CMPICLR_EQ(i,r,t)	CMPICLR_(CS_CC_EQ,i,r,t)
#define CMPICLR_LT(i,r,t)	CMPICLR_(CS_CC_LT,i,r,t)
#define CMPICLR_LE(i,r,t)	CMPICLR_(CS_CC_LE,i,r,t)
#define CMPICLR_ULT(i,r,t)	CMPICLR_(CS_CC_ULT,i,r,t)
#define CMPICLR_ULE(i,r,t)	CMPICLR_(CS_CC_ULE,i,r,t)
#define CMPICLR_SV(i,r,t)	CMPICLR_(CS_CC_SV,i,r,t)
#define CMPICLR_OD(i,r,t)	CMPICLR_(CS_CC_OD,i,r,t)
#define CMPICLR_TR(i,r,t)	CMPICLR_(CS_CC_TR,i,r,t)
#define CMPICLR_NE(i,r,t)	CMPICLR_(CS_CC_NE,i,r,t)
#define CMPICLR_GE(i,r,t)	CMPICLR_(CS_CC_GE,i,r,t)
#define CMPICLR_GT(i,r,t)	CMPICLR_(CS_CC_GT,i,r,t)
#define CMPICLR_UGE(i,r,t)	CMPICLR_(CS_CC_UGE,i,r,t)
#define CMPICLR_UGT(i,r,t)	CMPICLR_(CS_CC_UGT,i,r,t)
#define CMPICLR_NSV(i,r,t)	CMPICLR_(CS_CC_NSV,i,r,t)
#define CMPICLR_EV(i,r,t)	CMPICLR_(CS_CC_EV,i,r,t)
#define COPR(u,s)		f38(0x0c,s,u,0)
#define UI_CF_NONE		0	/* never */
#define UI_CF_SBZ		2	/* some byte zero */
#define UI_CF_SHZ		3	/* some halfword zero */
#define UI_CF_SDC		4	/* some digit carry */
#define UI_CF_SBC		6	/* some byte carry */
#define UI_CF_SHC		7	/* some halfword carry */
#define UI_TR_SHC		8	/* always */
#define UI_CF_NBZ		10	/* no byte zero */
#define UI_CF_NHZ		11	/* no halfword zero */
#define UI_CF_NDC		12	/* no digit carry */
#define UI_CF_NBC		14	/* no byte carry */
#define UI_CF_NHC		15	/* no halfword carry */
#define DCOR_(e1,cf,r,t)	f8(0x2,r,0,cf,2,1,1,e1,0,t)
#define DCOR(r,t)		DCOR_(2,UI_CF_NONE,r,t)
#define DCOR_I(r,t)		DCOR_(3,UI_CF_NONE,r,t)
#define SED_C_NEVER		0	/* never */
#define SED_C_EQ		1	/* all bits 0 */
#define SED_C_LT		2	/* lefmost bits 1 */
#define SED_C_OD		3	/* rightmost bit 1 */
#define SED_C_TR		4	/* always */
#define SED_C_NE		5	/* some bit 1 */
#define SED_C_GE		6	/* lefmost bits 1 */
#define SED_C_EV		7	/* rightmost bit 0 */
#define DEPW(r,len,t)		f13(0x35,t,r,SED_C_NEVER,0,1,0,len)
#define DEPW_Z(r,len,t)		f13(0x35,t,r,SED_C_NEVER,0,0,0,len)
#define DEPWR(r,pos,len,t)	f16(0x35,t,r,SED_C_NEVER,0,1,1,31-(pos),len)
#define DEPWR_Z(r,pos,len,t)	f16(0x35,t,r,SED_C_NEVER,0,1,0,31-(pos),len)
#define SHLWI(r,sa,t)		DEPWR_Z(r,31-(sa),32-(sa),t)
#define DEPWI(i,len,t)		f13x(0x35,t,i,SED_C_NEVER,2,1,0,len)
#define DEPWI_Z(i,len,t)	f13x(0x35,t,i,SED_C_NEVER,2,0,0,len)
#define DEPWRI(i,pos,len,t)	f16x(0x35,t,i,SED_C_NEVER,1,1,1,31-(pos),len)
#define DEPWRI_Z(i,pos,len,t)	f16x(0x35,t,i,SED_C_NEVER,1,1,0,31-(pos),len)
#define DIAG(i)			f28(0x5,i)
#define DS(r1,r2,t)		f8(0x2,r2,r1,ADD_CF_NV,1,0,0,1,0,t)
#define EXTRW(r,len,t)		f12(0x34,r,t,SED_C_NEVER,2,1,0,0,0,len)
#define EXTRW_U(r,len,t)	f12(0x34,r,t,SED_C_NEVER,2,0,0,0,0,len)
#define EXTRWR(r,pos,len,t)	f15(0x34,r,t,SED_C_NEVER,1,1,1,pos,len)
#define SHRWI(r,sa,t)		EXTRWR(r,31-(sa),32-(sa),t)
#define EXTRWR_U(r,pos,len,t)	f15(0x34,r,t,SED_C_NEVER,1,1,0,pos,len)
#define SHRWI_U(r,sa,t)		EXTRWR_U(r,31-(sa),32-(sa),t)
#define FDC(x,s,b)		f24(0x1,b,x,s,0x4a,0,0)
#define FDC_M(x,s,b)		f24(0x1,b,x,s,0x4a,1,0)
#define FDCI(i,s,b)		f25(0x1,b,i,s,0xca,0,0)
#define FDCE(x,s,b)		f24(0x1,b,x,s,0x4b,0,0)
#define FDCE_M(x,s,b)		f24(0x1,b,x,s,0x4b,1,0)
#define FIC(x,s,b)		f26(0x1,b,x,s,0xa,0,0)
#define FIC_M(x,s,b)		f26(0x1,b,x,s,0xa,1,0)
#define FICI(x,s,b)		f25(0x1,b,x,s,0x4f,0,0)
#define FICI_M(x,s,b)		f25(0x1,b,x,s,0x4f,1,0)
#define FICE(x,s,b)		f26(0x1,b,x,s,0xb,0,0)
#define FICE_M(x,s,b)		f26(0x1,b,x,s,0xb,1,0)
#define HADD_(c,r1,r2,t)	f8(0x2,r2,r1,0,0,1,1,c,0,t)
#define HADD(r1,r2,t)		HADD_(3,r1,r2,t)
#define HADD_SS(r1,r2,t)	HADD_(1,r1,r2,t)
#define HADD_US(r1,r2,t)	HADD_(0,r1,r2,t)
#define HAVG(r1,r2,t)		f8(0x2,r2,r1,0,0,1,0,3,0,t)
#define HSHL(r,sa,t)		f10(0x3e,0,r,1,0,0,2,sa,0,t)
#define HSHLADD(r1,sa,r2,t)	f8(0x2,r2,r1,0,1,1,1,sa,0,t)
#define HSHR(r,sa,t)		f10(0x3e,r,0,1,2,0,3,sa,0,t)
#define HSHR_U(r,sa,t)		f10(0x3e,r,0,1,2,0,2,sa,0,t)
#define HSHRADD(r1,sa,r2,t)	f8(0x2,r2,r1,0,1,0,1,sa,0,t)
#define HSUB_(c,r1,r2,t)	f8(0x2,r2,r1,0,0,0,1,c,0,t)
#define HSUB(r1,r2,t)		HSUB_(3,r1,r2,t)
#define HSUB_SS(r1,r2,t)	HSUB_(1,r1,r2,t)
#define HSUB_US(r1,r2,t)	HSUB_(0,r1,r2,t)
#define IDTLBT(r1,r2)		f26(0x1,r2,r1,0,0x60,0,0)
#define IITLBT(r1,r2)		f26(0x1,r2,r1,0,0x20,0,0)
#define LCI(x,s,b,t)		f24(0x1,b,x,s,0x4c,0,t)
#define LDBL(i,b,t)		f1(0x10,b,t,i)
#define LDB(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,0,0,t)
#define LDBI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,0,0,t)
#define LDCD(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,5,0,t)
#define LDCDI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,5,0,t)
#define LDCW(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,7,0,t)
#define LDCWI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,7,0,t)
#define LDDL(i,b,t)		f3(0x14,b,t,i,0)
#define LDD(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,3,0,t)
#define LDDI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,3,0,t)
#define LDDA(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,4,0,t)
#define LDDAI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,4,0,t)
#define LDHL(i,b,t)		f1(0x11,b,t,i)
#define LDH(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,1,0,t)
#define LDHI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,1,0,t)
#define LDIL(i,t)		f7(0x8,t,i)
#define LDO(i,b,t)		f1(0xd,b,t,i)
#define LDI(i,t)		LDO(i,0,t)
#define LDSID(s,b,t)		f30(0x0,b,0,s,0,0x85,t)
#define LDWL(i,b,t)		f1(0x12,b,t,i)
#define LDWL_MB(i,b,t)		f1(0x13,b,t,i)	/* pre-dec or post-inc */
#define LDWL_MA(i,b,t)		f2(0x17,b,t,i,2)/* post-dec or pre-inc */
#define LDW(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,2,0,t)
#define LDWI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,2,0,t)
#define LDWA(x,b,t)		f4(0x3,b,x,0,0,0,LD_CC_H_NONE,6,0,t)
#define LDWAI(i,b,t)		f5(0x3,b,i,0,0,1,LD_CC_H_NONE,6,0,t)
#define LPA(x,s,b,t)		f24(0x1,b,x,s,0x4d,0,t)
#define MFSP(s,t)		f29(0x0,0,0,s,0x25,t)
#define MIXH_L(r1,r2,t)		f10(0x3e,r2,r1,1,0,0,1,0,0,t)
#define MIXH_R(r1,r2,t)		f10(0x3e,r2,r1,1,2,0,1,0,0,t)
#define MIXW_L(r1,r2,t)		f10(0x3e,r2,r1,1,0,0,0,0,0,t)
#define MIXW_R(r1,r2,t)		f10(0x3e,r2,r1,1,2,0,0,0,0,t)
#define MOVB_(c,r1,r2,i)	f17(0x32,r2,r1,c,i,0)
#define MOVB(r1,r2,i)		MOVB_(SED_C_NEVER,r1,r2,i)
#define MOVB_EQ(r1,r2,i)	MOVB_(SED_C_EQ,r1,r2,i)
#define MOVB_LT(r1,r2,i)	MOVB_(SED_C_LT,r1,r2,i)
#define MOVB_OD(r1,r2,i)	MOVB_(SED_C_OD,r1,r2,i)
#define MOVB_TR(r1,r2,i)	MOVB_(SED_C_TR,r1,r2,i)
#define MOVB_NE(r1,r2,i)	MOVB_(SED_C_NE,r1,r2,i)
#define MOVB_GE(r1,r2,i)	MOVB_(SED_C_GE,r1,r2,i)
#define MOVB_EV(r1,r2,i)	MOVB_(SED_C_EV,r1,r2,i)
#define MOVIB_(c,r,i,t)		f17x(0x33,r,i,c,t,0)
#define MOVIB(i,r,t)		MOVIB_(SED_C_NEVER,i,r,t)
#define MOVIB_EQ(i,r,t)		MOVIB_(SED_C_EQ,i,r,t)
#define MOVIB_LT(i,r,t)		MOVIB_(SED_C_LT,i,r,t)
#define MOVIB_OD(i,r,t)		MOVIB_(SED_C_OD,i,r,t)
#define MOVIB_TR(i,r,t)		MOVIB_(SED_C_TR,i,r,t)
#define MOVIB_NE(i,r,t)		MOVIB_(SED_C_NE,i,r,t)
#define MOVIB_GE(i,r,t)		MOVIB_(SED_C_GE,i,r,t)
#define MOVIB_EV(i,r,t)		MOVIB_(SED_C_EV,i,r,t)
#define MTCTL(r,t)		f31(0x0,t,r,0,0xc2,0)
#define MTSAR(r)		MTCTL(r,_CR11_REGNO)
#define MTSARCM(r)		f31(0x0,0xb,r,0,0xc6,0)
#define MTSM(r)			f33(0x0,0,r,0,0xc3,0)
#define MTSP(r,s)		f29(0x0,0,r,s,0xc1,0)
#define OR_(c,r1,r2,t)		f8(0x2,r2,r1,c,0,1,0,1,0,t)
#define OR(r1,r2,t)		OR_(LOG_CC_NV,r1,r2,t)
#define NOP()			OR(_R0_REGNO,_R0_REGNO,_R0_REGNO)
#define COPY(r,t)		OR(r,0,t)
#define PDC(x,s,b)		f24(0x1,b,x,s,0x4e,0,0)
#define PDTLB(x,s,b)		f24(0x1,b,x,s,0x48,0,0)
#define PDTLB_L(x,s,b)		f24(0x1,b,x,s,0x58,0,0)
#define PDTLBE(x,s,b)		f24(0x1,b,x,s,0x49,0,0)
#define PERMH(c,r,t)		f10(0x3e,r,r,0,(c)&3,0,((c)>>2)&3,(((c)>>2)&6)|(((c)>>6)&3),0,t)
#define PITBL(x,s,b)		f26(0x1,b,x,s,0x08,0,0)
#define PITBL_L(x,s,b)		f26(0x1,b,x,s,0x18,0,0)
#define PITBLE(x,s,b)		f26(0x1,b,x,s,0x09,0,0)
#define POPBTS(i)		f23(0x3a,0,0,2,0,i,1,0,1)
#define PROBE_R(s,b,r,t)	f24(0x1,b,r,s,0x46,0,t)
#define PROBE_W(s,b,r,t)	f24(0x1,b,r,s,0x47,0,t)
#define PROBEI_R(s,b,i,t)	f24(0x1,b,i,s,0x46,0,t)
#define PROBEI_W(s,b,i,t)	f24(0x1,b,i,s,0x47,0,t)
#define PUSHBTS(r)		f23(0x3a,0,r,2,0,0,0,0,1)
#define PUSHNOM()		f23(0x3a,0,0,2,0,0,0,0,1)
#define RFI()			f33(0x0,0,0,0,0x60,0)
#define RFI_R()			f33(0x0,0,0,0,0x65,0)
#define RSM(i,t)		f33(0x0,((i)&0x3e0)>>5,(i)&0x1f,0,0x73,t)
#define SHLADD_(e,cf,r1,sa,r2,t) f8(0x2,r2,r1,cf,e,1,0,sa,0,t)
#define SHLADD(r1,sa,r2,t)	SHLADD_(1,ADD_CF_NV,r1,sa,r2,t)
#define SHLADD_L(r1,sa,r2,t)	SHLADD_(2,ADD_CF_NV,r1,sa,r2,t)
#define SHLADD_TSV(r1,sa,r2,t)	SHLADD_(3,ADD_CF_NV,r1,sa,r2,t)
#define SHRPD(r1,r2,t)		f11(0x34,r2,r1,SED_C_NEVER,0,0,1,0,t)
#define SHRPDI(r1,r2,sa,t)	f14(0x34,r2,r1,SED_C_NEVER,0,(63-(sa))>>5,1,(63-(sa))&0x1f,t)
#define SHRPW(r1,r2,t)		f11(0x34,r2,r1,SED_C_NEVER,0,0,0,0,t)
#define SHRPWI(r1,r2,sa,t)	f14(0x34,r2,r1,SED_C_NEVER,0,1,0,31-(sa),t)
#define SPOP0(sf,so)		f34(0x4,(so)>>5,0,sf,0,(so)&0x1f)
#define SPOP1(sf,so,t)		f35(0x4,so,1,sf,0,t)
#define SPOP2(sf,so,r)		f36(0x4,r,(so)>>5,2,sf,0,(so)&0x1f)
#define SPOP3(sf,so,r1,r2)	f37(0x4,r2,r1,(so)>>5,3,sf,0,(so)&0x1f)
#define SSM(i,t)		f33(0x00,(i)>>5,(i)&0x1f,0,0x6b,t)
#define STBL(r,i,b)		f1(0x18,b,r,i)
#define STBI(r,i,b)		f6(0x3,b,r,0,0,1,LD_CC_H_NONE,0x8,0,i)
#define STDL(r,i,b)		f3(0x1c,b,r,i,0)
#define STDI(r,i,b)		f6(0x3,b,r,0,0,1,LD_CC_H_NONE,0xc,0,i)
#define STDA(r,i,b)		f6(0x3,b,r,0,0,1,LD_CC_H_NONE,0xf,0,i)
#define STHL(r,i,b)		f1(0x19,b,r,i)
#define STHI(r,i,b)		f6(0x3,b,r,0,0,1,LD_CC_H_NONE,0x9,0,i)
#define STWL(r,i,b)		f1(0x1a,b,r,i)
#define STWL_MA(r,i,b)		f1(0x1b,b,r,i)	/* pre-dec or post-inc */
#define STWL_MB(r,i,b)		f2(0x1f,b,r,i,2)/* post-dec or pre-inc */
#define STWI(r,i,b)		f6(0x3,b,r,0,0,1,LD_CC_H_NONE,0xa,0,i)
#define STWA(r,i,b)		f6(0x3,b,r,0,0,1,LD_CC_H_NONE,0xe,0,i)
#define SUB_(e1,e2,cf,r1,r2,t)	f8(0x2,r2,r1,cf,e1,0,e2,0,0,t)
#define SUB(r1,r2,t)		SUB_(1,0,CS_CC_NV,r1,r2,t)
#define SUB_B(r1,r2,t)		SUB_(1,1,CS_CC_NV,r1,r2,t)
#define SUB_SV(r1,r2,t)		SUB_(1,0,CS_CC_SV,r1,r2,t)
#define SUB_NSV(r1,r2,t)	SUB_(1,0,CS_CC_NSV,r1,r2,t)
/* actually, rsbi */
#define SUBI_(e1,cf,i,r,t)	f9(0x25,r,t,cf,e1,i)
#define SUBI(i,r,t)		SUBI_(0,ADD_CF_NV,i,r,t)
#define SYNC()			f33(0x0,0,0,0,0x20,0)
#define SYNCDMA()		f33(0x0,0,1<<4,0,0x20,0)
#define UADDCM(r1,r2,t)		f8(0x2,r2,r1,ADD_CF_NV,2,0,1,2,0,t)
#define UXOR(r1,r2,t)		f8(0x2,r2,r1,LOG_CC_NV,0,1,1,2,0,t)
#define XOR(r1,r2,t)		f8(0x2,r2,r1,LOG_CC_NV,0,1,0,2,0,t)
#  define nop(c)			_nop(_jit,c)
static void _nop(jit_state_t*,jit_int32_t);
#define movr(r0,r1)		_movr(_jit,r0,r1)
static void _movr(jit_state_t*,jit_int32_t,jit_int32_t);
#define movi(r0,i0)		_movi(_jit,r0,i0)
static void _movi(jit_state_t*,jit_int32_t,jit_word_t);
#define movi_p(r0,i0)		_movi_p(_jit,r0,i0)
static jit_word_t _movi_p(jit_state_t*,jit_int32_t,jit_word_t);
#define comr(r0,r1)		UADDCM(_R0_REGNO,r1,r0)
#define negr(r0,r1)		SUB(_R0_REGNO,r1,r0)
#define extr_c(r0,r1)		EXTRWR(r1,31,8,r0)
#define extr_uc(r0,r1)		EXTRWR_U(r1,31,8,r0)
#define extr_s(r0,r1)		EXTRWR(r1,31,16,r0)
#define extr_us(r0,r1)		EXTRWR_U(r1,31,16,r0)
#if __BYTE_ORDER == __BIG_ENDIAN
#  define htonr_us(r0,r1)	extr_us(r0,r1)
#  define htonr_ui(r0,r1)	movr(r0,r1)
#else
#  error need htonr implementation
#endif
#define addr(r0,r1,r2)		ADD(r1,r2,r0)
#define addi(r0,r1,i0)		_addi(_jit,r0,r1,i0)
static void _addi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define addcr(r0,r1,r2)		addr(r0,r1,r2)
#define addci(r0,r1,i0)		_addci(_jit,r0,r1,i0)
static void _addci(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define addxr(r0,r1,r2)		ADD_C(r1,r2,r0)
#define addxi(r0,r1,i0)		_addxi(_jit,r0,r1,i0)
static void _addxi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define subr(r0,r1,r2)		SUB(r1,r2,r0)
#define subi(r0,r1,i0)		_subi(_jit,r0,r1,i0)
static void _subi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define subcr(r0,r1,r2)		subr(r0,r1,r2)
#define subci(r0,r1,i0)		_subci(_jit,r0,r1,i0)
static void _subci(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define subxr(r0,r1,r2)		SUB_B(r1,r2,r0)
#define subxi(r0,r1,i0)		_subxi(_jit,r0,r1,i0)
static void _subxi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define rsbi(r0, r1, i0)	_rsbi(_jit, r0, r1, i0)
static void _rsbi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define mulr(r0,r1,r2)		_mulr(_jit,r0,r1,r2)
static void _mulr(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define muli(r0,r1,i0)		_muli(_jit,r0,r1,i0)
static void _muli(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
static long long __llmul(int, int);
#define qmulr(r0,r1,r2,r3)	_qmulr(_jit,r0,r1,r2,r3)
static void _qmulr(jit_state_t*,
		   jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define qmuli(r0,r1,r2,i0)	_qmuli(_jit,r0,r1,r2,i0)
static void _qmuli(jit_state_t*,
		   jit_int32_t,jit_int32_t,jit_int32_t,jit_word_t);
#define qmulr_u(r0,r1,r2,r3)	_qmulr_u(_jit,r0,r1,r2,r3)
static void _qmulr_u(jit_state_t*,
		     jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define qmuli_u(r0,r1,r2,i0)	_qmuli_u(_jit,r0,r1,r2,i0)
static void _qmuli_u(jit_state_t*,
		     jit_int32_t,jit_int32_t,jit_int32_t,jit_word_t);
static int __idiv(int, int);
#define divr(r0,r1,r2)		_divr(_jit,r0,r1,r2)
static void _divr(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define divi(r0,r1,i0)		_divi(_jit,r0,r1,i0)
static void _divi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
static unsigned int __udiv(unsigned int, unsigned int);
#define divr_u(r0,r1,r2)	_divr_u(_jit,r0,r1,r2)
static void _divr_u(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define divi_u(r0,r1,i0)	_divi_u(_jit,r0,r1,i0)
static void _divi_u(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
static int __irem(int, int);
#define remr(r0,r1,r2)		_remr(_jit,r0,r1,r2)
static void _remr(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define remi(r0,r1,i0)		_remi(_jit,r0,r1,i0)
static void _remi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
static unsigned int __urem(unsigned int, unsigned int);
#define remr_u(r0,r1,r2)	_remr_u(_jit,r0,r1,r2)
static void _remr_u(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define remi_u(r0,r1,i0)	_remi_u(_jit,r0,r1,i0)
static void _remi_u(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
static idiv_t __idivrem(int, int);
#define qdivr(r0,r1,r2,r3)	_qdivr(_jit,r0,r1,r2,r3)
static void _qdivr(jit_state_t*,
		   jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define qdivi(r0,r1,r2,i0)	_qdivi(_jit,r0,r1,r2,i0)
static void _qdivi(jit_state_t*,
		   jit_int32_t,jit_int32_t,jit_int32_t,jit_word_t);
static udiv_t __udivrem(unsigned int, unsigned int);
#define qdivr_u(r0,r1,r2,r3)	_qdivr_u(_jit,r0,r1,r2,r3)
static void _qdivr_u(jit_state_t*,
		     jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define qdivi_u(r0,r1,r2,i0)	_qdivi_u(_jit,r0,r1,r2,i0)
static void _qdivi_u(jit_state_t*,
		     jit_int32_t,jit_int32_t,jit_int32_t,jit_word_t);
#define andr(r0,r1,r2)		AND(r1,r2,r0)
#define andi(r0,r1,i0)		_andi(_jit,r0,r1,i0)
static void _andi(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define orr(r0,r1,r2)		OR(r1,r2,r0)
#define ori(r0,r1,i0)		_ori(_jit,r0,r1,i0)
static void _ori(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define xorr(r0,r1,r2)		XOR(r1,r2,r0)
#define xori(r0,r1,i0)		_xori(_jit,r0,r1,i0)
static void _xori(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define lshr(r0,r1,r2)		_lshr(_jit,r0,r1,r2)
static void _lshr(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define lshi(r0,r1,i0)		SHLWI(r1,i0,r0)
#define rshr(r0,r1,r2)		_rshr(_jit,r0,r1,r2)
static void _rshr(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define rshi(r0,r1,i0)		SHRWI(r1,i0,r0)
#define rshr_u(r0,r1,r2)	_rshr_u(_jit,r0,r1,r2)
static void _rshr_u(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define rshi_u(r0,r1,i0)	SHRWI_U(r1,i0,r0)
#define cmpr(c,r0,r1,r2)	_cmpr(_jit,c,r0,r1,r2)
static void _cmpr(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t,jit_int32_t);
#define cmpi(c,ci,r0,r1,i0)	_cmpi(_jit,c,ci,r0,r1,i0)
static void _cmpi(jit_state_t*,jit_word_t,jit_word_t,
		  jit_int32_t,jit_int32_t,jit_word_t);
#define ltr(r0,r1,r2)		cmpr(CS_CC_GE,r0,r1,r2)
#define lti(r0,r1,i0)		cmpi(CS_CC_GE,CS_CC_LE,r0,r1,i0)
#define ltr_u(r0,r1,r2)		cmpr(CS_CC_UGE,r0,r1,r2)
#define lti_u(r0,r1,i0)		cmpi(CS_CC_UGE,CS_CC_ULE,r0,r1,i0)
#define ler(r0,r1,r2)		cmpr(CS_CC_GT,r0,r1,r2)
#define lei(r0,r1,i0)		cmpi(CS_CC_GT,CS_CC_LT,r0,r1,i0)
#define ler_u(r0,r1,r2)		cmpr(CS_CC_UGT,r0,r1,r2)
#define lei_u(r0,r1,i0)		cmpi(CS_CC_UGT,CS_CC_ULT,r0,r1,i0)
#define eqr(r0,r1,r2)		cmpr(CS_CC_NE,r0,r1,r2)
#define eqi(r0,r1,i0)		cmpi(CS_CC_NE,CS_CC_NE,r0,r1,i0)
#define ger(r0,r1,r2)		cmpr(CS_CC_LT,r0,r1,r2)
#define gei(r0,r1,i0)		cmpi(CS_CC_LT,CS_CC_GT,r0,r1,i0)
#define ger_u(r0,r1,r2)		cmpr(CS_CC_ULT,r0,r1,r2)
#define gei_u(r0,r1,i0)		cmpi(CS_CC_ULT,CS_CC_UGT,r0,r1,i0)
#define gtr(r0,r1,r2)		cmpr(CS_CC_LE,r0,r1,r2)
#define gti(r0,r1,i0)		cmpi(CS_CC_LE,CS_CC_GE,r0,r1,i0)
#define gtr_u(r0,r1,r2)		cmpr(CS_CC_ULE,r0,r1,r2)
#define gti_u(r0,r1,i0)		cmpi(CS_CC_ULE,CS_CC_UGE,r0,r1,i0)
#define ner(r0,r1,r2)		cmpr(CS_CC_EQ,r0,r1,r2)
#define nei(r0,r1,i0)		cmpi(CS_CC_EQ,CS_CC_EQ,r0,r1,i0)
#define ldr_c(r0,r1)		_ldr_c(_jit,r0,r1)
static void _ldr_c(jit_state_t*,jit_int32_t,jit_int32_t);
#define ldi_c(r0,i0)		_ldi_c(_jit,r0,i0)
static void _ldi_c(jit_state_t*,jit_int32_t,jit_word_t);
#define ldxr_c(r0,r1,r2)	_ldxr_c(_jit,r0,r1,r2)
static void _ldxr_c(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define ldxi_c(r0,r1,i0)	_ldxi_c(_jit,r0,r1,i0)
static void _ldxi_c(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define ldr_uc(r0,r1)		LDBI(_R0_REGNO,r1,r0)
#define ldi_uc(r0,i0)		_ldi_uc(_jit,r0,i0)
static void _ldi_uc(jit_state_t*,jit_int32_t,jit_word_t);
#define ldxr_uc(r0,r1,r2)	LDB(r2,r1,r0)
#define ldxi_uc(r0,r1,i0)	_ldxi_uc(_jit,r0,r1,i0)
static void _ldxi_uc(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define ldr_s(r0,r1)		_ldr_s(_jit,r0,r1)
static void _ldr_s(jit_state_t*,jit_int32_t,jit_int32_t);
#define ldi_s(r0,i0)		_ldi_s(_jit,r0,i0)
static void _ldi_s(jit_state_t*,jit_int32_t,jit_word_t);
#define ldxr_s(r0,r1,r2)	_ldxr_s(_jit,r0,r1,r2)
static void _ldxr_s(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define ldxi_s(r0,r1,i0)	_ldxi_s(_jit,r0,r1,i0)
static void _ldxi_s(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define ldr_us(r0,r1)		LDHI(_R0_REGNO,r1,r0)
#define ldi_us(r0,i0)		_ldi_us(_jit,r0,i0)
static void _ldi_us(jit_state_t*,jit_int32_t,jit_word_t);
#define ldxr_us(r0,r1,r2)	LDH(r2,r1,r0)
#define ldxi_us(r0,r1,i0)	_ldxi_us(_jit,r0,r1,i0)
static void _ldxi_us(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define ldr(r0,r1)		ldr_ui(r0,r1)
#define ldr_i(r0,r1)		ldr_ui(r0,r1)
#define ldr_ui(r0,r1)		LDWI(_R0_REGNO,r1,r0)
#define ldi_i(r0,i0)		ldi_ui(r0,i0)
#define ldi_ui(r0,i0)		_ldi_ui(_jit,r0,i0)
static void _ldi_ui(jit_state_t*,jit_int32_t,jit_word_t);
#define ldxr_i(r0,r1,r2)	ldxr_ui(r0,r1,r2)
#define ldxr_ui(r0,r1,r2)	LDW(r2,r1,r0)
#define ldxi(r0,r1,i0)		ldxi_ui(r0,r1,i0)
#define ldxi_i(r0,r1,i0)	ldxi_ui(r0,r1,i0)
#define ldxi_ui(r0,r1,i0)	_ldxi_ui(_jit,r0,r1,i0)
static void _ldxi_ui(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
#define str_c(r0,r1)		STBI(r1,_R0_REGNO,r0)
#define sti_c(i0,r0)		_sti_c(_jit,i0,r0)
static void _sti_c(jit_state_t*,jit_word_t,jit_int32_t);
#define stxr_c(r0,r1,r2)	_stxr_c(_jit,r0,r1,r2)
static void _stxr_c(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define stxi_c(i0,r0,r1)	_stxi_c(_jit,i0,r0,r1)
static void _stxi_c(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define str_s(r0,r1)		STHI(r1,_R0_REGNO,r0)
#define sti_s(i0,r0)		_sti_s(_jit,i0,r0)
static void _sti_s(jit_state_t*,jit_word_t,jit_int32_t);
#define stxr_s(r0,r1,r2)	_stxr_s(_jit,r0,r1,r2)
static void _stxr_s(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define stxi_s(i0,r0,r1)	_stxi_s(_jit,i0,r0,r1)
static void _stxi_s(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define str_i(r0,r1)		STWI(r1,_R0_REGNO,r0)
#define sti_i(i0,r0)		_sti_i(_jit,i0,r0)
static void _sti_i(jit_state_t*,jit_word_t,jit_int32_t);
#define stxr_i(r0,r1,r2)	_stxr_i(_jit,r0,r1,r2)
static void _stxr_i(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
#define stxi(i0,r0,r1)		stxi_i(i0,r0,r1)
#define stxi_i(i0,r0,r1)	_stxi_i(_jit,i0,r0,r1)
static void _stxi_i(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bcmpr(c,i0,r0,r1)	_bcmpr(_jit,c,i0,r0,r1)
static jit_word_t _bcmpr(jit_state_t*,jit_word_t,
			 jit_word_t,jit_int32_t,jit_int32_t);
#define bcmpi(c,ci,i0,r0,i1)	_bcmpi(_jit,c,ci,i0,r0,i1)
static jit_word_t _bcmpi(jit_state_t*,jit_word_t,jit_word_t,
			 jit_word_t,jit_int32_t,jit_word_t);
#define bltr(i0,r0,r1)		bcmpr(CS_CC_LT,i0,r0,r1)
#define blti(i0,r0,r1)		bcmpi(CS_CC_LT,CS_CC_GT,i0,r0,r1)
#define bltr_u(i0,r0,r1)	bcmpr(CS_CC_ULT,i0,r0,r1)
#define blti_u(i0,r0,r1)	bcmpi(CS_CC_ULT,CS_CC_UGT,i0,r0,r1)
#define bler(i0,r0,r1)		bcmpr(CS_CC_LE,i0,r0,r1)
#define blei(i0,r0,r1)		bcmpi(CS_CC_LE,CS_CC_GE,i0,r0,r1)
#define bler_u(i0,r0,r1)	bcmpr(CS_CC_ULE,i0,r0,r1)
#define blei_u(i0,r0,r1)	bcmpi(CS_CC_ULE,CS_CC_UGE,i0,r0,r1)
#define beqr(i0,r0,r1)		bcmpr(CS_CC_EQ,i0,r0,r1)
#define beqi(i0,r0,r1)		bcmpi(CS_CC_EQ,CS_CC_EQ,i0,r0,r1)
#define bger(i0,r0,r1)		bcmpr(CS_CC_GE,i0,r0,r1)
#define bgei(i0,r0,r1)		bcmpi(CS_CC_GE,CS_CC_LE,i0,r0,r1)
#define bger_u(i0,r0,r1)	bcmpr(CS_CC_UGE,i0,r0,r1)
#define bgei_u(i0,r0,r1)	bcmpi(CS_CC_UGE,CS_CC_ULE,i0,r0,r1)
#define bgtr(i0,r0,r1)		bcmpr(CS_CC_GT,i0,r0,r1)
#define bgti(i0,r0,r1)		bcmpi(CS_CC_GT,CS_CC_LT,i0,r0,r1)
#define bgtr_u(i0,r0,r1)	bcmpr(CS_CC_UGT,i0,r0,r1)
#define bgti_u(i0,r0,r1)	bcmpi(CS_CC_UGT,CS_CC_ULT,i0,r0,r1)
#define bner(i0,r0,r1)		bcmpr(CS_CC_NE,i0,r0,r1)
#define bnei(i0,r0,r1)		bcmpi(CS_CC_NE,CS_CC_NE,i0,r0,r1)
#define bmxr(c,i0,r0,r1)	_bmxr(_jit,c,i0,r0,r1)
static jit_word_t _bmxr(jit_state_t*,jit_bool_t,
			jit_word_t,jit_int32_t,jit_int32_t);
#define bmxi(c,i0,r0,i1)	_bmxi(_jit,c,i0,r0,i1)
static jit_word_t _bmxi(jit_state_t*,jit_bool_t,
			jit_word_t,jit_int32_t,jit_word_t);
#define bmcr(r0,r1,r2)		bmxr(0,r0,r1,r2)
#define bmci(r0,r1,r2)		bmxi(0,r0,r1,r2)
#define bmsr(r0,r1,r2)		bmxr(1,r0,r1,r2)
#define bmsi(r0,r1,r2)		bmxi(1,r0,r1,r2)
#define boaddr(i0,r0,r1)	_boaddr(_jit,i0,r0,r1)
static jit_word_t _boaddr(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define boaddi(i0,r0,i1)	_boaddi(_jit,i0,r0,i1)
static jit_word_t _boaddi(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define boaddr_u(i0,r0,r1)	_boaddr_u(_jit,i0,r0,r1)
static jit_word_t _boaddr_u(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define boaddi_u(i0,r0,i1)	_boaddi_u(_jit,i0,r0,i1)
static jit_word_t _boaddi_u(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define bxaddr(i0,r0,r1)	_bxaddr(_jit,i0,r0,r1)
static jit_word_t _bxaddr(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bxaddi(i0,r0,i1)	_bxaddi(_jit,i0,r0,i1)
static jit_word_t _bxaddi(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define bxaddr_u(i0,r0,r1)	_bxaddr_u(_jit,i0,r0,r1)
static jit_word_t _bxaddr_u(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bxaddi_u(i0,r0,i1)	_bxaddi_u(_jit,i0,r0,i1)
static jit_word_t _bxaddi_u(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define bosubr(i0,r0,r1)	_bosubr(_jit,i0,r0,r1)
static jit_word_t _bosubr(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bosubi(i0,r0,i1)	_bosubi(_jit,i0,r0,i1)
static jit_word_t _bosubi(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define bosubr_u(i0,r0,r1)	_bosubr_u(_jit,i0,r0,r1)
static jit_word_t _bosubr_u(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bosubi_u(i0,r0,i1)	_bosubi_u(_jit,i0,r0,i1)
static jit_word_t _bosubi_u(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define bxsubr(i0,r0,r1)	_bxsubr(_jit,i0,r0,r1)
static jit_word_t _bxsubr(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bxsubi(i0,r0,i1)	_bxsubi(_jit,i0,r0,i1)
static jit_word_t _bxsubi(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define bxsubr_u(i0,r0,r1)	_bxsubr_u(_jit,i0,r0,r1)
static jit_word_t _bxsubr_u(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
#define bxsubi_u(i0,r0,i1)	_bxsubi_u(_jit,i0,r0,i1)
static jit_word_t _bxsubi_u(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
#define jmpr(r0)		_jmpr(_jit,r0)
static void _jmpr(jit_state_t*,jit_int32_t);
#define jmpi(i0)		_jmpi(_jit,i0)
static void _jmpi(jit_state_t*,jit_word_t);
#define jmpi_p(i0)		_jmpi_p(_jit,i0)
static jit_word_t _jmpi_p(jit_state_t*,jit_word_t);
#define callr(r0)		_callr(_jit,r0)
static void _callr(jit_state_t*,jit_int32_t);
#define calli(i0)		_calli(_jit,i0)
static void _calli(jit_state_t*,jit_word_t);
#define calli_p(i0)		_calli_p(_jit,i0)
static jit_word_t _calli_p(jit_state_t*,jit_word_t);
#define prolog(node)		_prolog(_jit, node)
static void _prolog(jit_state_t*, jit_node_t*);
#define epilog(node)		_epilog(_jit, node)
static void _epilog(jit_state_t*, jit_node_t*);
#define vastart(r0)		_vastart(_jit, r0)
static void _vastart(jit_state_t*, jit_int32_t);
#define vaarg(r0, r1)		_vaarg(_jit, r0, r1)
static void _vaarg(jit_state_t*, jit_int32_t, jit_int32_t);
#define patch_at(i,l)		_patch_at(_jit,i,l)
static void _patch_at(jit_state_t*,jit_word_t,jit_word_t);
#endif

#if CODE
/* from binutils bfd/libhppa.h */
static inline int
sign_extend (int x, int len)
{
  int signbit = (1 << (len - 1));
  int mask = (signbit << 1) - 1;
  return ((x & mask) ^ signbit) - signbit;
}

static inline int
sign_unext (int x, int len)
{
  int len_ones;

  len_ones = (1 << len) - 1;

  return x & len_ones;
}

static inline int
low_sign_unext (int x, int len)
{
  int temp;
  int sign;

  sign = (x >> (len-1)) & 1;

  temp = sign_unext (x, len-1);

  return (temp << 1) | sign;
}

static inline int
re_assemble_3 (int as3)
{
  return ((  (as3 & 4) << (13-2))
	  | ((as3 & 3) << (13+1)));
}

static inline int
re_assemble_12 (int as12)
{
  return ((  (as12 & 0x800) >> 11)
	  | ((as12 & 0x400) >> (10 - 2))
	  | ((as12 & 0x3ff) << (1 + 2)));
}

static inline int
re_assemble_16 (int as16)
{
  int s, t;

  /* Unusual 16-bit encoding, for wide mode only.  */
  t = (as16 << 1) & 0xffff;
  s = (as16 & 0x8000);
  return (t ^ s ^ (s >> 1)) | (s >> 15);
}

static inline int
re_assemble_17 (int as17)
{
  return ((  (as17 & 0x10000) >> 16)
	  | ((as17 & 0x0f800) << (16 - 11))
	  | ((as17 & 0x00400) >> (10 - 2))
	  | ((as17 & 0x003ff) << (1 + 2)));
}

static inline int
re_assemble_21 (int as21)
{
  return ((  (as21 & 0x100000) >> 20)
	  | ((as21 & 0x0ffe00) >> 8)
	  | ((as21 & 0x000180) << 7)
	  | ((as21 & 0x00007c) << 14)
	  | ((as21 & 0x000003) << 12));
}

static inline int
re_assemble_22 (int as22)
{
  return ((  (as22 & 0x200000) >> 21)
	  | ((as22 & 0x1f0000) << (21 - 16))
	  | ((as22 & 0x00f800) << (16 - 11))
	  | ((as22 & 0x000400) >> (10 - 2))
	  | ((as22 & 0x0003ff) << (1 + 2)));
}

static void
_f1(jit_state_t *_jit, jit_int32_t o,
    jit_int32_t b, jit_int32_t t, jit_int32_t i)
{
    assert(!(o  & ~0x3f));
    assert(!(b  & ~0x1f));
    assert(!(t  & ~0x1f));
    assert(i >= -8192 && i <= 8191);
    ii((o<<26)|(b<<21)|(t<<16)|(re_assemble_16(i)));
}

static void
_f2(jit_state_t *_jit, jit_int32_t o,
    jit_int32_t b, jit_int32_t t, jit_int32_t i, jit_int32_t j)
{
    assert(!(o  & ~0x3f));
    assert(!(b  & ~0x1f));
    assert(!(t  & ~0x1f));
    assert(i >= -32768 && i <= 32767);
    assert(!(j  &  ~0x3));
    ii((o<<26)|(b<<21)|(t<<16)|(j<<1)|(re_assemble_16(i)));
}

static void
_f3(jit_state_t *_jit, jit_int32_t o,
    jit_int32_t b, jit_int32_t t, jit_int32_t i, jit_int32_t j)
{
    assert(!(o  & ~0x3f));
    assert(!(b  & ~0x1f));
    assert(!(t  & ~0x1f));
    assert(i >= -32768 && i <= 32767);
    assert(!(j  &  ~0x1));
    ii((o<<26)|(b<<21)|(t<<16)|(j<<1)|(re_assemble_16(i)));
}

static void
_f4(jit_state_t *_jit, jit_int32_t o, jit_int32_t b,
    jit_int32_t x, jit_int32_t s, jit_int32_t u, jit_int32_t y,
    jit_int32_t c, jit_int32_t z, jit_int32_t m, jit_int32_t t)
{
    assert(!(o  & ~0x3f));
    assert(!(b  & ~0x1f));
    assert(!(x  & ~0x1f));
    assert(!(s  &  ~0x3));
    assert(!(u  &  ~0x1));
    assert(!(y  &  ~0x1));
    assert(!(c  &  ~0x3));
    assert(!(z  &  ~0xf));
    assert(!(m  &  ~0x1));
    assert(!(t  & ~0x1f));
    ii((o<<26)|(b<<21)|(x<<16)|(s<<14)|(u<<13)|(y<<12)|(c<<10)|(z<<6)|(m<<5)|t);
}

static void
_f5(jit_state_t *_jit, jit_int32_t o, jit_int32_t b,
    jit_int32_t i, jit_int32_t s, jit_int32_t a, jit_int32_t y,
    jit_int32_t c, jit_int32_t z, jit_int32_t m, jit_int32_t t)
{
    assert(!(o  & ~0x3f));
    assert(!(b  & ~0x1f));
    assert(!(s  &  ~0x3));
    assert(!(a  &  ~0x1));
    assert(!(y  &  ~0x1));
    assert(!(c  &  ~0x3));
    assert(!(z  &  ~0xf));
    assert(!(m  &  ~0x1));
    assert(i >= -16 && i <= 15);
    ii((o<<26)|(b<<21)|(low_sign_unext(i,5)<<16)|
       (s<<14)|(a<<13)|(y<<12)|(c<<10)|(z<<6)|(m<<5)|t);
}

static void
_f6(jit_state_t *_jit, jit_int32_t o, jit_int32_t b,
    jit_int32_t r, jit_int32_t s, jit_int32_t a, jit_int32_t x,
    jit_int32_t c, jit_int32_t y, jit_int32_t m, jit_int32_t i)
{
    assert(!(o  & ~0x3f));
    assert(!(b  & ~0x1f));
    assert(!(s  &  ~0x3));
    assert(!(a  &  ~0x1));
    assert(!(x  &  ~0x1));
    assert(!(c  &  ~0x3));
    assert(!(y  &  ~0xf));
    assert(!(m  &  ~0x1));
    assert(i >= -16 && i <= 15);
    ii((o<<26)|(b<<21)|(r<<16)|(s<<14)|(a<<13)|
       (x<<12)|(c<<10)|(y<<6)|(m<<5)|low_sign_unext(i,5));
}

static void
_f7(jit_state_t *_jit, jit_int32_t o, jit_int32_t r, jit_int32_t i)
{
    assert(!(o  & ~0x3f));
    assert(!(r  & ~0x1f));
    assert(!(i  &  0x7ff));
    ii((o<<26)|(r<<21)|re_assemble_21(i>>11));
}

static void
_f8(jit_state_t *_jit, jit_int32_t o,
    jit_int32_t r2, jit_int32_t r1, jit_int32_t cf,
    jit_int32_t e1, jit_int32_t x, jit_int32_t e2,
    jit_int32_t e3, jit_int32_t d, jit_int32_t t)
{
    assert(!(o  & ~0x3f));
    assert(!(r2 & ~0x1f));
    assert(!(r1 & ~0x1f));
    assert(!(cf &  ~0xf));
    assert(!(e1 &  ~0x3));
    assert(!(x  &  ~0x1));
    assert(!(e2 &  ~0x3));
    assert(!(e3 &  ~0x3));
    assert(!(d  &  ~0x1));
    assert(!(t  & ~0x1f));
    ii((o<<26)|(r2<<21)|(r1<<16)|(cf<<12)|
       (e1<<10)|(x<<9)|(e2<<8)|(e3<<6)|(d<<5)|t);
}

static void
_f9(jit_state_t *_jit,
    jit_int32_t o, jit_int32_t r, jit_int32_t t,
    jit_int32_t cf, jit_int32_t e1, jit_int32_t i)
{
    assert(!(o  & ~0x3f));
    assert(!(r  & ~0x1f));
    assert(!(t  & ~0x1f));
    assert(!(cf &  ~0xf));
    assert(!(e1 &  ~0x1));
    assert(i >= -2048 && i <= 2047);
    ii((o<<26)|(r<<21)|(t<<16)|(cf<<12)|(e1<<11)|low_sign_unext(i,11));
}

static void
_f10(jit_state_t *_jit, jit_int32_t o, jit_int32_t r2,
     jit_int32_t r1, jit_int32_t u, jit_int32_t v, jit_int32_t w,
     jit_int32_t x, jit_int32_t sa, jit_int32_t y, jit_int32_t t)
{
    assert(!(o  & ~0x3f));
    assert(!(r2 & ~0x1f));
    assert(!(r1 & ~0x1f));
    assert(!(u  &  ~0x1));
    assert(!(v  &  ~0x3));
    assert(!(w  &  ~0x1));
    assert(!(x  &  ~0x3));
    assert(!(sa &  ~0xf));
    assert(!(y  &  ~0x1));
    assert(!(t  & ~0x1f));
    ii((o<<26)|(r2<<21)|(r1<<16)|(u<<15)|
       (v<<13)|(w<<12)|(x<<10)|(sa<<6)|(y<<5)|t);
}

static void
_f11(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t r2, jit_int32_t r1, jit_int32_t c, jit_int32_t x,
     jit_int32_t y, jit_int32_t z, jit_int32_t u, jit_int32_t t)
{
    assert(!(o  & ~0x3f));
    assert(!(r1 & ~0x1f));
    assert(!(r2 & ~0x1f));
    assert(!(c  &  ~0x7));
    assert(!(x  &  ~0x3));
    assert(!(y  &  ~0x1));
    assert(!(z  &  ~0x1));
    assert(!(u  &  ~0xf));
    assert(!(t  & ~0x1f));
    ii((o<<26)|(r2<<21)|(r1<<16)|(c<<13)|(x<<11)|(y<<10)|(z<<9)|(u<<5)|t);
}

static void
_f12(jit_state_t *_jit, jit_int32_t o, jit_int32_t r,
     jit_int32_t t, jit_int32_t c, jit_int32_t x, jit_int32_t se,
     jit_int32_t y, jit_int32_t c1, jit_int32_t z, jit_int32_t clen)
{
    assert(!(o    & ~0x3f));
    assert(!(r    & ~0x1f));
    assert(!(t    & ~0x1f));
    assert(!(c    &  ~0x7));
    assert(!(x    &  ~0x3));
    assert(!(se   &  ~0x1));
    assert(!(y    &  ~0x1));
    assert(!(c1   &  ~0x1));
    assert(!(z    &  ~0x7));
    assert(!((32-clen) & ~0x1f));
    ii((o<<26)|(r<<21)|(t<<16)|(c<<13)|(x<<11)|
       (se<<10)|(y<<9)|(c1<<8)|(z<<5)|(32-clen));
}

static void
_f13(jit_state_t *_jit, jit_int32_t o, jit_int32_t t,
     jit_int32_t r, jit_int32_t c, jit_int32_t x,
     jit_int32_t nz, jit_int32_t c1, jit_int32_t clen)
{
    assert(!(o    & ~0x3f));
    assert(!(t    & ~0x1f));
    assert(!(r    & ~0x1f));
    assert(!(c    &  ~0x7));
    assert(!(x    &  ~0x3));
    assert(!(nz   &  ~0x1));
    assert(!(c1   &  ~0x1));
    assert(!((32-clen) & ~0x1f));
    ii((o<<26)|(t<<21)|(r<<16)|(c<<13)|
       (x<<11)|(nz<<10)|(c1<<8)|(32-clen));
}

static void
_f13x(jit_state_t *_jit, jit_int32_t o, jit_int32_t t,
      jit_int32_t i, jit_int32_t c, jit_int32_t x,
      jit_int32_t nz, jit_int32_t c1, jit_int32_t clen)
{
    assert(!(o    & ~0x3f));
    assert(!(t    & ~0x1f));
    assert(i >= -16 && i <= 15);
    assert(!(c    &  ~0x7));
    assert(!(x    &  ~0x3));
    assert(!(nz   &  ~0x1));
    assert(!((32-clen) & ~0x1f));
    ii((o<<26)|(t<<21)|(low_sign_unext(i,5)<<16)|
       (c<<13)|(x<<11)|(nz<<10)|(c1<<8)|(32-clen));
}

static void
_f14(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t r2, jit_int32_t r1, jit_int32_t c, jit_int32_t x,
     jit_int32_t cp, jit_int32_t y, jit_int32_t cpos, jit_int32_t t)
{
    assert(!(o    & ~0x3f));
    assert(!(r1   & ~0x1f));
    assert(!(r2   & ~0x1f));
    assert(!(c    &  ~0x7));
    assert(!(x    &  ~0x3));
    assert(!(cp   &  ~0x1));
    assert(!(y    &  ~0x1));
    assert(!(cpos & ~0x1f));
    assert(!(t    & ~0x1f));
    ii((o<<26)|(r2<<21)|(r1<<16)|(c<<13)|(x<<12)|(cp<<11)|(y<<10)|(cpos<<5)|t);
}

static void
_f15(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t r, jit_int32_t t, jit_int32_t c, jit_int32_t c1,
     jit_int32_t p, jit_int32_t se, jit_int32_t pos, jit_int32_t clen)
{
    assert(!(o    & ~0x3f));
    assert(!(r    & ~0x1f));
    assert(!(t    & ~0x1f));
    assert(!(c    &  ~0x7));
    assert(!(c1   &  ~0x1));
    assert(!(p    &  ~0x1));
    assert(!(se   &  ~0x1));
    assert(!(pos  & ~0x1f));
    assert(!((32-clen) & ~0x1f));
    ii((o<<26)|(r<<21)|(t<<16)|(c<<13)|(c1<<12)|
       (p<<11)|(se<<10)|(pos<<5)|(32-clen));
}

static void
_f16(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t t, jit_int32_t r, jit_int32_t c, jit_int32_t c1,
     jit_int32_t cp, jit_int32_t nz, jit_int32_t cpos, jit_int32_t clen)
{
    assert(!(o    & ~0x3f));
    assert(!(t    & ~0x1f));
    assert(!(r    & ~0x1f));
    assert(!(c    &  ~0x7));
    assert(!(c1   &  ~0x1));
    assert(!(cp   &  ~0x1));
    assert(!(nz   &  ~0x1));
    assert(!(cpos & ~0x1f));
    assert(!((32-clen) & ~0x3f));
    ii((o<<26)|(t<<21)|(r<<16)|(c<<13)|
       (c1<<12)|(cp<<11)|(nz<<10)|(cpos<<5)|(32-clen));
}

static void
_f16x(jit_state_t *_jit, jit_int32_t o,
      jit_int32_t t, jit_int32_t i, jit_int32_t c, jit_int32_t c1,
      jit_int32_t cp, jit_int32_t nz, jit_int32_t cpos, jit_int32_t clen)
{
    assert(!(o    & ~0x3f));
    assert(!(t    & ~0x1f));
    assert(i >= -16 && i <= 15);
    assert(!(c    &  ~0x7));
    assert(!(c1   &  ~0x1));
    assert(!(cp   &  ~0x1));
    assert(!(nz   &  ~0x1));
    assert(!(cpos & ~0x1f));
    assert(!((32-clen) & ~0x3f));
    ii((o<<26)|(t<<21)|(low_sign_unext(i,5)<<16)|(c<<13)|
       (c1<<12)|(cp<<11)|(nz<<10)|(cpos<<5)|(32-clen));
}

static void
_f17(jit_state_t *_jit, jit_int32_t o, jit_int32_t r2,
     jit_int32_t r1, jit_int32_t c, jit_int32_t i, jit_int32_t n)
{
    assert(!(o  & ~0x3f));
    assert(!(r2 & ~0x1f));
    assert(!(r1 & ~0x1f));
    assert(!(c  &  ~0x7));
    assert(i >= -2048 && i <= 2047);
    assert(!(n  &   ~0x1));
    ii((o<<26)|(r2<<21)|(r1<<16)|(c<<13)|re_assemble_12(i)|(n<<1));
}

static void
_f17x(jit_state_t *_jit, jit_int32_t o, jit_int32_t r,
      jit_int32_t i, jit_int32_t c, jit_int32_t t, jit_int32_t n)
{
    assert(!(o & ~0x3f));
    assert(!(r & ~0x1f));
    assert(i >= -16 && i <= 15);
    assert(!(c &  ~0x7));
    assert(t >= -2048 && t <= 2047);
    assert(!(n &  ~0x1));
    ii((o<<26)|(r<<21)|
       (low_sign_unext(i,5)<<16)|(c<<13)|re_assemble_12(t)|(n<<1));
}

static void
_f18(jit_state_t *_jit, jit_int32_t o, jit_int32_t p,
     jit_int32_t r, jit_int32_t c, jit_int32_t i, jit_int32_t n)
{
    assert(!(o & ~0x3f));
    assert(!(p & ~0x1f));
    assert(!(r & ~0x1f));
    assert(!(c &  ~0x1));
    assert(i >= -2048 && i <= 2047);
    assert(!(n &  ~0x1));
    ii((o<<26)|(p<<21)|(r<<16)|(c<<15)|(1<<14)|re_assemble_12(i)|(n<<1));
}

static void
_f19(jit_state_t *_jit, jit_int32_t o, jit_int32_t b,
     jit_int32_t s, jit_int32_t i, jit_int32_t n)
{
    assert(!(o & ~0x3f));
    assert(!(b & ~0x1f));
    assert(!(s &  ~0x7));
    assert(i >= -65536 && i <= 65535);
    assert(!(n &  ~0x1));
    ii((o<<26)|(b<<21)|re_assemble_3(s)|re_assemble_17(i)|(n<<1));
}

static void
_f20(jit_state_t *_jit, jit_int32_t o, jit_int32_t t,
     jit_int32_t i, jit_int32_t g, jit_int32_t n)
{
    assert(!(o & ~0x3f));
    assert(!(t & ~0x1f));
    assert(i >= -32768 && i <= 32767);
    assert(!(g &  ~0x7));
    assert(!(n &  ~0x1));
    ii((o<<26)|(t<<21)|(g<<13)|re_assemble_17(i)|(n<<1));
}

static void
_f21(jit_state_t *_jit, jit_int32_t o, jit_int32_t t,
     jit_int32_t x, jit_int32_t y, jit_int32_t n)
{
    assert(!(o & ~0x3f));
    assert(!(t & ~0x1f));
    assert(!(x & ~0x1f));
    assert(!(y &  ~0x7));
    assert(!(n &  ~0x1));
    ii((o<<26)|(t<<21)|(x<<16)|(y<<13)|(n<<1));
}

static void
_f22(jit_state_t *_jit, jit_int32_t o, jit_int32_t b,
     jit_int32_t x, jit_int32_t r, jit_int32_t n, jit_int32_t p)
{
    assert(!(o & ~0x3f));
    assert(!(b & ~0x1f));
    assert(!(x &  ~0x7));
    assert(!(r & ~0x3f));
    assert(!(n &  ~0x1));
    assert(!(p &  ~0x1));
    ii((o<<26)|(b<<21)|(x<<13)|(1<<12)|(r<<2)|(n<<1)|p);
}

static void
_f23(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t a, jit_int32_t b, jit_int32_t c, jit_int32_t d,
     jit_int32_t e, jit_int32_t f, jit_int32_t g, jit_int32_t h)
{
    assert(!(o &  ~0x3f));
    assert(!(a &  ~0x1f));
    assert(!(b &  ~0x1f));
    assert(!(c &   ~0x7));
    assert(!(d &   ~0x1));
    assert(!(e & ~0x1ff));
    assert(!(f &   ~0x1));
    assert(!(g &   ~0x1));
    assert(!(h &   ~0x1));
    ii((o<<26)|(a<<21)|(b<<16)|(c<<13)|(d<<12)|(e<<3)|(f<<2)|(g<<1)|h);
}

static void
_f24(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t b, jit_int32_t x, jit_int32_t s,
     jit_int32_t y, jit_int32_t m,jit_int32_t r)
{
    assert(!(o &  ~0x3f));
    assert(!(b &  ~0x1f));
    assert(!(x &  ~0x1f));
    assert(!(s &   ~0x3));
    assert(!(y &  ~0xff));
    assert(!(m &   ~0x1));
    assert(!(r &  ~0x1f));
    ii((o<<26)|(b<<21)|(x<<16)|(s<<14)|(y<<6)|(m<<5)|r);
}

static void
_f25(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t b, jit_int32_t i, jit_int32_t s,
     jit_int32_t y, jit_int32_t m, jit_int32_t r)
{
    assert(!(o &  ~0x3f));
    assert(!(b &  ~0x1f));
    assert(i >= -16 && i <= 15);
    assert(!(s &   ~0x3));
    assert(!(y &  ~0xff));
    assert(!(m &   ~0x1));
    assert(!(r &  ~0x1f));
    ii((o<<26)|(b<<21)|(low_sign_unext(i,5)<<16)|(s<<14)|(y<<6)|(m<<5)|r);
}

static void
_f26(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t b, jit_int32_t x, jit_int32_t s,
     jit_int32_t y, jit_int32_t m,jit_int32_t r)
{
    assert(!(o &  ~0x3f));
    assert(!(b &  ~0x1f));
    assert(!(x &  ~0x1f));
    assert(!(s &   ~0x7));
    assert(!(y &  ~0x7f));
    assert(!(m &   ~0x1));
    assert(!(r &  ~0x1f));
    ii((o<<26)|(b<<21)|(x<<16)|(s<<13)|(y<<6)|(m<<5)|r);
}

static void
_f27(jit_state_t *_jit, jit_int32_t o, jit_int32_t i, jit_int32_t j)
{
    assert(!(o & ~0x3f));
    assert(i >= -4096 && i < 4095);
    assert(j >=   -16 && j <   15);
    ii((o<<26)|(i<<13)|j);
}

static void
_f28(jit_state_t *_jit, jit_int32_t o, jit_int32_t i)
{
    assert(!(o &      ~0x3f));
    assert(!(i & ~0x1ffffff));
    ii((o<<26)|i);
}

static void
_f29(jit_state_t *_jit, jit_int32_t o, jit_int32_t r,
     jit_int32_t x, jit_int32_t s, jit_int32_t y, jit_int32_t t)
{
    assert(!(o & ~0x3f));
    assert(!(r & ~0x1f));
    assert(!(x & ~0x1f));
    assert(!(s &  ~0x7));
    assert(!(y & ~0xff));
    assert(!(t & ~0x1f));
    ii((o<<26)|(r<<21)|(x<<16)|re_assemble_3(s)|(y<<5)|t);
}

static void
_f30(jit_state_t *_jit, jit_int32_t o, jit_int32_t b, jit_int32_t r,
     jit_int32_t s, jit_int32_t x, jit_int32_t y, jit_int32_t t)
{
    assert(!(o & ~0x3f));
    assert(!(b & ~0x1f));
    assert(!(r & ~0x1f));
    assert(!(s &  ~0x3));
    assert(!(x &  ~0x1));
    assert(!(y & ~0xff));
    assert(!(t & ~0x1f));
    ii((o<<26)|(b<<21)|(r<<16)|(s<<14)|(x<<13)|(y<<5)|t);
}

static void
_f31(jit_state_t *_jit, jit_int32_t o, jit_int32_t t,
     jit_int32_t r, jit_int32_t v, jit_int32_t x, jit_int32_t y)
{
    assert(!(o & ~0x3f));
    assert(!(t & ~0x1f));
    assert(!(r & ~0x1f));
    assert(!(v & ~0x1f));
    assert(!(x & ~0xff));
    assert(!(y & ~0x1f));
    ii((o<<26)|(t<<21)|(r<<16)|(v<<14)|(x<<5)|y);
}

static void
_f33(jit_state_t *_jit, jit_int32_t o, jit_int32_t x,
     jit_int32_t r, jit_int32_t y, jit_int32_t z, jit_int32_t u)
{
    assert(!(o & ~0x3f));
    assert(!(x & ~0x1f));
    assert(!(r & ~0x1f));
    assert(!(y &  ~0x7));
    assert(!(z & ~0xff));
    assert(!(u & ~0x1f));
    ii((o<<26)|(x<<21)|(r<<16)|(y<<13)|(z<<5)|u);
}

static void
_f34(jit_state_t *_jit, jit_int32_t o, jit_int32_t o1,
     jit_int32_t x, jit_int32_t sf, jit_int32_t n, jit_int32_t o2)
{
    assert(!(o  &   ~0x3f));
    assert(!(o1 & ~0x7fff));
    assert(!(x  &    ~0x3));
    assert(!(sf &    ~0x7));
    assert(!(n  &    ~0x1));
    assert(!(o2 &   ~0x1f));
    ii((o<<26)|(o1<<11)|(x<<9)|(sf<<6)|(n<<5)|o2);
}

static void
_f35(jit_state_t *_jit, jit_int32_t o, jit_int32_t op,
     jit_int32_t x, jit_int32_t sf, jit_int32_t n, jit_int32_t t)
{
    assert(!(o  &   ~0x3f));
    assert(!(op & ~0x7fff));
    assert(!(x  &    ~0x3));
    assert(!(sf &    ~0x7));
    assert(!(n  &    ~0x1));
    assert(!(t  &   ~0x1f));
    ii((o<<26)|(op<<11)|(x<<9)|(sf<<6)|(n<<5)|t);
}

static void
_f36(jit_state_t *_jit, jit_int32_t o, jit_int32_t r, jit_int32_t o1,
     jit_int32_t x, jit_int32_t sf, jit_int32_t n, jit_int32_t o2)
{
    assert(!(o  &  ~0x3f));
    assert(!(r  &  ~0x1f));
    assert(!(o1 & ~0x3ff));
    assert(!(x  &   ~0x3));
    assert(!(sf &   ~0x7));
    assert(!(n  &   ~0x1));
    assert(!(o2 &  ~0x1f));
    ii((o<<26)|(r<<21)|(o1<<11)|(x<<9)|(sf<<6)|(n<<5)|o2);
}

static void
_f37(jit_state_t *_jit, jit_int32_t o, jit_int32_t r2,
     jit_int32_t r1, jit_int32_t o1, jit_int32_t x,
     jit_int32_t sf, jit_int32_t n, jit_int32_t o2)
{
    assert(!(o  & ~0x3f));
    assert(!(r2 & ~0x1f));
    assert(!(r1 & ~0x1f));
    assert(!(o1 & ~0x1f));
    assert(!(x  &  ~0x3));
    assert(!(sf &  ~0x7));
    assert(!(n  &  ~0x1));
    assert(!(o2 & ~0x1f));
    ii((o<<26)|(r2<<21)|(r1<<16)|(o1<<11)|(x<<9)|(sf<<6)|(n<<5)|o2);
}

static void
_f38(jit_state_t *_jit, jit_int32_t o,
     jit_int32_t s, jit_int32_t u, jit_int32_t n)
{
    assert(!(o &     ~0x3f));
    assert(!(s & ~0x3fffff));
    assert(!(u &      ~0x7));
    assert(!(n &      ~0x1));
    ii((o<<26)|((s>>5)<<9)|(u<<6)|(n<<1)|(s&0x1f));
}

static void
_nop(jit_state_t *_jit, jit_int32_t i0)
{
    for (; i0 > 0; i0 -= 4)
	NOP();
    assert(i0 == 0);
}

static void
_movr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
{
    if (r0 != r1)
	COPY(r1, r0);
}

static void
_movi(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    if (i0 >= -8192 && i0 <= 8191)
	LDI(i0, r0);
    else if (!(i0 & 0x7ff))
	LDIL(i0, r0);
    else {
	LDIL(i0 & ~0x7ff, r0);
	LDO(i0 & 0x7ff, r0, r0);
    }
}

static jit_word_t
_movi_p(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    jit_word_t		w;
    w = _jit->pc.w;
    LDIL(i0 & ~0x7ff, r0);
    LDO(i0 & 0x7ff, r0, r0);
    return (w);
}

static void
_addi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -1024 && i0 <= 1023)
	ADDI(i0, r1, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	addr(r0, r1, rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_addci(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    addcr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_addxi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    addxr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_subi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -1023 && i0 <= 1024)
	addi(r0, r1, -i0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	subr(r0, r1, rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_subci(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    subcr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_subxi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    subxr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_rsbi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -1024 && i0 <= 1023)
	SUBI(i0, r1, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	subr(r0, rn(reg), r1);
	jit_unget_reg(reg);
    }
}

static void
_mulr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    jit_int32_t		t0, t1;
    t0 = jit_get_reg(jit_class_fpr);
    t1 = jit_get_reg(jit_class_fpr);
    stxi(alloca_offset - 8, _FP_REGNO, r1);
    ldxi_f(rn(t0), _FP_REGNO, alloca_offset - 8);
    stxi(alloca_offset - 8, _FP_REGNO, r2);
    ldxi_f(rn(t1), _FP_REGNO, alloca_offset - 8);
    XMPYU(rn(t0), rn(t1), rn(t0));
    stxi_d(alloca_offset - 8, _FP_REGNO, rn(t0));
    ldxi(r0, _FP_REGNO, alloca_offset - 4);
    jit_unget_reg(t1);
    jit_unget_reg(t0);
}

static void
_muli(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (r0 != r1) {
	movi(r0, i0);
	mulr(r0, r1, r0);
    }
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	mulr(r0, r1, rn(reg));
	jit_unget_reg(reg);
    }
}

static long long
__llmul(int u, int v)
{
    return ((long long)u * (long long)v);
}

static void
_qmulr(jit_state_t *_jit,
       jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_int32_t r3)
{
    movr(_R26_REGNO, r2);
    movr(_R25_REGNO, r3);
    calli((jit_word_t)__llmul);
    movr(r0, _R29_REGNO);
    movr(r1, _R28_REGNO);
}

static void
_qmuli(jit_state_t *_jit,
       jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_word_t i0)
{
    movr(_R26_REGNO, r2);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__llmul);
    movr(r0, _R29_REGNO);
    movr(r1, _R28_REGNO);
}

static void
_qmulr_u(jit_state_t *_jit,
	 jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_int32_t r3)
{
    jit_int32_t		t0, t1;
    t0 = jit_get_reg(jit_class_fpr);
    t1 = jit_get_reg(jit_class_fpr);
    stxi(alloca_offset - 8, _FP_REGNO, r2);
    ldxi_f(rn(t0), _FP_REGNO, alloca_offset - 8);
    stxi(alloca_offset - 8, _FP_REGNO, r3);
    ldxi_f(rn(t1), _FP_REGNO, alloca_offset - 8);
    XMPYU(rn(t0), rn(t1), rn(t0));
    stxi_d(alloca_offset - 8, _FP_REGNO, rn(t0));
    ldxi(r0, _FP_REGNO, alloca_offset - 4);
    ldxi(r1, _FP_REGNO, alloca_offset - 8);
    jit_unget_reg(t1);
    jit_unget_reg(t0);
}

static void
_qmuli_u(jit_state_t *_jit,
	 jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    qmulr_u(r0, r1, r2, rn(reg));
    jit_unget_reg(reg);
}

static int
__idiv(int u, int v)
{
    return (u / v);
}

static void
_divr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    movr(_R26_REGNO, r1);
    movr(_R25_REGNO, r2);
    calli((jit_word_t)__idiv);
    movr(r0, _R28_REGNO);
}

static void
_divi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    movr(_R26_REGNO, r1);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__idiv);
    movr(r0, _R28_REGNO);
}

static unsigned int
__udiv(unsigned int u, unsigned int v)
{
    return (u / v);
}

static void
_divr_u(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    movr(_R26_REGNO, r1);
    movr(_R25_REGNO, r2);
    calli((jit_word_t)__udiv);
    movr(r0, _R28_REGNO);
}

static void
_divi_u(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    movr(_R26_REGNO, r1);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__udiv);
    movr(r0, _R28_REGNO);
}

static int
__irem(int u, int v)
{
    return (u % v);
}

static void
_remr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    movr(_R26_REGNO, r1);
    movr(_R25_REGNO, r2);
    calli((jit_word_t)__irem);
    movr(r0, _R28_REGNO);
}

static void
_remi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    movr(_R26_REGNO, r1);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__irem);
    movr(r0, _R28_REGNO);
}

static unsigned int
__urem(unsigned int u, unsigned int v)
{
    return (u % v);
}

static void
_remr_u(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    movr(_R26_REGNO, r1);
    movr(_R25_REGNO, r2);
    calli((jit_word_t)__urem);
    movr(r0, _R28_REGNO);
}

static void
_remi_u(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    movr(_R26_REGNO, r1);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__urem);
    movr(r0, _R28_REGNO);
}

static idiv_t
__idivrem(int u, int v)
{
    idiv_t	div;
    div.quo = u / v;
    div.rem = u % v;
    return (div);
}

static void
_qdivr(jit_state_t *_jit,
       jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_int32_t r3)
{
    movr(_R26_REGNO, r2);
    movr(_R25_REGNO, r3);
    calli((jit_word_t)__idivrem);
    movr(r0, _R28_REGNO);
    movr(r1, _R29_REGNO);
}

static void
_qdivi(jit_state_t *_jit,
       jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_word_t i0)
{
    movr(_R26_REGNO, r2);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__idivrem);
    movr(r0, _R28_REGNO);
    movr(r1, _R29_REGNO);
}

static udiv_t
__udivrem(unsigned int u, unsigned int v)
{
    udiv_t	div;
    div.quo = u / v;
    div.rem = u % v;
    return (div);
}

static void
_qdivr_u(jit_state_t *_jit,
	 jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_int32_t r3)
{
    movr(_R26_REGNO, r2);
    movr(_R25_REGNO, r3);
    calli((jit_word_t)__udivrem);
    movr(r0, _R28_REGNO);
    movr(r1, _R29_REGNO);
}

static void
_qdivi_u(jit_state_t *_jit,
	 jit_int32_t r0, jit_int32_t r1, jit_int32_t r2, jit_word_t i0)
{
    movr(_R26_REGNO, r2);
    movi(_R25_REGNO, i0);
    calli((jit_word_t)__udivrem);
    movr(r0, _R28_REGNO);
    movr(r1, _R29_REGNO);
}

static void
_andi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    andr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_ori(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    orr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_xori(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    movi(rn(reg), i0);
    xorr(r0, r1, rn(reg));
    jit_unget_reg(reg);
}

static void
_lshr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1 ,jit_int32_t r2)
{
    SUBI(0x1f, r2, _R1_REGNO);
    MTSAR(_R1_REGNO);
    DEPW_Z(r1, 32, r0);
}

static void
_rshr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1 ,jit_int32_t r2)
{
    SUBI(0x1f, r2, _R1_REGNO);
    MTSAR(_R1_REGNO);
    EXTRW(r1, 32, r0);
}

static void
_rshr_u(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1 ,jit_int32_t r2)
{
    SUBI(0x1f, r2, _R1_REGNO);
    MTSAR(_R1_REGNO);
    EXTRW_U(r1, 32, r0);
}

static void
_cmpr(jit_state_t *_jit, jit_word_t c,
      jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    CMPCLR_(c, r1, r2, r0);
    LDI(1, r0);
}

static void
_cmpi(jit_state_t *_jit, jit_word_t c, jit_word_t ci,
      jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	CMPICLR_(ci, i0, r1, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	CMPCLR_(c, r1, rn(reg), r0);
	jit_unget_reg(reg);
    }
    LDI(1, r0);
}

static void
_ldr_c(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
{
    ldr_uc(r0, r1);
    extr_c(r0, r0);
}

static void
_ldi_c(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    ldi_uc(r0, i0);
    extr_c(r0, r0);
}

static void
_ldxr_c(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    ldxr_uc(r0, r1, r2);
    extr_c(r0, r0);
}

static void
_ldxi_c(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    ldxi_uc(r0, r1, i0);
    extr_c(r0, r0);
}

static void
_ldi_uc(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -8182 && i0 <= 8191)
	LDBL(i0, _R0_REGNO, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	LDIL(i0 & ~0x7ff, rn(reg));
	LDBL(sign_extend(i0, 11), rn(reg), r0);
	jit_unget_reg(reg);
    }
}

static void
_ldxi_uc(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	LDBI(i0, r1, r0);
    else if (i0 >= -8182 && i0 <= 8191)
	LDBL(i0, r1, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	ldxr_uc(r0, r1, rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_ldr_s(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
{
    ldr_us(r0, r1);
    extr_s(r0, r0);
}

static void
_ldi_s(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    ldi_us(r0, i0);
    extr_s(r0, r0);
}

static void
_ldxr_s(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    ldxr_us(r0, r1, r2);
    extr_s(r0, r0);
}

static void
_ldxi_s(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    ldxi_us(r0, r1, i0);
    extr_s(r0, r0);
}

static void
_ldi_us(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -8182 && i0 <= 8191)
	LDHL(i0, _R0_REGNO, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	LDIL(i0 & ~0x7ff, rn(reg));
	LDHL(sign_extend(i0, 11), rn(reg), r0);
	jit_unget_reg(reg);
    }
}

static void
_ldxi_us(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	LDHI(i0, r1, r0);
    else if (i0 >= -8182 && i0 <= 8191)
	LDHL(i0, r1, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	ldxr_us(r0, r1, rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_ldi_ui(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -8182 && i0 <= 8191)
	LDWL(i0, _R0_REGNO, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	LDIL(i0 & ~0x7ff, rn(reg));
	LDWL(sign_extend(i0, 11), rn(reg), r0);
	jit_unget_reg(reg);
    }
}

static void
_ldxi_ui(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	LDWI(i0, r1, r0);
    else if (i0 >= -8182 && i0 <= 8191)
	LDWL(i0, r1, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	movi(rn(reg), i0);
	ldxr_ui(r0, r1, rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_sti_c(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0)
{
    jit_int32_t		reg;
    if (i0 >= -8182 && i0 <= 8191)
	STBL(r0, i0, _R0_REGNO);
    else {
	reg = jit_get_reg(jit_class_gpr);
	LDIL(i0 & ~0x7ff, rn(reg));
	STBL(r0, sign_extend(i0, 11), rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_stxr_c(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    addr(rn(reg), r0, r1);
    str_c(rn(reg), r2);
    jit_unget_reg(reg);
}

static void
_stxi_c(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	STBI(r1, i0, r0);
    else if (i0 >= -8182 && i0 <= 8191)
	STBL(r1, i0, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	addi(rn(reg), r0, i0);
	str_c(rn(reg), r1);
	jit_unget_reg(reg);
    }
}

static void
_sti_s(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0)
{
    jit_int32_t		reg;
    if (i0 >= -8182 && i0 <= 8191)
	STHL(r0, i0, _R0_REGNO);
    else {
	reg = jit_get_reg(jit_class_gpr);
	LDIL(i0 & ~0x7ff, rn(reg));
	STHL(r0, sign_extend(i0, 11), rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_stxr_s(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1 ,jit_int32_t r2)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    addr(rn(reg), r0, r1);
    str_s(rn(reg), r2);
    jit_unget_reg(reg);
}

static void
_stxi_s(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	STHI(r1, i0, r0);
    else if (i0 >= -8182 && i0 <= 8191)
	STHL(r1, i0, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	addi(rn(reg), r0, i0);
	str_s(rn(reg), r1);
	jit_unget_reg(reg);
    }
}

static void
_sti_i(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0)
{
    jit_int32_t		reg;
    if (i0 >= -8182 && i0 <= 8191)
	STWL(r0, i0, _R0_REGNO);
    else {
	reg = jit_get_reg(jit_class_gpr);
	LDIL(i0 & ~0x7ff, rn(reg));
	STWL(r0, sign_extend(i0, 11), rn(reg));
	jit_unget_reg(reg);
    }
}

static void
_stxr_i(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1 ,jit_int32_t r2)
{
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr);
    addr(rn(reg), r0, r1);
    str_i(rn(reg), r2);
    jit_unget_reg(reg);
}

static void
_stxi_i(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_int32_t		reg;
    if (i0 >= -16 && i0 <= 15)
	STWI(r1, i0, r0);
    else if (i0 >= -8182 && i0 <= 8191)
	STWL(r1, i0, r0);
    else {
	reg = jit_get_reg(jit_class_gpr);
	addi(rn(reg), r0, i0);
	str_i(rn(reg), r1);
	jit_unget_reg(reg);
    }
}

static jit_word_t
_bcmpr(jit_state_t *_jit, jit_word_t c,
       jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    w = _jit->pc.w;
    CMPB_N_(c, r0, r1, ((i0 - w) >> 2) - 2);
    NOP();
    return (w);
}

static jit_word_t
_bcmpi(jit_state_t *_jit, jit_word_t c, jit_word_t ci,
       jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    if (i1 >= -16 && i1 <= 15) {
	w = _jit->pc.w;
	CMPIB_N_(ci, i1, r0, ((i0 - w) >> 2) - 2);
    }
    else {
	reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
	movi(rn(reg), i1);
	w = _jit->pc.w;
	CMPB_N_(c, r0, rn(reg), ((i0 - w) >> 2) - 2);
	jit_unget_reg(reg);
    }
    NOP();
    return (w);
}

static jit_word_t
_bmxr(jit_state_t *_jit, jit_bool_t c,
      jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
    andr(rn(reg), r0, r1);
    w = c ? bnei(i0, rn(reg), 0) : beqi(i0, rn(reg), 0);
    jit_unget_reg(reg);
    return (w);
}

static jit_word_t
_bmxi(jit_state_t *_jit, jit_bool_t c,
      jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
    movi(rn(reg), i1);
    andr(rn(reg), r0, rn(reg));
    w = c ? bnei(i0, rn(reg), 0) : beqi(i0, rn(reg), 0);
    jit_unget_reg(reg);
    return (w);
}

static jit_word_t
_boaddr(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    w = _jit->pc.w;
    ADDB_N_SV(r1, r0, ((i0 - w) >> 2) - 2);
    NOP();
    return (w);
}

static jit_word_t
_boaddi(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    if (i1 >= -16 && i1 <= 15) {
	w = _jit->pc.w;
	ADDIB_N_SV(i1, r0, ((i0 - w) >> 2) - 2);
	NOP();
    }
    else {
	reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
	movi(rn(reg), i1);
	w = boaddr(i0, r0, rn(reg));
	jit_unget_reg(reg);
    }
    return (w);
}

static jit_word_t
_boaddr_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    w = _jit->pc.w;
    ADDB_N_UV(r1, r0, ((i0 - w) >> 2) - 2);
    NOP();
    return (w);
}

static jit_word_t
_boaddi_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    if (i1 >= -16 && i1 <= 15) {
	w = _jit->pc.w;
	ADDIB_N_UV(i1, r0, ((i0 - w) >> 2) - 2);
	NOP();
    }
    else {
	reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
	movi(rn(reg), i1);
	w = boaddr_u(i0, r0, rn(reg));
	jit_unget_reg(reg);
    }
    return (w);
}

static jit_word_t
_bxaddr(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    w = _jit->pc.w;
    ADDB_N_NSV(r1, r0, ((i0 - w) >> 2) - 2);
    NOP();
    return (w);
}

static jit_word_t
_bxaddi(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    if (i1 >= -16 && i1 <= 15) {
	w = _jit->pc.w;
	ADDIB_N_NSV(i1, r0, ((i0 - w) >> 2) - 2);
	NOP();
    }
    else {
	reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
	movi(rn(reg), i1);
	w = bxaddr(i0, r0, rn(reg));
	jit_unget_reg(reg);
    }
    return (w);
}

static jit_word_t
_bxaddr_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    w = _jit->pc.w;
    ADDB_N_NUV(r1, r0, ((i0 - w) >> 2) - 2);
    NOP();
    return (w);
}

static jit_word_t
_bxaddi_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    jit_word_t		w;
    jit_int32_t		reg;
    if (i1 >= -16 && i1 <= 15) {
	w = _jit->pc.w;
	ADDIB_N_NUV(i1, r0, ((i0 - w) >> 2) - 2);
	NOP();
    }
    else {
	reg = jit_get_reg(jit_class_gpr|jit_class_nospill);
	movi(rn(reg), i1);
	w = bxaddr_u(i0, r0, rn(reg));
	jit_unget_reg(reg);
    }
    return (w);
}

static jit_word_t
_bosubr(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    SUB_NSV(r0, r1, r0);
    w = _jit->pc.w;
    /* null'ed if no signed overflow */
    B_N(((i0 - w) >> 2) - 2, _R0_REGNO);
    NOP();
    return (w);
}

static jit_word_t
_bosubi(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    movi(_R1_REGNO, i1);
    return (bosubr(i0, r0, _R1_REGNO));
}

static jit_word_t
_bosubr_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    SUB(r0, r1, r0);
    SUB_B(_R0_REGNO, _R0_REGNO, _R1_REGNO);
    return (bnei(i0, _R1_REGNO, 0));
}

static jit_word_t
_bosubi_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    movi(_R1_REGNO, i1);
    SUB(r0, _R1_REGNO, r0);
    SUB_B(_R0_REGNO, _R0_REGNO, _R1_REGNO);
    return (bnei(i0, _R1_REGNO, 0));
}

static jit_word_t
_bxsubr(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    jit_word_t		w;
    SUB_SV(r0, r1, r0);
    w = _jit->pc.w;
    /* null'ed if signed overflow */
    B_N(((i0 - w) >> 2) - 2, _R0_REGNO);
    NOP();
    return (w);
}

static jit_word_t
_bxsubi(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    movi(_R1_REGNO, i1);
    return (bxsubr(i0, r0, _R1_REGNO));
}

static jit_word_t
_bxsubr_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
    SUB(r0, r1, r0);
    SUB_B(_R0_REGNO, _R0_REGNO, _R1_REGNO);
    return (beqi(i0, _R1_REGNO, 0));
}

static jit_word_t
_bxsubi_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_word_t i1)
{
    movi(_R1_REGNO, i1);
    SUB(r0, _R1_REGNO, r0);
    SUB_B(_R0_REGNO, _R0_REGNO, _R1_REGNO);
    return (beqi(i0, _R1_REGNO, 0));
}

static void
_jmpr(jit_state_t *_jit, jit_int32_t r0)
{
    BV_N(_R0_REGNO, r0);
}

static void
_jmpi(jit_state_t *_jit, jit_word_t i0)
{
    jit_word_t		w;
    w = ((i0 - _jit->pc.w) >> 2) - 2;
    if (w >= -32768 && w <= 32767)
	B_N(w, _R0_REGNO);
    else {
	movi(_R1_REGNO, w);
	BV_N(_R0_REGNO, _R1_REGNO);
    }
}

static jit_word_t
_jmpi_p(jit_state_t *_jit, jit_word_t i0)
{
    jit_word_t		w;
    w = movi_p(_R1_REGNO, i0);
    jmpr(_R1_REGNO);
    return (w);
}

static void
_callr(jit_state_t *_jit, jit_int32_t r0)
{
    jit_word_t		dyn;
    jit_word_t		imm;
    if (r0 != _R1_REGNO)
	COPY(r0, _R1_REGNO);
    /* inline $$dyncall */
    imm = _jit->pc.w;
    BBI_N_GE(_R1_REGNO, 30, 0);		/*   if (r1 & 2) {		*/
    DEPWRI(0, 31, 2, _R1_REGNO);	/*	r1 &= ~2;		*/
    LDWI(4, _R1_REGNO, _R19_REGNO);	/*	r19 = r1[1];		*/
    LDWI(0, _R1_REGNO, _R1_REGNO);	/*	r1  = r1[0];		*/
					/*   }				*/
    BVE_L(_R1_REGNO);
    STWL(_RP_REGNO, -24, _SP_REGNO);
    dyn = _jit->pc.w;
    jmpi(_jit->pc.w);
    patch_at(imm, _jit->pc.w);
    BVE_L_N(_R1_REGNO);
    NOP();
    patch_at(dyn, _jit->pc.w);
}

static void
_calli(jit_state_t *_jit, jit_word_t i0)
{
    jit_word_t		w;
    if (i0 & 2) {
	i0 &= -4;
	movi(_R1_REGNO, i0);
	LDWI(4, _R1_REGNO, _R19_REGNO);
	LDWI(0, _R1_REGNO, _R1_REGNO);
	BVE_L(_R1_REGNO);
	STWL(_RP_REGNO, -24, _SP_REGNO);
    }
    else {
	w = ((i0 - _jit->pc.w) >> 2) - 2;
	if (w >= -32768 && w <= 32767)
	    B_L_N(w);
	else {
	    movi(_R1_REGNO, i0);
	    BVE_L_N(_R1_REGNO);
	}
	NOP();
    }
}

static jit_word_t
_calli_p(jit_state_t *_jit, jit_word_t i0)
{
    jit_word_t		w;
    w = movi_p(_R1_REGNO, i0);
    callr(_R1_REGNO);
    return (w);
}

static jit_int32_t gr[] = {
     _R4,  _R5,  _R6,  _R7,  _R8,
     _R9, _R10, _R11, _R12, _R13,
    _R14, _R15, _R16, _R17, _R18
};

static jit_int32_t fr[] = {
    _F12, _F13, _F14, _F15, _F16,
    _F17, _F18, _F19, _F20, _F21
};

static void
_prolog(jit_state_t *_jit, jit_node_t *node)
{
    jit_int32_t		regno;
    jit_word_t		offset;

    if (_jitc->function->define_frame || _jitc->function->assume_frame) {
	/* hppa stack grows up */
	assert(_jitc->function->self.aoff <= _jitc->function->frame);
	if (_jitc->function->assume_frame)
	    return;
	_jitc->function->self.aoff = _jitc->function->frame;
    }
    if (_jitc->function->allocar) {
	_jitc->function->self.aoff += 63;
	_jitc->function->self.aoff &= -64;
    }
    _jitc->function->stack = ((_jitc->function->self.aoff -
			       _jitc->function->self.alen -
			       _jitc->function->self.size) + 63) & -64;

    /* Save stack frame (FIXME Only required if non leaf) */
    STWL(_RP_REGNO, -20, _SP_REGNO);

    /* Create stack frame */
    COPY(_FP_REGNO, _R1_REGNO);
    COPY(_SP_REGNO, _FP_REGNO);
    STWL_MA(_R1_REGNO, _jitc->function->stack, _SP_REGNO);

    /* Save any modified callee save registers */
    offset = alloca_offset - 140;
    for (regno = 0; regno < jit_size(gr); regno++, offset += 4) {
	if (jit_regset_tstbit(&_jitc->function->regset, gr[regno]))
	    stxi(offset, _FP_REGNO, rn(gr[regno]));
    }
    for (regno = 0; regno < jit_size(fr); regno++, offset += 8) {
	if (jit_regset_tstbit(&_jitc->function->regset, fr[regno]))
	    stxi_d(offset, _FP_REGNO, rn(fr[regno]));
    }

    if (_jitc->function->allocar) {
	regno = jit_get_reg(jit_class_gpr);
	movi(rn(regno), _jitc->function->self.aoff);
	stxi_i(_jitc->function->aoffoff, _FP_REGNO, rn(regno));
	jit_unget_reg(regno);
    }

    if (_jitc->function->self.call & jit_call_varargs) {
	for (regno = 3; regno >= _jitc->function->vagp; --regno)
	    stxi(params_offset - regno * 4 - 4, _FP_REGNO, rn(_R26 - regno));
    }
}

static void
_epilog(jit_state_t *_jit, jit_node_t *node)
{
    jit_int32_t		regno;
    jit_word_t		offset;

    if (_jitc->function->assume_frame)
	return;
    /* Restore any modified callee save registers */
    offset = alloca_offset - 140;
    for (regno = 0; regno < jit_size(gr); regno++, offset += 4) {
	if (jit_regset_tstbit(&_jitc->function->regset, gr[regno]))
	    ldxi(rn(gr[regno]), _FP_REGNO, offset);
    }
    for (regno = 0; regno < jit_size(fr); regno++, offset += 8) {
	if (jit_regset_tstbit(&_jitc->function->regset, fr[regno]))
	    ldxi_d(rn(fr[regno]), _FP_REGNO, offset);
    }

    /* Restore stack frame (FIXME Only required if non leaf) */
    LDWL(-20, _FP_REGNO, _RP_REGNO);
    LDO(_jitc->function->stack, _FP_REGNO, _SP_REGNO);
    LDWL_MB(-_jitc->function->stack, _SP_REGNO, _FP_REGNO);
#if defined(__hpux)
    BVE_N(_RP_REGNO);
#else
    BV_N(_R0_REGNO, _RP_REGNO);
#endif
}

static void
_vastart(jit_state_t *_jit, jit_int32_t r0)
{
    /* Initialize stack pointer to the first stack argument. */
    if (jit_arg_reg_p(_jitc->function->vagp))
	addi(r0, _FP_REGNO, params_offset - _jitc->function->vagp * 4);
    else
	addi(r0, _FP_REGNO, _jitc->function->self.size);
}

static void
_vaarg(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
{
    assert(_jitc->function->self.call & jit_call_varargs);

    /* Update vararg stack pointer. */
    subi(r1, r1, 4);

    /* Load argument. */
    ldr(r0, r1);
}

static void
_patch_at(jit_state_t *_jit, jit_word_t instr, jit_word_t label)
{
    jit_word_t		 w;
    union {
	jit_uint32_t	*i;
	jit_word_t	 w;
    } u;
    u.w = instr;
    switch (u.i[0] >> 26) {
	case 0x8:				/* LDIL */
	    u.i[0] &= ~0x1fffff;
	    u.i[0] |= re_assemble_21((label & ~0x7ff) >> 11);
	    assert((u.i[1] >> 26) == 0xd);	/* LDO */
	    u.i[1] &= ~0xffff;
	    u.i[1] |= re_assemble_16(label & 0x7ff);
	    break;
	case 0x20:	case 0x22:		/* CMPB */
	case 0x21:	case 0x23:		/* CMPIB */
	case 0x28:	case 0x2a:		/* ADDB */
	case 0x29:	case 0x2b:		/* ADDIB */
	case 0x31:				/* BBI */
	    w = ((label - instr) >> 2) - 2;
	    assert(w >= -2048 && w <= 2047);
	    u.i[0] &= ~0x1ffd;
	    u.i[0] |= re_assemble_12(w);
	    break;
	case 0x3a:				/* B */
	    w = ((label - instr) >> 2) - 2;
	    assert(w >= -32768 && w <= 32767);
	    u.i[0] &= ~0x1f1ffd;
	    u.i[0] |= re_assemble_17(w);
	    break;
	default:
	    abort();
    }
}
#endif