summaryrefslogtreecommitdiffstats
path: root/libgcc/config/v850/lib1funcs.S
blob: 1ad11738bd9c0652f20600ce9e39b8c970aa8c66 (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
/* libgcc routines for NEC V850.
   Copyright (C) 1996-2014 Free Software Foundation, Inc.

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 3, or (at your option) any
   later version.

   This file 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
   General Public License for more details.

   Under Section 7 of GPL version 3, you are granted additional
   permissions described in the GCC Runtime Library Exception, version
   3.1, as published by the Free Software Foundation.

   You should have received a copy of the GNU General Public License and
   a copy of the GCC Runtime Library Exception along with this program;
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   <http://www.gnu.org/licenses/>.  */

#ifdef L_mulsi3
	.text
	.globl ___mulsi3
	.type  ___mulsi3,@function
___mulsi3:
#ifdef __v850__	
/*
   #define SHIFT 12
   #define MASK ((1 << SHIFT) - 1)
    
   #define STEP(i, j)                               \
   ({                                               \
       short a_part = (a >> (i)) & MASK;            \
       short b_part = (b >> (j)) & MASK;            \
       int res = (((int) a_part) * ((int) b_part)); \
       res;                                         \
   })
  
   int
   __mulsi3 (unsigned a, unsigned b)
   {
      return STEP (0, 0) +
          ((STEP (SHIFT, 0) + STEP (0, SHIFT)) << SHIFT) +
          ((STEP (0, 2 * SHIFT) + STEP (SHIFT, SHIFT) + STEP (2 * SHIFT, 0))
           << (2 * SHIFT));
   }
*/
        mov   r6, r14
        movea lo(32767), r0, r10
        and   r10, r14
        mov   r7,  r15
        and   r10, r15
        shr   15,  r6
        mov   r6,  r13
        and   r10, r13
        shr   15,  r7
        mov   r7,  r12
        and   r10, r12
        shr   15,  r6
        shr   15,  r7
        mov   r14, r10
        mulh  r15, r10
        mov   r14, r11
        mulh  r12, r11
        mov   r13, r16
        mulh  r15, r16
        mulh  r14, r7
        mulh  r15, r6
        add   r16, r11
        mulh  r13, r12
        shl   15,  r11
        add   r11, r10
        add   r12, r7
        add   r6,  r7
        shl   30,  r7
        add   r7,  r10
        jmp   [r31]
#endif /* __v850__ */
#if defined(__v850e__) || defined(__v850ea__) || defined(__v850e2__) || defined(__v850e2v3__) || defined(__v850e3v5__)
        /* This routine is almost unneccesarry because gcc
           generates the MUL instruction for the RTX mulsi3.
           But if someone wants to link his application with
           previsously compiled v850 objects then they will 
	   need this function.  */
 
        /* It isn't good to put the inst sequence as below;
              mul r7, r6,
              mov r6, r10, r0
           In this case, there is a RAW hazard between them.
           MUL inst takes 2 cycle in EX stage, then MOV inst
           must wait 1cycle.  */
        mov   r7, r10
        mul   r6, r10, r0
        jmp   [r31]
#endif /* __v850e__ */
	.size ___mulsi3,.-___mulsi3
#endif /* L_mulsi3 */


#ifdef L_udivsi3
	.text
	.global ___udivsi3
	.type	___udivsi3,@function
___udivsi3:
#ifdef __v850__
	mov 1,r12
	mov 0,r10
	cmp r6,r7
	bnl .L12
	movhi hi(-2147483648),r0,r13
	cmp r0,r7
	blt .L12
.L4:
	shl 1,r7
	shl 1,r12
	cmp r6,r7
	bnl .L12
	cmp r0,r12
	be .L8
	mov r7,r19
	and r13,r19
	be .L4
	br .L12
.L9:
	cmp r7,r6
	bl .L10
	sub r7,r6
	or r12,r10
.L10:
	shr 1,r12
	shr 1,r7
.L12:
	cmp r0,r12
	bne .L9
.L8:
	jmp [r31]

#else /* defined(__v850e__) */

	/* See comments at end of __mulsi3.  */
	mov   r6, r10	
	divu  r7, r10, r0
	jmp   [r31]		

#endif /* __v850e__ */

	.size ___udivsi3,.-___udivsi3
#endif

#ifdef L_divsi3
	.text
	.globl ___divsi3
	.type  ___divsi3,@function
___divsi3:
#ifdef __v850__
	add -8,sp
	st.w r31,4[sp]
	st.w r22,0[sp]
	mov 1,r22
	tst r7,r7
	bp .L3
	subr r0,r7
	subr r0,r22
.L3:
	tst r6,r6
	bp .L4
	subr r0,r6
	subr r0,r22
.L4:
	jarl ___udivsi3,r31
	cmp r0,r22
	bp .L7
	subr r0,r10
.L7:
	ld.w 0[sp],r22
	ld.w 4[sp],r31
	add 8,sp
	jmp [r31]

#else /* defined(__v850e__) */

	/* See comments at end of __mulsi3.  */
	mov   r6, r10
	div   r7, r10, r0
	jmp   [r31]

#endif /* __v850e__ */

	.size ___divsi3,.-___divsi3
#endif

#ifdef  L_umodsi3
	.text
	.globl ___umodsi3
	.type  ___umodsi3,@function
___umodsi3:
#ifdef __v850__
	add -12,sp
	st.w r31,8[sp]
	st.w r7,4[sp]
	st.w r6,0[sp]
	jarl ___udivsi3,r31
	ld.w 4[sp],r7
	mov r10,r6
	jarl ___mulsi3,r31
	ld.w 0[sp],r6
	subr r6,r10
	ld.w 8[sp],r31
	add 12,sp
	jmp [r31]

#else /* defined(__v850e__) */

	/* See comments at end of __mulsi3.  */
	divu  r7, r6, r10
	jmp   [r31]

#endif /* __v850e__ */

	.size ___umodsi3,.-___umodsi3
#endif /* L_umodsi3 */

#ifdef  L_modsi3
	.text
	.globl ___modsi3
	.type  ___modsi3,@function
___modsi3:
#ifdef __v850__	
	add -12,sp
	st.w r31,8[sp]
	st.w r7,4[sp]
	st.w r6,0[sp]
	jarl ___divsi3,r31
	ld.w 4[sp],r7
	mov r10,r6
	jarl ___mulsi3,r31
	ld.w 0[sp],r6
	subr r6,r10
	ld.w 8[sp],r31
	add 12,sp
	jmp [r31]

#else /* defined(__v850e__) */

	/* See comments at end of __mulsi3.  */
	div  r7, r6, r10
	jmp [r31]

#endif /* __v850e__ */

	.size ___modsi3,.-___modsi3
#endif /* L_modsi3 */

#ifdef	L_save_2
	.text
	.align	2
	.globl	__save_r2_r29
	.type	__save_r2_r29,@function
	/* Allocate space and save registers 2, 20 .. 29 on the stack.  */
	/* Called via:	jalr __save_r2_r29,r10.  */
__save_r2_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-44,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r21,32[ep]
	sst.w	r20,36[ep]
	sst.w	r2,40[ep]
	mov	r1,ep
#else
	addi	-44,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r21,32[sp]
	st.w	r20,36[sp]
	st.w	r2,40[sp]
#endif
	jmp	[r10]
	.size	__save_r2_r29,.-__save_r2_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r2_r29.  */
	.align	2
	.globl	__return_r2_r29
	.type	__return_r2_r29,@function
__return_r2_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r21
	sld.w	36[ep],r20
	sld.w	40[ep],r2
	addi	44,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	ld.w	32[sp],r21
	ld.w	36[sp],r20
	ld.w	40[sp],r2
	addi	44,sp,sp
#endif
	jmp	[r31]
	.size	__return_r2_r29,.-__return_r2_r29
#endif /* L_save_2 */

#ifdef	L_save_20
	.text
	.align	2
	.globl	__save_r20_r29
	.type	__save_r20_r29,@function
	/* Allocate space and save registers 20 .. 29 on the stack.  */
	/* Called via:	jalr __save_r20_r29,r10.  */
__save_r20_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-40,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r21,32[ep]
	sst.w	r20,36[ep]
	mov	r1,ep
#else
	addi	-40,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r21,32[sp]
	st.w	r20,36[sp]
#endif
	jmp	[r10]
	.size	__save_r20_r29,.-__save_r20_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r20_r29.  */
	.align	2
	.globl	__return_r20_r29
	.type	__return_r20_r29,@function
__return_r20_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r21
	sld.w	36[ep],r20
	addi	40,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	ld.w	32[sp],r21
	ld.w	36[sp],r20
	addi	40,sp,sp
#endif
	jmp	[r31]
	.size	__return_r20_r29,.-__return_r20_r29
#endif /* L_save_20 */

#ifdef	L_save_21
	.text
	.align	2
	.globl	__save_r21_r29
	.type	__save_r21_r29,@function
	/* Allocate space and save registers 21 .. 29 on the stack.  */
	/* Called via:	jalr __save_r21_r29,r10.  */
__save_r21_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-36,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r21,32[ep]
	mov	r1,ep
#else
	addi	-36,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r21,32[sp]
#endif
	jmp	[r10]
	.size	__save_r21_r29,.-__save_r21_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r21_r29.  */
	.align	2
	.globl	__return_r21_r29
	.type	__return_r21_r29,@function
__return_r21_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r21
	addi	36,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	ld.w	32[sp],r21
	addi	36,sp,sp
#endif
	jmp	[r31]
	.size	__return_r21_r29,.-__return_r21_r29
#endif /* L_save_21 */

#ifdef	L_save_22
	.text
	.align	2
	.globl	__save_r22_r29
	.type	__save_r22_r29,@function
	/* Allocate space and save registers 22 .. 29 on the stack.  */
	/* Called via:	jalr __save_r22_r29,r10.  */
__save_r22_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-32,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	mov	r1,ep
#else
	addi	-32,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
#endif
	jmp	[r10]
	.size	__save_r22_r29,.-__save_r22_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r22_r29.  */
	.align	2
	.globl	__return_r22_r29
	.type	__return_r22_r29,@function
__return_r22_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	addi	32,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	addi	32,sp,sp
#endif
	jmp	[r31]
	.size	__return_r22_r29,.-__return_r22_r29
#endif /* L_save_22 */

#ifdef	L_save_23
	.text
	.align	2
	.globl	__save_r23_r29
	.type	__save_r23_r29,@function
	/* Allocate space and save registers 23 .. 29 on the stack.  */
	/* Called via:	jalr __save_r23_r29,r10.  */
__save_r23_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-28,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	mov	r1,ep
#else
	addi	-28,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
#endif
	jmp	[r10]
	.size	__save_r23_r29,.-__save_r23_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r23_r29.  */
	.align	2
	.globl	__return_r23_r29
	.type	__return_r23_r29,@function
__return_r23_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	addi	28,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	addi	28,sp,sp
#endif
	jmp	[r31]
	.size	__return_r23_r29,.-__return_r23_r29
#endif /* L_save_23 */

#ifdef	L_save_24
	.text
	.align	2
	.globl	__save_r24_r29
	.type	__save_r24_r29,@function
	/* Allocate space and save registers 24 .. 29 on the stack.  */
	/* Called via:	jalr __save_r24_r29,r10.  */
__save_r24_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-24,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	mov	r1,ep
#else
	addi	-24,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
#endif
	jmp	[r10]
	.size	__save_r24_r29,.-__save_r24_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r24_r29.  */
	.align	2
	.globl	__return_r24_r29
	.type	__return_r24_r29,@function
__return_r24_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	addi	24,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	addi	24,sp,sp
#endif
	jmp	[r31]
	.size	__return_r24_r29,.-__return_r24_r29
#endif /* L_save_24 */

#ifdef	L_save_25
	.text
	.align	2
	.globl	__save_r25_r29
	.type	__save_r25_r29,@function
	/* Allocate space and save registers 25 .. 29 on the stack.  */
	/* Called via:	jalr __save_r25_r29,r10.  */
__save_r25_r29:
#ifdef __EP__
	mov	ep,r1
	addi	-20,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	mov	r1,ep
#else
	addi	-20,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
#endif
	jmp	[r10]
	.size	__save_r25_r29,.-__save_r25_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r25_r29.  */
	.align	2
	.globl	__return_r25_r29
	.type	__return_r25_r29,@function
__return_r25_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	addi	20,sp,sp
	mov	r1,ep
#else
	ld.w	0[ep],r29
	ld.w	4[ep],r28
	ld.w	8[ep],r27
	ld.w	12[ep],r26
	ld.w	16[ep],r25
	addi	20,sp,sp
#endif
	jmp	[r31]
	.size	__return_r25_r29,.-__return_r25_r29
#endif /* L_save_25 */

#ifdef	L_save_26
	.text
	.align	2
	.globl	__save_r26_r29
	.type	__save_r26_r29,@function
	/* Allocate space and save registers 26 .. 29 on the stack.  */
	/* Called via:	jalr __save_r26_r29,r10.  */
__save_r26_r29:
#ifdef __EP__
	mov	ep,r1
	add	-16,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	mov	r1,ep
#else
	add	-16,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
#endif
	jmp	[r10]
	.size	__save_r26_r29,.-__save_r26_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r26_r29.  */
	.align	2
	.globl	__return_r26_r29
	.type	__return_r26_r29,@function
__return_r26_r29:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	addi	16,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	addi	16,sp,sp
#endif
	jmp	[r31]
	.size	__return_r26_r29,.-__return_r26_r29
#endif /* L_save_26 */

#ifdef	L_save_27
	.text
	.align	2
	.globl	__save_r27_r29
	.type	__save_r27_r29,@function
	/* Allocate space and save registers 27 .. 29 on the stack.  */
	/* Called via:	jalr __save_r27_r29,r10.  */
__save_r27_r29:
	add	-12,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	jmp	[r10]
	.size	__save_r27_r29,.-__save_r27_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r27_r29.  */
	.align	2
	.globl	__return_r27_r29
	.type	__return_r27_r29,@function
__return_r27_r29:
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	add	12,sp
	jmp	[r31]
	.size	__return_r27_r29,.-__return_r27_r29
#endif /* L_save_27 */

#ifdef	L_save_28
	.text
	.align	2
	.globl	__save_r28_r29
	.type	__save_r28_r29,@function
	/* Allocate space and save registers 28,29 on the stack.  */
	/* Called via:	jalr __save_r28_r29,r10.  */
__save_r28_r29:
	add	-8,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	jmp	[r10]
	.size	__save_r28_r29,.-__save_r28_r29

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r28_r29.  */
	.align	2
	.globl	__return_r28_r29
	.type	__return_r28_r29,@function
__return_r28_r29:
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	add	8,sp
	jmp	[r31]
	.size	__return_r28_r29,.-__return_r28_r29
#endif /* L_save_28 */

#ifdef	L_save_29
	.text
	.align	2
	.globl	__save_r29
	.type	__save_r29,@function
	/* Allocate space and save register 29 on the stack.  */
	/* Called via:	jalr __save_r29,r10.  */
__save_r29:
	add	-4,sp
	st.w	r29,0[sp]
	jmp	[r10]
	.size	__save_r29,.-__save_r29

	/* Restore saved register 29, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r29.  */
	.align	2
	.globl	__return_r29
	.type	__return_r29,@function
__return_r29:
	ld.w	0[sp],r29
	add	4,sp
	jmp	[r31]
	.size	__return_r29,.-__return_r29
#endif /* L_save_28 */

#ifdef	L_save_2c
	.text
	.align	2
	.globl	__save_r2_r31
	.type	__save_r2_r31,@function
	/* Allocate space and save registers 20 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r2_r31,r10.  */
__save_r2_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-48,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r21,32[ep]
	sst.w	r20,36[ep]
	sst.w	r2,40[ep]
	sst.w	r31,44[ep]
	mov	r1,ep
#else
	addi	-48,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r21,32[sp]
	st.w	r20,36[sp]
	st.w	r2,40[sp]
	st.w	r31,44[sp]
#endif
	jmp	[r10]
	.size	__save_r2_r31,.-__save_r2_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r20_r31.  */
	.align	2
	.globl	__return_r2_r31
	.type	__return_r2_r31,@function
__return_r2_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r21
	sld.w	36[ep],r20
	sld.w	40[ep],r2
	sld.w	44[ep],r31
	addi	48,sp,sp
	mov	r1,ep
#else
	ld.w	44[sp],r29
	ld.w	40[sp],r28
	ld.w	36[sp],r27
	ld.w	32[sp],r26
	ld.w	28[sp],r25
	ld.w	24[sp],r24
	ld.w	20[sp],r23
	ld.w	16[sp],r22
	ld.w	12[sp],r21
	ld.w	8[sp],r20
	ld.w	4[sp],r2
	ld.w	0[sp],r31
	addi	48,sp,sp
#endif
	jmp	[r31]
	.size	__return_r2_r31,.-__return_r2_r31
#endif /* L_save_2c */

#ifdef	L_save_20c
	.text
	.align	2
	.globl	__save_r20_r31
	.type	__save_r20_r31,@function
	/* Allocate space and save registers 20 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r20_r31,r10.  */
__save_r20_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-44,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r21,32[ep]
	sst.w	r20,36[ep]
	sst.w	r31,40[ep]
	mov	r1,ep
#else
	addi	-44,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r21,32[sp]
	st.w	r20,36[sp]
	st.w	r31,40[sp]
#endif
	jmp	[r10]
	.size	__save_r20_r31,.-__save_r20_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r20_r31.  */
	.align	2
	.globl	__return_r20_r31
	.type	__return_r20_r31,@function
__return_r20_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r21
	sld.w	36[ep],r20
	sld.w	40[ep],r31
	addi	44,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	ld.w	32[sp],r21
	ld.w	36[sp],r20
	ld.w	40[sp],r31
	addi	44,sp,sp
#endif
	jmp	[r31]
	.size	__return_r20_r31,.-__return_r20_r31
#endif /* L_save_20c */

#ifdef	L_save_21c
	.text
	.align	2
	.globl	__save_r21_r31
	.type	__save_r21_r31,@function
	/* Allocate space and save registers 21 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r21_r31,r10.  */
__save_r21_r31:
#ifdef __EP__	
	mov	ep,r1
	addi	-40,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r21,32[ep]
	sst.w	r31,36[ep]
	mov	r1,ep
	jmp	[r10]
#else	
	addi	-40,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r21,32[sp]
	st.w	r31,36[sp]
	jmp	[r10]
#endif	
	.size	__save_r21_r31,.-__save_r21_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r21_r31.  */
	.align	2
	.globl	__return_r21_r31
	.type	__return_r21_r31,@function
__return_r21_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r21
	sld.w	36[ep],r31
	addi	40,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	ld.w	32[sp],r21
	ld.w	36[sp],r31
	addi	40,sp,sp
#endif
	jmp	[r31]
	.size	__return_r21_r31,.-__return_r21_r31
#endif /* L_save_21c */

#ifdef	L_save_22c
	.text
	.align	2
	.globl	__save_r22_r31
	.type	__save_r22_r31,@function
	/* Allocate space and save registers 22 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r22_r31,r10.  */
__save_r22_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-36,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r22,28[ep]
	sst.w	r31,32[ep]
	mov	r1,ep
#else
	addi	-36,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r22,28[sp]
	st.w	r31,32[sp]
#endif
	jmp	[r10]
	.size	__save_r22_r31,.-__save_r22_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r22_r31.  */
	.align	2
	.globl	__return_r22_r31
	.type	__return_r22_r31,@function
__return_r22_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r22
	sld.w	32[ep],r31
	addi	36,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r22
	ld.w	32[sp],r31
	addi	36,sp,sp
#endif
	jmp	[r31]
	.size	__return_r22_r31,.-__return_r22_r31
#endif /* L_save_22c */

#ifdef	L_save_23c
	.text
	.align	2
	.globl	__save_r23_r31
	.type	__save_r23_r31,@function
	/* Allocate space and save registers 23 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r23_r31,r10.  */
__save_r23_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-32,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r23,24[ep]
	sst.w	r31,28[ep]
	mov	r1,ep
#else
	addi	-32,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r23,24[sp]
	st.w	r31,28[sp]
#endif
	jmp	[r10]
	.size	__save_r23_r31,.-__save_r23_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r23_r31.  */
	.align	2
	.globl	__return_r23_r31
	.type	__return_r23_r31,@function
__return_r23_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r23
	sld.w	28[ep],r31
	addi	32,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r23
	ld.w	28[sp],r31
	addi	32,sp,sp
#endif
	jmp	[r31]
	.size	__return_r23_r31,.-__return_r23_r31
#endif /* L_save_23c */

#ifdef	L_save_24c
	.text
	.align	2
	.globl	__save_r24_r31
	.type	__save_r24_r31,@function
	/* Allocate space and save registers 24 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r24_r31,r10.  */
__save_r24_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-28,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r24,20[ep]
	sst.w	r31,24[ep]
	mov	r1,ep
#else
	addi	-28,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r24,20[sp]
	st.w	r31,24[sp]
#endif
	jmp	[r10]
	.size	__save_r24_r31,.-__save_r24_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r24_r31.  */
	.align	2
	.globl	__return_r24_r31
	.type	__return_r24_r31,@function
__return_r24_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r24
	sld.w	24[ep],r31
	addi	28,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r24
	ld.w	24[sp],r31
	addi	28,sp,sp
#endif
	jmp	[r31]
	.size	__return_r24_r31,.-__return_r24_r31
#endif /* L_save_24c */

#ifdef	L_save_25c
	.text
	.align	2
	.globl	__save_r25_r31
	.type	__save_r25_r31,@function
	/* Allocate space and save registers 25 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r25_r31,r10.  */
__save_r25_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-24,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r25,16[ep]
	sst.w	r31,20[ep]
	mov	r1,ep
#else
	addi	-24,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r25,16[sp]
	st.w	r31,20[sp]
#endif
	jmp	[r10]
	.size	__save_r25_r31,.-__save_r25_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r25_r31.  */
	.align	2
	.globl	__return_r25_r31
	.type	__return_r25_r31,@function
__return_r25_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r25
	sld.w	20[ep],r31
	addi	24,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r25
	ld.w	20[sp],r31
	addi	24,sp,sp
#endif
	jmp	[r31]
	.size	__return_r25_r31,.-__return_r25_r31
#endif /* L_save_25c */

#ifdef	L_save_26c
	.text
	.align	2
	.globl	__save_r26_r31
	.type	__save_r26_r31,@function
	/* Allocate space and save registers 26 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r26_r31,r10.  */
__save_r26_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-20,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r26,12[ep]
	sst.w	r31,16[ep]
	mov	r1,ep
#else
	addi	-20,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r26,12[sp]
	st.w	r31,16[sp]
#endif
	jmp	[r10]
	.size	__save_r26_r31,.-__save_r26_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r26_r31.  */
	.align	2
	.globl	__return_r26_r31
	.type	__return_r26_r31,@function
__return_r26_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r26
	sld.w	16[ep],r31
	addi	20,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r26
	ld.w	16[sp],r31
	addi	20,sp,sp
#endif
	jmp	[r31]
	.size	__return_r26_r31,.-__return_r26_r31
#endif /* L_save_26c */

#ifdef	L_save_27c
	.text
	.align	2
	.globl	__save_r27_r31
	.type	__save_r27_r31,@function
	/* Allocate space and save registers 27 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r27_r31,r10.  */
__save_r27_r31:
#ifdef __EP__
	mov	ep,r1
	addi	-16,sp,sp
	mov	sp,ep
	sst.w	r29,0[ep]
	sst.w	r28,4[ep]
	sst.w	r27,8[ep]
	sst.w	r31,12[ep]
	mov	r1,ep
#else
	addi	-16,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r27,8[sp]
	st.w	r31,12[sp]
#endif
	jmp	[r10]
	.size	__save_r27_r31,.-__save_r27_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r27_r31.  */
	.align	2
	.globl	__return_r27_r31
	.type	__return_r27_r31,@function
__return_r27_r31:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	0[ep],r29
	sld.w	4[ep],r28
	sld.w	8[ep],r27
	sld.w	12[ep],r31
	addi	16,sp,sp
	mov	r1,ep
#else
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r27
	ld.w	12[sp],r31
	addi	16,sp,sp
#endif
	jmp	[r31]
	.size	__return_r27_r31,.-__return_r27_r31
#endif /* L_save_27c */

#ifdef	L_save_28c
	.text
	.align	2
	.globl	__save_r28_r31
	.type	__save_r28_r31,@function
	/* Allocate space and save registers 28 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r28_r31,r10.  */
__save_r28_r31:
	addi	-12,sp,sp
	st.w	r29,0[sp]
	st.w	r28,4[sp]
	st.w	r31,8[sp]
	jmp	[r10]
	.size	__save_r28_r31,.-__save_r28_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r28_r31.  */
	.align	2
	.globl	__return_r28_r31
	.type	__return_r28_r31,@function
__return_r28_r31:
	ld.w	0[sp],r29
	ld.w	4[sp],r28
	ld.w	8[sp],r31
	addi	12,sp,sp
	jmp	[r31]
	.size	__return_r28_r31,.-__return_r28_r31
#endif /* L_save_28c */

#ifdef	L_save_29c
	.text
	.align	2
	.globl	__save_r29_r31
	.type	__save_r29_r31,@function
	/* Allocate space and save registers 29 & 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r29_r31,r10.  */
__save_r29_r31:
	addi	-8,sp,sp
	st.w	r29,0[sp]
	st.w	r31,4[sp]
	jmp	[r10]
	.size	__save_r29_r31,.-__save_r29_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r29_r31.  */
	.align	2
	.globl	__return_r29_r31
	.type	__return_r29_r31,@function
__return_r29_r31:
	ld.w	0[sp],r29
	ld.w	4[sp],r31
	addi	8,sp,sp
	jmp	[r31]
	.size	__return_r29_r31,.-__return_r29_r31
#endif /* L_save_29c */

#ifdef	L_save_31c
	.text
	.align	2
	.globl	__save_r31
	.type	__save_r31,@function
	/* Allocate space and save register 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	jalr __save_r31,r10.  */
__save_r31:
	addi	-4,sp,sp
	st.w	r31,0[sp]
	jmp	[r10]
	.size	__save_r31,.-__save_r31

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	jr __return_r31.  */
	.align	2
	.globl	__return_r31
	.type	__return_r31,@function
__return_r31:
	ld.w	0[sp],r31
	addi	4,sp,sp
	jmp	[r31]
        .size   __return_r31,.-__return_r31
#endif /* L_save_31c */

#ifdef	L_save_interrupt
	.text
	.align	2
	.globl	__save_interrupt
	.type	__save_interrupt,@function
	/* Save registers r1, r4 on stack and load up with expected values.  */
	/* Note, 20 bytes of stack have already been allocated.  */
	/* Called via:	jalr __save_interrupt,r10.  */
__save_interrupt:
       /* add -20,sp ; st.w r11,16[sp] ; st.w r10,12[sp] ; */
	st.w	ep,0[sp]
	st.w	gp,4[sp]
	st.w	r1,8[sp]
	movhi	hi(__ep),r0,ep
	movea	lo(__ep),ep,ep
	movhi	hi(__gp),r0,gp
	movea	lo(__gp),gp,gp
	jmp	[r10]
	.size	__save_interrupt,.-__save_interrupt

	/* Restore saved registers, deallocate stack and return from the interrupt.  */
	/* Called via:	jr __return_interrupt.  */
	.align	2
	.globl	__return_interrupt
	.type	__return_interrupt,@function
__return_interrupt:
	ld.w	0[sp],ep
	ld.w	4[sp],gp
	ld.w	8[sp],r1
	ld.w	12[sp],r10
	ld.w    16[sp],r11
	addi    20,sp,sp
	reti
	.size	__return_interrupt,.-__return_interrupt
#endif /* L_save_interrupt */

#ifdef L_save_all_interrupt
	.text
	.align	2
	.globl	__save_all_interrupt
	.type	__save_all_interrupt,@function
	/* Save all registers except for those saved in __save_interrupt.  */
	/* Allocate enough stack for all of the registers & 16 bytes of space.  */
	/* Called via:	jalr __save_all_interrupt,r10.  */
__save_all_interrupt:
	addi	-104,sp,sp
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sst.w	r31,100[ep]
	sst.w	r2,96[ep]
	sst.w	gp,92[ep]
	sst.w	r6,88[ep]
	sst.w	r7,84[ep]
	sst.w	r8,80[ep]
	sst.w	r9,76[ep]
	sst.w	r11,72[ep]
	sst.w	r12,68[ep]
	sst.w	r13,64[ep]
	sst.w	r14,60[ep]
	sst.w	r15,56[ep]
	sst.w	r16,52[ep]
	sst.w	r17,48[ep]
	sst.w	r18,44[ep]
	sst.w	r19,40[ep]
	sst.w	r20,36[ep]
	sst.w	r21,32[ep]
	sst.w	r22,28[ep]
	sst.w	r23,24[ep]
	sst.w	r24,20[ep]
	sst.w	r25,16[ep]
	sst.w	r26,12[ep]
	sst.w	r27,8[ep]
	sst.w	r28,4[ep]
	sst.w	r29,0[ep]
	mov	r1,ep
#else
	st.w	r31,100[sp]
	st.w	r2,96[sp]
	st.w	gp,92[sp]
	st.w	r6,88[sp]
	st.w	r7,84[sp]
	st.w	r8,80[sp]
	st.w	r9,76[sp]
	st.w	r11,72[sp]
	st.w	r12,68[sp]
	st.w	r13,64[sp]
	st.w	r14,60[sp]
	st.w	r15,56[sp]
	st.w	r16,52[sp]
	st.w	r17,48[sp]
	st.w	r18,44[sp]
	st.w	r19,40[sp]
	st.w	r20,36[sp]
	st.w	r21,32[sp]
	st.w	r22,28[sp]
	st.w	r23,24[sp]
	st.w	r24,20[sp]
	st.w	r25,16[sp]
	st.w	r26,12[sp]
	st.w	r27,8[sp]
	st.w	r28,4[sp]
	st.w	r29,0[sp]
#endif
	jmp	[r10]
	.size	__save_all_interrupt,.-__save_all_interrupt

	.globl	__restore_all_interrupt
	.type	__restore_all_interrupt,@function
	/* Restore all registers saved in __save_all_interrupt and
	   deallocate the stack space.  */
	/* Called via:	jalr __restore_all_interrupt,r10.  */
__restore_all_interrupt:
#ifdef __EP__
	mov	ep,r1
	mov	sp,ep
	sld.w	100[ep],r31
	sld.w	96[ep],r2
	sld.w	92[ep],gp
	sld.w	88[ep],r6
	sld.w	84[ep],r7
	sld.w	80[ep],r8
	sld.w	76[ep],r9
	sld.w	72[ep],r11
	sld.w	68[ep],r12
	sld.w	64[ep],r13
	sld.w	60[ep],r14
	sld.w	56[ep],r15
	sld.w	52[ep],r16
	sld.w	48[ep],r17
	sld.w	44[ep],r18
	sld.w	40[ep],r19
	sld.w	36[ep],r20
	sld.w	32[ep],r21
	sld.w	28[ep],r22
	sld.w	24[ep],r23
	sld.w	20[ep],r24
	sld.w	16[ep],r25
	sld.w	12[ep],r26
	sld.w	8[ep],r27
	sld.w	4[ep],r28
	sld.w	0[ep],r29
	mov	r1,ep
#else
	ld.w	100[sp],r31
	ld.w	96[sp],r2
	ld.w	92[sp],gp
	ld.w	88[sp],r6
	ld.w	84[sp],r7
	ld.w	80[sp],r8
	ld.w	76[sp],r9
	ld.w	72[sp],r11
	ld.w	68[sp],r12
	ld.w	64[sp],r13
	ld.w	60[sp],r14
	ld.w	56[sp],r15
	ld.w	52[sp],r16
	ld.w	48[sp],r17
	ld.w	44[sp],r18
	ld.w	40[sp],r19
	ld.w	36[sp],r20
	ld.w	32[sp],r21
	ld.w	28[sp],r22
	ld.w	24[sp],r23
	ld.w	20[sp],r24
	ld.w	16[sp],r25
	ld.w	12[sp],r26
	ld.w	8[sp],r27
	ld.w	4[sp],r28
	ld.w	0[sp],r29
#endif
	addi	104,sp,sp	
	jmp	[r10]
	.size	__restore_all_interrupt,.-__restore_all_interrupt
#endif /* L_save_all_interrupt */
	
#if defined __V850_CALLT__
#if defined(__v850e__) || defined(__v850e1__) || defined(__v850e2__) || defined(__v850e2v3__) || defined(__v850e3v5__)
#ifdef	L_callt_save_r2_r29
	/* Put these functions into the call table area.  */
	.call_table_text
	
	/* Allocate space and save registers 2, 20 .. 29 on the stack.  */
	/* Called via:	callt ctoff(__callt_save_r2_r29).  */
	.align	2
.L_save_r2_r29:
	add	-4, sp
	st.w	r2, 0[sp]
	prepare {r20 - r29}, 0
	ctret

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	callt ctoff(__callt_return_r2_r29).  */
	.align	2
.L_return_r2_r29:
	dispose 0, {r20-r29}
	ld.w    0[sp], r2
	add	4, sp
	jmp     [r31]

	/* Place the offsets of the start of these routines into the call table.  */
	.call_table_data

	.global	__callt_save_r2_r29
	.type	__callt_save_r2_r29,@function
__callt_save_r2_r29:	.short ctoff(.L_save_r2_r29)
	
	.global	__callt_return_r2_r29
	.type	__callt_return_r2_r29,@function
__callt_return_r2_r29:	.short ctoff(.L_return_r2_r29)
	
#endif /* L_callt_save_r2_r29.  */

#ifdef	L_callt_save_r2_r31
	/* Put these functions into the call table area.  */
	.call_table_text
	
	/* Allocate space and save registers 2 and 20 .. 29, 31 on the stack.  */
	/* Also allocate space for the argument save area.  */
	/* Called via:	callt ctoff(__callt_save_r2_r31).  */
	.align	2
.L_save_r2_r31:
	add	-4, sp
	st.w	r2, 0[sp]
	prepare {r20 - r29, r31}, 0
	ctret

	/* Restore saved registers, deallocate stack and return to the user.  */
	/* Called via:	callt ctoff(__callt_return_r2_r31).  */
	.align	2
.L_return_r2_r31:
	dispose 0, {r20 - r29, r31}
	ld.w    0[sp], r2
	addi	4, sp, sp
	jmp     [r31]

	/* Place the offsets of the start of these routines into the call table.  */
	.call_table_data

	.global	__callt_save_r2_r31
	.type	__callt_save_r2_r31,@function
__callt_save_r2_r31:	.short ctoff(.L_save_r2_r31)
	
	.global	__callt_return_r2_r31
	.type	__callt_return_r2_r31,@function
__callt_return_r2_r31:	.short ctoff(.L_return_r2_r31)
	
#endif /* L_callt_save_r2_r31 */

#ifdef	L_callt_save_interrupt
	/* Put these functions into the call table area.  */
	.call_table_text
	
	/* Save registers r1, ep, gp, r10 on stack and load up with expected values.  */
	/* Called via:	callt ctoff(__callt_save_interrupt).  */
	.align	2
.L_save_interrupt:
        /* SP has already been moved before callt ctoff(_save_interrupt).  */
        /* R1,R10,R11,ctpc,ctpsw has alread been saved bofore callt ctoff(_save_interrupt).  */
        /* addi -28, sp, sp  */
        /* st.w r1,    24[sp] */
        /* st.w r10,   12[sp] */
        /* st.w r11,   16[sp] */
        /* stsr ctpc,  r10    */
        /* st.w r10,   20[sp] */
        /* stsr ctpsw, r10    */
        /* st.w r10,   24[sp] */
        st.w    ep,  0[sp]
        st.w    gp,  4[sp]
        st.w    r1,  8[sp]
	mov	hilo(__ep),ep
	mov	hilo(__gp),gp
	ctret

        .call_table_text
	/* Restore saved registers, deallocate stack and return from the interrupt.  */
        /* Called via:  callt ctoff(__callt_restore_interrupt).  */
	.align	2
	.globl	__return_interrupt
	.type	__return_interrupt,@function
.L_return_interrupt:
        ld.w    24[sp], r1
        ldsr    r1,     ctpsw
        ld.w    20[sp], r1
        ldsr    r1,     ctpc
        ld.w    16[sp], r11
        ld.w    12[sp], r10
        ld.w     8[sp], r1
        ld.w     4[sp], gp
        ld.w     0[sp], ep
        addi    28, sp, sp
        reti

	/* Place the offsets of the start of these routines into the call table.  */
	.call_table_data

        .global __callt_save_interrupt
        .type   __callt_save_interrupt,@function
__callt_save_interrupt:         .short ctoff(.L_save_interrupt)

        .global __callt_return_interrupt
        .type   __callt_return_interrupt,@function
__callt_return_interrupt:       .short ctoff(.L_return_interrupt)
	
#endif /* L_callt_save_interrupt */

#ifdef L_callt_save_all_interrupt
	/* Put these functions into the call table area.  */
	.call_table_text
	
	/* Save all registers except for those saved in __save_interrupt.  */
	/* Allocate enough stack for all of the registers & 16 bytes of space.  */
	/* Called via:	callt ctoff(__callt_save_all_interrupt).  */
	.align	2
.L_save_all_interrupt:
	addi	-60, sp, sp
#ifdef __EP__
	mov	ep,  r1
	mov	sp,  ep
	sst.w	r2,  56[ep]
	sst.w	r5,  52[ep]
	sst.w	r6,  48[ep]
	sst.w	r7,  44[ep]
	sst.w	r8,  40[ep]
	sst.w	r9,  36[ep]
	sst.w	r11, 32[ep]
	sst.w	r12, 28[ep]
	sst.w	r13, 24[ep]
	sst.w	r14, 20[ep]
	sst.w	r15, 16[ep]
	sst.w	r16, 12[ep]
	sst.w	r17, 8[ep]
	sst.w	r18, 4[ep]
	sst.w	r19, 0[ep]
	mov	r1,  ep
#else
	st.w	r2,  56[sp]
	st.w	r5,  52[sp]
	st.w	r6,  48[sp]
	st.w	r7,  44[sp]
	st.w	r8,  40[sp]
	st.w	r9,  36[sp]
	st.w	r11, 32[sp]
	st.w	r12, 28[sp]
	st.w	r13, 24[sp]
	st.w	r14, 20[sp]
	st.w	r15, 16[sp]
	st.w	r16, 12[sp]
	st.w	r17, 8[sp]
	st.w	r18, 4[sp]
	st.w	r19, 0[sp]
#endif
	prepare {r20 - r29, r31}, 0
	ctret	

	/* Restore all registers saved in __save_all_interrupt
	   deallocate the stack space.  */
	/* Called via:	callt ctoff(__callt_restore_all_interrupt).  */
	.align 2
.L_restore_all_interrupt:
	dispose 0, {r20 - r29, r31}
#ifdef __EP__
	mov	ep, r1
	mov	sp, ep
	sld.w	0 [ep], r19
	sld.w	4 [ep], r18
	sld.w	8 [ep], r17
	sld.w	12[ep], r16
	sld.w	16[ep], r15
	sld.w	20[ep], r14
	sld.w	24[ep], r13
	sld.w	28[ep], r12
	sld.w	32[ep], r11
	sld.w	36[ep], r9
	sld.w	40[ep], r8
	sld.w	44[ep], r7
	sld.w	48[ep], r6
	sld.w	52[ep], r5
	sld.w	56[ep], r2
	mov	r1, ep
#else
	ld.w	0 [sp], r19
	ld.w	4 [sp], r18
	ld.w	8 [sp], r17
	ld.w	12[sp], r16
	ld.w	16[sp], r15
	ld.w	20[sp], r14
	ld.w	24[sp], r13
	ld.w	28[sp], r12
	ld.w	32[sp], r11
	ld.w	36[sp], r9
	ld.w	40[sp], r8
	ld.w	44[sp], r7
	ld.w	48[sp], r6
	ld.w	52[sp], r5
	ld.w	56[sp], r2
#endif
	addi	60, sp, sp
	ctret

	/* Place the offsets of the start of these routines into the call table.  */
	.call_table_data

	.global	__callt_save_all_interrupt
	.type	__callt_save_all_interrupt,@function
__callt_save_all_interrupt:	.short ctoff(.L_save_all_interrupt)
	
	.global	__callt_restore_all_interrupt
	.type	__callt_restore_all_interrupt,@function
__callt_restore_all_interrupt:	.short ctoff(.L_restore_all_interrupt)
	
#endif /* L_callt_save_all_interrupt */


#define MAKE_CALLT_FUNCS( START )						\
	.call_table_text							;\
	.align	2								;\
	/* Allocate space and save registers START .. r29 on the stack.  */	;\
	/* Called via:	callt ctoff(__callt_save_START_r29).  */		;\
.L_save_##START##_r29:								;\
	prepare { START - r29 }, 0						;\
	ctret									;\
										;\
	/* Restore saved registers, deallocate stack and return.  */		;\
	/* Called via:	callt ctoff(__return_START_r29).  */			;\
	.align	2								;\
.L_return_##START##_r29:							;\
	dispose 0, { START - r29 }, r31						;\
										;\
	/* Place the offsets of the start of these funcs into the call table.  */;\
	.call_table_data							;\
										;\
	.global	__callt_save_##START##_r29					;\
	.type	__callt_save_##START##_r29,@function				;\
__callt_save_##START##_r29:	.short ctoff(.L_save_##START##_r29 )		;\
										;\
	.global	__callt_return_##START##_r29					;\
	.type	__callt_return_##START##_r29,@function				;\
__callt_return_##START##_r29:	.short ctoff(.L_return_##START##_r29 )	


#define MAKE_CALLT_CFUNCS( START )						\
	.call_table_text							;\
	.align	2								;\
	/* Allocate space and save registers START .. r31 on the stack.  */	;\
	/* Called via:	callt ctoff(__callt_save_START_r31c).  */		;\
.L_save_##START##_r31c:								;\
	prepare { START - r29, r31}, 0						;\
	ctret									;\
										;\
	/* Restore saved registers, deallocate stack and return.  */		;\
	/* Called via:	callt ctoff(__return_START_r31c).  */			;\
	.align	2								;\
.L_return_##START##_r31c:							;\
	dispose 0, { START - r29, r31}, r31					;\
										;\
	/* Place the offsets of the start of these funcs into the call table.  */;\
	.call_table_data							;\
										;\
	.global	__callt_save_##START##_r31c					;\
	.type	__callt_save_##START##_r31c,@function				;\
__callt_save_##START##_r31c:    .short ctoff(.L_save_##START##_r31c )		;\
										;\
	.global	__callt_return_##START##_r31c					;\
	.type	__callt_return_##START##_r31c,@function				;\
__callt_return_##START##_r31c:  .short ctoff(.L_return_##START##_r31c )	

	
#ifdef	L_callt_save_20
	MAKE_CALLT_FUNCS (r20)
#endif
#ifdef	L_callt_save_21
	MAKE_CALLT_FUNCS (r21)
#endif
#ifdef	L_callt_save_22
	MAKE_CALLT_FUNCS (r22)
#endif
#ifdef	L_callt_save_23
	MAKE_CALLT_FUNCS (r23)
#endif
#ifdef	L_callt_save_24
	MAKE_CALLT_FUNCS (r24)
#endif
#ifdef	L_callt_save_25
	MAKE_CALLT_FUNCS (r25)
#endif
#ifdef	L_callt_save_26
	MAKE_CALLT_FUNCS (r26)
#endif
#ifdef	L_callt_save_27
	MAKE_CALLT_FUNCS (r27)
#endif
#ifdef	L_callt_save_28
	MAKE_CALLT_FUNCS (r28)
#endif
#ifdef	L_callt_save_29
	MAKE_CALLT_FUNCS (r29)
#endif

#ifdef	L_callt_save_20c
	MAKE_CALLT_CFUNCS (r20)
#endif
#ifdef	L_callt_save_21c
	MAKE_CALLT_CFUNCS (r21)
#endif
#ifdef	L_callt_save_22c
	MAKE_CALLT_CFUNCS (r22)
#endif
#ifdef	L_callt_save_23c
	MAKE_CALLT_CFUNCS (r23)
#endif
#ifdef	L_callt_save_24c
	MAKE_CALLT_CFUNCS (r24)
#endif
#ifdef	L_callt_save_25c
	MAKE_CALLT_CFUNCS (r25)
#endif
#ifdef	L_callt_save_26c
	MAKE_CALLT_CFUNCS (r26)
#endif
#ifdef	L_callt_save_27c
	MAKE_CALLT_CFUNCS (r27)
#endif
#ifdef	L_callt_save_28c
	MAKE_CALLT_CFUNCS (r28)
#endif
#ifdef	L_callt_save_29c
	MAKE_CALLT_CFUNCS (r29)
#endif

	
#ifdef	L_callt_save_31c
	.call_table_text
	.align	2
	/* Allocate space and save register r31 on the stack.  */
	/* Called via:	callt ctoff(__callt_save_r31c).  */
.L_callt_save_r31c:
	prepare {r31}, 0
	ctret

	/* Restore saved registers, deallocate stack and return.  */
	/* Called via:	callt ctoff(__return_r31c).  */
	.align	2
.L_callt_return_r31c:
	dispose 0, {r31}, r31
	
	/* Place the offsets of the start of these funcs into the call table.  */
	.call_table_data

	.global	__callt_save_r31c
	.type	__callt_save_r31c,@function
__callt_save_r31c:	.short ctoff(.L_callt_save_r31c)

	.global	__callt_return_r31c
	.type	__callt_return_r31c,@function
__callt_return_r31c:	.short ctoff(.L_callt_return_r31c)		
#endif

#endif /* __v850e__ + */
#endif /* __V850_CALLT__ */

/*  libgcc2 routines for NEC V850.  */
/*  Double Integer Arithmetical Operation.  */

#ifdef L_negdi2
	.text
	.global ___negdi2
	.type   ___negdi2, @function
___negdi2:
	not	r6, r10
	add	1,  r10
	setf	l,  r6
	not	r7, r11
	add	r6, r11
	jmp	[lp]

	.size ___negdi2,.-___negdi2
#endif

#ifdef L_cmpdi2
	.text
	.global ___cmpdi2
	.type	___cmpdi2,@function
___cmpdi2:
	# Signed comparison bitween each high word.
	cmp	r9, r7
	be	.L_cmpdi_cmp_low
	setf	ge, r10
	setf	gt, r6
	add	r6, r10
	jmp	[lp]
.L_cmpdi_cmp_low:
	# Unsigned comparigon bitween each low word.
	cmp     r8, r6
	setf	nl, r10
	setf	h,  r6
	add	r6, r10
	jmp	[lp]	
	.size ___cmpdi2, . - ___cmpdi2	
#endif

#ifdef L_ucmpdi2
	.text
	.global ___ucmpdi2
	.type	___ucmpdi2,@function
___ucmpdi2:
	cmp	r9, r7  # Check if each high word are same.
	bne	.L_ucmpdi_check_psw
	cmp     r8, r6  # Compare the word.
.L_ucmpdi_check_psw:
	setf	nl, r10 # 
	setf	h,  r6  # 
	add	r6, r10 # Add the result of comparison NL and comparison H.
	jmp	[lp]	
	.size ___ucmpdi2, . - ___ucmpdi2
#endif

#ifdef L_muldi3
	.text
	.global ___muldi3
	.type	___muldi3,@function
___muldi3:
#ifdef __v850__
        jarl  __save_r26_r31, r10
        addi  16,  sp, sp
        mov   r6,  r28
        shr   15,  r28
        movea lo(32767), r0, r14
        and   r14, r28
        mov   r8,  r10
        shr   15,  r10
        and   r14, r10
        mov   r6,  r19
        shr   30,  r19
        mov   r7,  r12
        shl   2,   r12
        or    r12, r19
        and   r14, r19
        mov   r8,  r13
        shr   30,  r13
        mov   r9,  r12
        shl   2,   r12
        or    r12, r13
        and   r14, r13
        mov   r7,  r11
        shr   13,  r11
        and   r14, r11
        mov   r9,  r31
        shr   13,  r31
        and   r14, r31
        mov   r7,  r29
        shr   28,  r29
        and   r14, r29
        mov   r9,  r12
        shr   28,  r12
        and   r14, r12
        and   r14, r6
        and   r14, r8
        mov   r6,  r14
        mulh  r8,  r14
        mov   r6,  r16
        mulh  r10, r16
        mov   r6,  r18
        mulh  r13, r18
        mov   r6,  r15
        mulh  r31, r15
        mulh  r12, r6
        mov   r28,  r17
        mulh  r10, r17
        add   -16, sp
        mov   r28,  r12
        mulh  r8,  r12
        add   r17, r18
        mov   r28,  r17
        mulh  r31, r17
        add   r12, r16
        mov   r28,  r12
        mulh  r13, r12
        add   r17, r6
        mov   r19, r17
        add   r12, r15
        mov   r19, r12
        mulh  r8,  r12
        mulh  r10, r17
        add   r12, r18
        mov   r19, r12
        mulh  r13, r12
        add   r17, r15
        mov   r11, r13
        mulh  r8,  r13
        add   r12, r6
        mov   r11, r12
        mulh  r10, r12
        add   r13, r15
        mulh  r29, r8
        add   r12, r6
        mov   r16, r13
        shl   15,  r13
        add   r14, r13
        mov   r18, r12
        shl   30,  r12
        mov   r13, r26
        add   r12, r26
        shr   15,  r14
        movhi hi(131071), r0,  r12
        movea lo(131071), r12, r13
        and   r13, r14
        mov   r16, r12
        and   r13, r12
        add   r12, r14
        mov   r18, r12
        shl   15,  r12
        and   r13, r12
        add   r12, r14
        shr   17,  r14
        shr   17,  r16
        add   r14, r16
        shl   13,  r15
        shr   2,   r18
        add   r18, r15
        add   r15, r16
        mov   r16, r27
        add   r8,  r6
        shl   28,  r6
        add   r6,  r27
        mov   r26, r10
        mov   r27, r11
        jr    __return_r26_r31
#else /* defined(__v850e__) */
	/*  (Ahi << 32 + Alo) * (Bhi << 32 + Blo) */
	/*   r7           r6      r9         r8   */
	mov  r8, r10
	mulu r7, r8,  r0		/* Ahi * Blo */
	mulu r6, r9,  r0		/* Alo * Bhi */
	mulu r6, r10, r11		/* Alo * Blo */
	add  r8, r11
	add  r9, r11
	jmp  [r31]
#endif /* defined(__v850e__) */
	.size ___muldi3, . - ___muldi3
#endif
OpenPOWER on IntegriCloud