summaryrefslogtreecommitdiff
path: root/gnu/egcs/gcc/config/v850/lib1funcs.asm
blob: cb1f039fa048313cdf0b1b07e300c3c19880f8f6 (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
/* libgcc1 routines for NEC V850.
   Copyright (C) 1996, 1997 Free Software Foundation, Inc.

This file is part of GNU CC.

GNU CC 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 2, or (at your option) any
later version.

In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file with other programs, and to distribute
those programs without any restriction coming from the use of this
file.  (The General Public License restrictions do apply in other
respects; for example, they cover modification of the file, and
distribution when not linked into another program.)

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.

You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.  If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

/* As a special exception, if you link this library with files
   compiled with GCC to produce an executable, this does not cause
   the resulting executable to be covered by the GNU General Public License.
   This exception does not however invalidate any other reasons why
   the executable file might be covered by the GNU General Public License.  */

#ifdef L_mulsi3
	.text
	.globl ___mulsi3
	.type  ___mulsi3,@function

/*
 * In order to not deal with negative numbers (mulh is a signed multiply
 * and we want an unsigned multiply, code the multiplication as a series
 * of 7 bit multiplies).
 *
 * int __mulsi3 (unsigned a, unsigned b)
 * {
 *   int i, j;
 *   int ret = 0;
 *
 *   for (i = 0; i < 32; i += 7)
 *     {
 *       short a_part = a & 0x7f;
 *       unsigned b_tmp = b;
 *       a >>= 7;
 * 
 *       for (j = 0; (i+j) < 32; j += 7)
 * 	{
 * 	  short b_part = b_tmp & 0x7f;
 * 	  ret += (((int)a_part) * ((int)b_part)) << (i+j);
 * 	  b_tmp >>= 7;
 * 	}
 *    }
 *
 *   return ret;
 * }
 */

___mulsi3:
	mov 0,r10			/* total */
	mov 0,r14			/* i = 0, index for multiply a's part */
	movea lo(31),r0,r16		/* upper bounds for loop */
.L5:
	mov r7,r13			/* b_tmp = b */
	andi 0x7f,r6,r15		/* a_part = (a & 127) */
	shr 7,r6			/* a >>= 7 */
	mov r14,r12			/* i+j = i */
.L9:
	andi 0x7f,r13,r11		/* b_part = (b_tmp & 127) */
	mulh r15,r11			/* ((int)a_part) * ((int)b_part) */
	shr 7,r13			/* b_tmp >>= 7 */
	shl r12,r11			/* (((int)a_part) * ((int)b_part)) << (i+j) */
	add r11,r10			/* ret += (((int)a_part) * ((int)b_part)) << (i+j) */
	add 7,r12			/* i+j += 7 */
	cmp r16,r12			/* i+j < 32 */
	ble .L9

	add 7,r14			/* i += 7 */
	cmp r16,r14			/* i < 32 */
	ble .L5

	jmp [r31]			/* return */
	.size ___mulsi3,.-___mulsi3
#endif

#ifdef L_udivsi3
	.text
	.global ___udivsi3
	.type	___udivsi3,@function
___udivsi3:
	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]
	.size ___udivsi3,.-___udivsi3
#endif

#ifdef L_divsi3
	.text
	.globl ___divsi3
	.type  ___divsi3,@function
___divsi3:
	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]
	.size ___divsi3,.-___divsi3
#endif

#ifdef  L_umodsi3
	.text
	.globl ___umodsi3
	.type  ___umodsi3,@function
___umodsi3:
	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]
	.size ___umodsi3,.-___umodsi3
#endif /* L_umodsi3 */

#ifdef  L_modsi3
	.text
	.globl ___modsi3
	.type  ___modsi3,@function
___modsi3:
	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]
	.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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	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
	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:
	mov	ep,r1
	addi	-64,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r24,36[ep]
	sst.w	r23,40[ep]
	sst.w	r22,44[ep]
	sst.w	r21,48[ep]
	sst.w	r20,52[ep]
	sst.w	r2,56[ep]
	sst.w	r31,60[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r24
	sld.w	40[ep],r23
	sld.w	44[ep],r22
	sld.w	48[ep],r21
	sld.w	52[ep],r20
	sld.w	56[ep],r2
	sld.w	60[ep],r31
	addi	64,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-60,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r24,36[ep]
	sst.w	r23,40[ep]
	sst.w	r22,44[ep]
	sst.w	r21,48[ep]
	sst.w	r20,52[ep]
	sst.w	r31,56[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r24
	sld.w	40[ep],r23
	sld.w	44[ep],r22
	sld.w	48[ep],r21
	sld.w	52[ep],r20
	sld.w	56[ep],r31
	addi	60,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-56,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r24,36[ep]
	sst.w	r23,40[ep]
	sst.w	r22,44[ep]
	sst.w	r21,48[ep]
	sst.w	r31,52[ep]
	mov	r1,ep
	jmp	[r10]
	.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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r24
	sld.w	40[ep],r23
	sld.w	44[ep],r22
	sld.w	48[ep],r21
	sld.w	52[ep],r31
	addi	56,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-52,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r24,36[ep]
	sst.w	r23,40[ep]
	sst.w	r22,44[ep]
	sst.w	r31,48[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r24
	sld.w	40[ep],r23
	sld.w	44[ep],r22
	sld.w	48[ep],r31
	addi	52,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-48,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r24,36[ep]
	sst.w	r23,40[ep]
	sst.w	r31,44[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r24
	sld.w	40[ep],r23
	sld.w	44[ep],r31
	addi	48,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-44,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r24,36[ep]
	sst.w	r31,40[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r24
	sld.w	40[ep],r31
	addi	44,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-40,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r25,32[ep]
	sst.w	r31,36[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r25
	sld.w	36[ep],r31
	addi	40,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-36,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r26,28[ep]
	sst.w	r31,32[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r26
	sld.w	32[ep],r31
	addi	36,sp,sp
	mov	r1,ep
	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:
	mov	ep,r1
	addi	-32,sp,sp
	mov	sp,ep
	sst.w	r29,16[ep]
	sst.w	r28,20[ep]
	sst.w	r27,24[ep]
	sst.w	r31,28[ep]
	mov	r1,ep
	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:
	mov	ep,r1
	mov	sp,ep
	sld.w	16[ep],r29
	sld.w	20[ep],r28
	sld.w	24[ep],r27
	sld.w	28[ep],r31
	addi	32,sp,sp
	mov	r1,ep
	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	-28,sp,sp
	st.w	r29,16[sp]
	st.w	r28,20[sp]
	st.w	r31,24[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	16[sp],r29
	ld.w	20[sp],r28
	ld.w	24[sp],r31
	addi	28,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	-24,sp,sp
	st.w	r29,16[sp]
	st.w	r31,20[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	16[sp],r29
	ld.w	20[sp],r31
	addi	24,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_r29_r31,r10 */
__save_r31:
	addi	-20,sp,sp
	st.w	r31,16[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	16[sp],r31
	addi	20,sp,sp
	jmp	[r31]
	.size	__return_r29_r31,.-__return_r29_r31
#endif /* L_save_31c */

#ifdef L_save_varargs
	.text
	.align	2
	.globl	__save_r6_r9
	.type	__save_r6_r9,@function
	/* Save registers 6 .. 9 on the stack for variable argument functions */
	/* Called via:	jalr __save_r6_r9,r10 */
__save_r6_r9:
	mov	ep,r1
	mov	sp,ep
	sst.w	r6,0[ep]
	sst.w	r7,4[ep]
	sst.w	r8,8[ep]
	sst.w	r9,12[ep]
	mov	r1,ep
	jmp	[r10]
	.size	__save_r6_r9,.-__save_r6_r9
#endif /* L_save_varargs */

#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, 12 bytes of stack have already been allocated. */
	/* Called via:	jalr __save_interrupt,r10 */
__save_interrupt:
	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
	addi	16,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	-120,sp,sp
	mov	ep,r1
	mov	sp,ep
	sst.w	r31,116[ep]
	sst.w	r2,112[ep]
	sst.w	gp,108[ep]
	sst.w	r6,104[ep]
	sst.w	r7,100[ep]
	sst.w	r8,96[ep]
	sst.w	r9,92[ep]
	sst.w	r11,88[ep]
	sst.w	r12,84[ep]
	sst.w	r13,80[ep]
	sst.w	r14,76[ep]
	sst.w	r15,72[ep]
	sst.w	r16,68[ep]
	sst.w	r17,64[ep]
	sst.w	r18,60[ep]
	sst.w	r19,56[ep]
	sst.w	r20,52[ep]
	sst.w	r21,48[ep]
	sst.w	r22,44[ep]
	sst.w	r23,40[ep]
	sst.w	r24,36[ep]
	sst.w	r25,32[ep]
	sst.w	r26,28[ep]
	sst.w	r27,24[ep]
	sst.w	r28,20[ep]
	sst.w	r29,16[ep]
	mov	r1,ep
	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 */
	/* & deallocate the stack space */
	/* Called via:	jalr __restore_all_interrupt,r10 */
__restore_all_interrupt:
	mov	ep,r1
	mov	sp,ep
	sld.w	116[ep],r31
	sld.w	112[ep],r2
	sld.w	108[ep],gp
	sld.w	104[ep],r6
	sld.w	100[ep],r7
	sld.w	96[ep],r8
	sld.w	92[ep],r9
	sld.w	88[ep],r11
	sld.w	84[ep],r12
	sld.w	80[ep],r13
	sld.w	76[ep],r14
	sld.w	72[ep],r15
	sld.w	68[ep],r16
	sld.w	64[ep],r17
	sld.w	60[ep],r18
	sld.w	56[ep],r19
	sld.w	52[ep],r20
	sld.w	48[ep],r21
	sld.w	44[ep],r22
	sld.w	40[ep],r23
	sld.w	36[ep],r24
	sld.w	32[ep],r25
	sld.w	28[ep],r26
	sld.w	24[ep],r27
	sld.w	20[ep],r28
	sld.w	16[ep],r29
	mov	r1,ep
	addi	120,sp,sp
	jmp	[r10]
	.size	__restore_all_interrupt,.-__restore_all_interrupt
#endif /* L_save_all_interrupt */