OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [v850/] [lib1funcs.asm] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 282 jeremybenn
/* libgcc routines for NEC V850.
2
   Copyright (C) 1996, 1997, 2002, 2005, 2009 Free Software Foundation, Inc.
3
 
4
This file is part of GCC.
5
 
6
GCC is free software; you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by the
8
Free Software Foundation; either version 3, or (at your option) any
9
later version.
10
 
11
This file is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
Under Section 7 of GPL version 3, you are granted additional
17
permissions described in the GCC Runtime Library Exception, version
18
3.1, as published by the Free Software Foundation.
19
 
20
You should have received a copy of the GNU General Public License and
21
a copy of the GCC Runtime Library Exception along with this program;
22
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
.  */
24
 
25
#ifdef L_mulsi3
26
        .text
27
        .globl ___mulsi3
28
        .type  ___mulsi3,@function
29
___mulsi3:
30
#ifdef __v850__
31
/*
32
   #define SHIFT 12
33
   #define MASK ((1 << SHIFT) - 1)
34
 
35
   #define STEP(i, j)                               \
36
   ({                                               \
37
       short a_part = (a >> (i)) & MASK;            \
38
       short b_part = (b >> (j)) & MASK;            \
39
       int res = (((int) a_part) * ((int) b_part)); \
40
       res;                                         \
41
   })
42
 
43
   int
44
   __mulsi3 (unsigned a, unsigned b)
45
   {
46
      return STEP (0, 0) +
47
          ((STEP (SHIFT, 0) + STEP (0, SHIFT)) << SHIFT) +
48
          ((STEP (0, 2 * SHIFT) + STEP (SHIFT, SHIFT) + STEP (2 * SHIFT, 0))
49
           << (2 * SHIFT));
50
   }
51
*/
52
        mov   r6, r14
53
        movea lo(32767), r0, r10
54
        and   r10, r14
55
        mov   r7,  r15
56
        and   r10, r15
57
        shr   15,  r6
58
        mov   r6,  r13
59
        and   r10, r13
60
        shr   15,  r7
61
        mov   r7,  r12
62
        and   r10, r12
63
        shr   15,  r6
64
        shr   15,  r7
65
        mov   r14, r10
66
        mulh  r15, r10
67
        mov   r14, r11
68
        mulh  r12, r11
69
        mov   r13, r16
70
        mulh  r15, r16
71
        mulh  r14, r7
72
        mulh  r15, r6
73
        add   r16, r11
74
        mulh  r13, r12
75
        shl   15,  r11
76
        add   r11, r10
77
        add   r12, r7
78
        add   r6,  r7
79
        shl   30,  r7
80
        add   r7,  r10
81
        jmp   [r31]
82
#endif /* __v850__ */
83
#if defined(__v850e__) || defined(__v850ea__)
84
        /* This routine is almost unneccesarry because gcc
85
           generates the MUL instruction for the RTX mulsi3.
86
           But if someone wants to link his application with
87
           previsously compiled v850 objects then they will
88
           need this function.  */
89
 
90
        /* It isn't good to put the inst sequence as below;
91
              mul r7, r6,
92
              mov r6, r10, r0
93
           In this case, there is a RAW hazard between them.
94
           MUL inst takes 2 cycle in EX stage, then MOV inst
95
           must wait 1cycle.  */
96
        mov   r7, r10
97
        mul   r6, r10, r0
98
        jmp   [r31]
99
#endif /* __v850e__ */
100
        .size ___mulsi3,.-___mulsi3
101
#endif /* L_mulsi3 */
102
 
103
 
104
#ifdef L_udivsi3
105
        .text
106
        .global ___udivsi3
107
        .type   ___udivsi3,@function
108
___udivsi3:
109
#ifdef __v850__
110
        mov 1,r12
111
        mov 0,r10
112
        cmp r6,r7
113
        bnl .L12
114
        movhi hi(-2147483648),r0,r13
115
        cmp r0,r7
116
        blt .L12
117
.L4:
118
        shl 1,r7
119
        shl 1,r12
120
        cmp r6,r7
121
        bnl .L12
122
        cmp r0,r12
123
        be .L8
124
        mov r7,r19
125
        and r13,r19
126
        be .L4
127
        br .L12
128
.L9:
129
        cmp r7,r6
130
        bl .L10
131
        sub r7,r6
132
        or r12,r10
133
.L10:
134
        shr 1,r12
135
        shr 1,r7
136
.L12:
137
        cmp r0,r12
138
        bne .L9
139
.L8:
140
        jmp [r31]
141
 
142
#else /* defined(__v850e__) */
143
 
144
        /* See comments at end of __mulsi3.  */
145
        mov   r6, r10
146
        divu  r7, r10, r0
147
        jmp   [r31]
148
 
149
#endif /* __v850e__ */
150
 
151
        .size ___udivsi3,.-___udivsi3
152
#endif
153
 
154
#ifdef L_divsi3
155
        .text
156
        .globl ___divsi3
157
        .type  ___divsi3,@function
158
___divsi3:
159
#ifdef __v850__
160
        add -8,sp
161
        st.w r31,4[sp]
162
        st.w r22,0[sp]
163
        mov 1,r22
164
        tst r7,r7
165
        bp .L3
166
        subr r0,r7
167
        subr r0,r22
168
.L3:
169
        tst r6,r6
170
        bp .L4
171
        subr r0,r6
172
        subr r0,r22
173
.L4:
174
        jarl ___udivsi3,r31
175
        cmp r0,r22
176
        bp .L7
177
        subr r0,r10
178
.L7:
179
        ld.w 0[sp],r22
180
        ld.w 4[sp],r31
181
        add 8,sp
182
        jmp [r31]
183
 
184
#else /* defined(__v850e__) */
185
 
186
        /* See comments at end of __mulsi3.  */
187
        mov   r6, r10
188
        div   r7, r10, r0
189
        jmp   [r31]
190
 
191
#endif /* __v850e__ */
192
 
193
        .size ___divsi3,.-___divsi3
194
#endif
195
 
196
#ifdef  L_umodsi3
197
        .text
198
        .globl ___umodsi3
199
        .type  ___umodsi3,@function
200
___umodsi3:
201
#ifdef __v850__
202
        add -12,sp
203
        st.w r31,8[sp]
204
        st.w r7,4[sp]
205
        st.w r6,0[sp]
206
        jarl ___udivsi3,r31
207
        ld.w 4[sp],r7
208
        mov r10,r6
209
        jarl ___mulsi3,r31
210
        ld.w 0[sp],r6
211
        subr r6,r10
212
        ld.w 8[sp],r31
213
        add 12,sp
214
        jmp [r31]
215
 
216
#else /* defined(__v850e__) */
217
 
218
        /* See comments at end of __mulsi3.  */
219
        divu  r7, r6, r10
220
        jmp   [r31]
221
 
222
#endif /* __v850e__ */
223
 
224
        .size ___umodsi3,.-___umodsi3
225
#endif /* L_umodsi3 */
226
 
227
#ifdef  L_modsi3
228
        .text
229
        .globl ___modsi3
230
        .type  ___modsi3,@function
231
___modsi3:
232
#ifdef __v850__
233
        add -12,sp
234
        st.w r31,8[sp]
235
        st.w r7,4[sp]
236
        st.w r6,0[sp]
237
        jarl ___divsi3,r31
238
        ld.w 4[sp],r7
239
        mov r10,r6
240
        jarl ___mulsi3,r31
241
        ld.w 0[sp],r6
242
        subr r6,r10
243
        ld.w 8[sp],r31
244
        add 12,sp
245
        jmp [r31]
246
 
247
#else /* defined(__v850e__) */
248
 
249
        /* See comments at end of __mulsi3.  */
250
        div  r7, r6, r10
251
        jmp [r31]
252
 
253
#endif /* __v850e__ */
254
 
255
        .size ___modsi3,.-___modsi3
256
#endif /* L_modsi3 */
257
 
258
#ifdef  L_save_2
259
        .text
260
        .align  2
261
        .globl  __save_r2_r29
262
        .type   __save_r2_r29,@function
263
        /* Allocate space and save registers 2, 20 .. 29 on the stack */
264
        /* Called via:  jalr __save_r2_r29,r10 */
265
__save_r2_r29:
266
#ifdef __EP__
267
        mov     ep,r1
268
        addi    -44,sp,sp
269
        mov     sp,ep
270
        sst.w   r29,0[ep]
271
        sst.w   r28,4[ep]
272
        sst.w   r27,8[ep]
273
        sst.w   r26,12[ep]
274
        sst.w   r25,16[ep]
275
        sst.w   r24,20[ep]
276
        sst.w   r23,24[ep]
277
        sst.w   r22,28[ep]
278
        sst.w   r21,32[ep]
279
        sst.w   r20,36[ep]
280
        sst.w   r2,40[ep]
281
        mov     r1,ep
282
#else
283
        addi    -44,sp,sp
284
        st.w    r29,0[sp]
285
        st.w    r28,4[sp]
286
        st.w    r27,8[sp]
287
        st.w    r26,12[sp]
288
        st.w    r25,16[sp]
289
        st.w    r24,20[sp]
290
        st.w    r23,24[sp]
291
        st.w    r22,28[sp]
292
        st.w    r21,32[sp]
293
        st.w    r20,36[sp]
294
        st.w    r2,40[sp]
295
#endif
296
        jmp     [r10]
297
        .size   __save_r2_r29,.-__save_r2_r29
298
 
299
        /* Restore saved registers, deallocate stack and return to the user */
300
        /* Called via:  jr __return_r2_r29 */
301
        .align  2
302
        .globl  __return_r2_r29
303
        .type   __return_r2_r29,@function
304
__return_r2_r29:
305
#ifdef __EP__
306
        mov     ep,r1
307
        mov     sp,ep
308
        sld.w   0[ep],r29
309
        sld.w   4[ep],r28
310
        sld.w   8[ep],r27
311
        sld.w   12[ep],r26
312
        sld.w   16[ep],r25
313
        sld.w   20[ep],r24
314
        sld.w   24[ep],r23
315
        sld.w   28[ep],r22
316
        sld.w   32[ep],r21
317
        sld.w   36[ep],r20
318
        sld.w   40[ep],r2
319
        addi    44,sp,sp
320
        mov     r1,ep
321
#else
322
        ld.w    0[sp],r29
323
        ld.w    4[sp],r28
324
        ld.w    8[sp],r27
325
        ld.w    12[sp],r26
326
        ld.w    16[sp],r25
327
        ld.w    20[sp],r24
328
        ld.w    24[sp],r23
329
        ld.w    28[sp],r22
330
        ld.w    32[sp],r21
331
        ld.w    36[sp],r20
332
        ld.w    40[sp],r2
333
        addi    44,sp,sp
334
#endif
335
        jmp     [r31]
336
        .size   __return_r2_r29,.-__return_r2_r29
337
#endif /* L_save_2 */
338
 
339
#ifdef  L_save_20
340
        .text
341
        .align  2
342
        .globl  __save_r20_r29
343
        .type   __save_r20_r29,@function
344
        /* Allocate space and save registers 20 .. 29 on the stack */
345
        /* Called via:  jalr __save_r20_r29,r10 */
346
__save_r20_r29:
347
#ifdef __EP__
348
        mov     ep,r1
349
        addi    -40,sp,sp
350
        mov     sp,ep
351
        sst.w   r29,0[ep]
352
        sst.w   r28,4[ep]
353
        sst.w   r27,8[ep]
354
        sst.w   r26,12[ep]
355
        sst.w   r25,16[ep]
356
        sst.w   r24,20[ep]
357
        sst.w   r23,24[ep]
358
        sst.w   r22,28[ep]
359
        sst.w   r21,32[ep]
360
        sst.w   r20,36[ep]
361
        mov     r1,ep
362
#else
363
        addi    -40,sp,sp
364
        st.w    r29,0[sp]
365
        st.w    r28,4[sp]
366
        st.w    r27,8[sp]
367
        st.w    r26,12[sp]
368
        st.w    r25,16[sp]
369
        st.w    r24,20[sp]
370
        st.w    r23,24[sp]
371
        st.w    r22,28[sp]
372
        st.w    r21,32[sp]
373
        st.w    r20,36[sp]
374
#endif
375
        jmp     [r10]
376
        .size   __save_r20_r29,.-__save_r20_r29
377
 
378
        /* Restore saved registers, deallocate stack and return to the user */
379
        /* Called via:  jr __return_r20_r29 */
380
        .align  2
381
        .globl  __return_r20_r29
382
        .type   __return_r20_r29,@function
383
__return_r20_r29:
384
#ifdef __EP__
385
        mov     ep,r1
386
        mov     sp,ep
387
        sld.w   0[ep],r29
388
        sld.w   4[ep],r28
389
        sld.w   8[ep],r27
390
        sld.w   12[ep],r26
391
        sld.w   16[ep],r25
392
        sld.w   20[ep],r24
393
        sld.w   24[ep],r23
394
        sld.w   28[ep],r22
395
        sld.w   32[ep],r21
396
        sld.w   36[ep],r20
397
        addi    40,sp,sp
398
        mov     r1,ep
399
#else
400
        ld.w    0[sp],r29
401
        ld.w    4[sp],r28
402
        ld.w    8[sp],r27
403
        ld.w    12[sp],r26
404
        ld.w    16[sp],r25
405
        ld.w    20[sp],r24
406
        ld.w    24[sp],r23
407
        ld.w    28[sp],r22
408
        ld.w    32[sp],r21
409
        ld.w    36[sp],r20
410
        addi    40,sp,sp
411
#endif
412
        jmp     [r31]
413
        .size   __return_r20_r29,.-__return_r20_r29
414
#endif /* L_save_20 */
415
 
416
#ifdef  L_save_21
417
        .text
418
        .align  2
419
        .globl  __save_r21_r29
420
        .type   __save_r21_r29,@function
421
        /* Allocate space and save registers 21 .. 29 on the stack */
422
        /* Called via:  jalr __save_r21_r29,r10 */
423
__save_r21_r29:
424
#ifdef __EP__
425
        mov     ep,r1
426
        addi    -36,sp,sp
427
        mov     sp,ep
428
        sst.w   r29,0[ep]
429
        sst.w   r28,4[ep]
430
        sst.w   r27,8[ep]
431
        sst.w   r26,12[ep]
432
        sst.w   r25,16[ep]
433
        sst.w   r24,20[ep]
434
        sst.w   r23,24[ep]
435
        sst.w   r22,28[ep]
436
        sst.w   r21,32[ep]
437
        mov     r1,ep
438
#else
439
        addi    -36,sp,sp
440
        st.w    r29,0[sp]
441
        st.w    r28,4[sp]
442
        st.w    r27,8[sp]
443
        st.w    r26,12[sp]
444
        st.w    r25,16[sp]
445
        st.w    r24,20[sp]
446
        st.w    r23,24[sp]
447
        st.w    r22,28[sp]
448
        st.w    r21,32[sp]
449
#endif
450
        jmp     [r10]
451
        .size   __save_r21_r29,.-__save_r21_r29
452
 
453
        /* Restore saved registers, deallocate stack and return to the user */
454
        /* Called via:  jr __return_r21_r29 */
455
        .align  2
456
        .globl  __return_r21_r29
457
        .type   __return_r21_r29,@function
458
__return_r21_r29:
459
#ifdef __EP__
460
        mov     ep,r1
461
        mov     sp,ep
462
        sld.w   0[ep],r29
463
        sld.w   4[ep],r28
464
        sld.w   8[ep],r27
465
        sld.w   12[ep],r26
466
        sld.w   16[ep],r25
467
        sld.w   20[ep],r24
468
        sld.w   24[ep],r23
469
        sld.w   28[ep],r22
470
        sld.w   32[ep],r21
471
        addi    36,sp,sp
472
        mov     r1,ep
473
#else
474
        ld.w    0[sp],r29
475
        ld.w    4[sp],r28
476
        ld.w    8[sp],r27
477
        ld.w    12[sp],r26
478
        ld.w    16[sp],r25
479
        ld.w    20[sp],r24
480
        ld.w    24[sp],r23
481
        ld.w    28[sp],r22
482
        ld.w    32[sp],r21
483
        addi    36,sp,sp
484
#endif
485
        jmp     [r31]
486
        .size   __return_r21_r29,.-__return_r21_r29
487
#endif /* L_save_21 */
488
 
489
#ifdef  L_save_22
490
        .text
491
        .align  2
492
        .globl  __save_r22_r29
493
        .type   __save_r22_r29,@function
494
        /* Allocate space and save registers 22 .. 29 on the stack */
495
        /* Called via:  jalr __save_r22_r29,r10 */
496
__save_r22_r29:
497
#ifdef __EP__
498
        mov     ep,r1
499
        addi    -32,sp,sp
500
        mov     sp,ep
501
        sst.w   r29,0[ep]
502
        sst.w   r28,4[ep]
503
        sst.w   r27,8[ep]
504
        sst.w   r26,12[ep]
505
        sst.w   r25,16[ep]
506
        sst.w   r24,20[ep]
507
        sst.w   r23,24[ep]
508
        sst.w   r22,28[ep]
509
        mov     r1,ep
510
#else
511
        addi    -32,sp,sp
512
        st.w    r29,0[sp]
513
        st.w    r28,4[sp]
514
        st.w    r27,8[sp]
515
        st.w    r26,12[sp]
516
        st.w    r25,16[sp]
517
        st.w    r24,20[sp]
518
        st.w    r23,24[sp]
519
        st.w    r22,28[sp]
520
#endif
521
        jmp     [r10]
522
        .size   __save_r22_r29,.-__save_r22_r29
523
 
524
        /* Restore saved registers, deallocate stack and return to the user */
525
        /* Called via:  jr __return_r22_r29 */
526
        .align  2
527
        .globl  __return_r22_r29
528
        .type   __return_r22_r29,@function
529
__return_r22_r29:
530
#ifdef __EP__
531
        mov     ep,r1
532
        mov     sp,ep
533
        sld.w   0[ep],r29
534
        sld.w   4[ep],r28
535
        sld.w   8[ep],r27
536
        sld.w   12[ep],r26
537
        sld.w   16[ep],r25
538
        sld.w   20[ep],r24
539
        sld.w   24[ep],r23
540
        sld.w   28[ep],r22
541
        addi    32,sp,sp
542
        mov     r1,ep
543
#else
544
        ld.w    0[sp],r29
545
        ld.w    4[sp],r28
546
        ld.w    8[sp],r27
547
        ld.w    12[sp],r26
548
        ld.w    16[sp],r25
549
        ld.w    20[sp],r24
550
        ld.w    24[sp],r23
551
        ld.w    28[sp],r22
552
        addi    32,sp,sp
553
#endif
554
        jmp     [r31]
555
        .size   __return_r22_r29,.-__return_r22_r29
556
#endif /* L_save_22 */
557
 
558
#ifdef  L_save_23
559
        .text
560
        .align  2
561
        .globl  __save_r23_r29
562
        .type   __save_r23_r29,@function
563
        /* Allocate space and save registers 23 .. 29 on the stack */
564
        /* Called via:  jalr __save_r23_r29,r10 */
565
__save_r23_r29:
566
#ifdef __EP__
567
        mov     ep,r1
568
        addi    -28,sp,sp
569
        mov     sp,ep
570
        sst.w   r29,0[ep]
571
        sst.w   r28,4[ep]
572
        sst.w   r27,8[ep]
573
        sst.w   r26,12[ep]
574
        sst.w   r25,16[ep]
575
        sst.w   r24,20[ep]
576
        sst.w   r23,24[ep]
577
        mov     r1,ep
578
#else
579
        addi    -28,sp,sp
580
        st.w    r29,0[sp]
581
        st.w    r28,4[sp]
582
        st.w    r27,8[sp]
583
        st.w    r26,12[sp]
584
        st.w    r25,16[sp]
585
        st.w    r24,20[sp]
586
        st.w    r23,24[sp]
587
#endif
588
        jmp     [r10]
589
        .size   __save_r23_r29,.-__save_r23_r29
590
 
591
        /* Restore saved registers, deallocate stack and return to the user */
592
        /* Called via:  jr __return_r23_r29 */
593
        .align  2
594
        .globl  __return_r23_r29
595
        .type   __return_r23_r29,@function
596
__return_r23_r29:
597
#ifdef __EP__
598
        mov     ep,r1
599
        mov     sp,ep
600
        sld.w   0[ep],r29
601
        sld.w   4[ep],r28
602
        sld.w   8[ep],r27
603
        sld.w   12[ep],r26
604
        sld.w   16[ep],r25
605
        sld.w   20[ep],r24
606
        sld.w   24[ep],r23
607
        addi    28,sp,sp
608
        mov     r1,ep
609
#else
610
        ld.w    0[sp],r29
611
        ld.w    4[sp],r28
612
        ld.w    8[sp],r27
613
        ld.w    12[sp],r26
614
        ld.w    16[sp],r25
615
        ld.w    20[sp],r24
616
        ld.w    24[sp],r23
617
        addi    28,sp,sp
618
#endif
619
        jmp     [r31]
620
        .size   __return_r23_r29,.-__return_r23_r29
621
#endif /* L_save_23 */
622
 
623
#ifdef  L_save_24
624
        .text
625
        .align  2
626
        .globl  __save_r24_r29
627
        .type   __save_r24_r29,@function
628
        /* Allocate space and save registers 24 .. 29 on the stack */
629
        /* Called via:  jalr __save_r24_r29,r10 */
630
__save_r24_r29:
631
#ifdef __EP__
632
        mov     ep,r1
633
        addi    -24,sp,sp
634
        mov     sp,ep
635
        sst.w   r29,0[ep]
636
        sst.w   r28,4[ep]
637
        sst.w   r27,8[ep]
638
        sst.w   r26,12[ep]
639
        sst.w   r25,16[ep]
640
        sst.w   r24,20[ep]
641
        mov     r1,ep
642
#else
643
        addi    -24,sp,sp
644
        st.w    r29,0[sp]
645
        st.w    r28,4[sp]
646
        st.w    r27,8[sp]
647
        st.w    r26,12[sp]
648
        st.w    r25,16[sp]
649
        st.w    r24,20[sp]
650
#endif
651
        jmp     [r10]
652
        .size   __save_r24_r29,.-__save_r24_r29
653
 
654
        /* Restore saved registers, deallocate stack and return to the user */
655
        /* Called via:  jr __return_r24_r29 */
656
        .align  2
657
        .globl  __return_r24_r29
658
        .type   __return_r24_r29,@function
659
__return_r24_r29:
660
#ifdef __EP__
661
        mov     ep,r1
662
        mov     sp,ep
663
        sld.w   0[ep],r29
664
        sld.w   4[ep],r28
665
        sld.w   8[ep],r27
666
        sld.w   12[ep],r26
667
        sld.w   16[ep],r25
668
        sld.w   20[ep],r24
669
        addi    24,sp,sp
670
        mov     r1,ep
671
#else
672
        ld.w    0[sp],r29
673
        ld.w    4[sp],r28
674
        ld.w    8[sp],r27
675
        ld.w    12[sp],r26
676
        ld.w    16[sp],r25
677
        ld.w    20[sp],r24
678
        addi    24,sp,sp
679
#endif
680
        jmp     [r31]
681
        .size   __return_r24_r29,.-__return_r24_r29
682
#endif /* L_save_24 */
683
 
684
#ifdef  L_save_25
685
        .text
686
        .align  2
687
        .globl  __save_r25_r29
688
        .type   __save_r25_r29,@function
689
        /* Allocate space and save registers 25 .. 29 on the stack */
690
        /* Called via:  jalr __save_r25_r29,r10 */
691
__save_r25_r29:
692
#ifdef __EP__
693
        mov     ep,r1
694
        addi    -20,sp,sp
695
        mov     sp,ep
696
        sst.w   r29,0[ep]
697
        sst.w   r28,4[ep]
698
        sst.w   r27,8[ep]
699
        sst.w   r26,12[ep]
700
        sst.w   r25,16[ep]
701
        mov     r1,ep
702
#else
703
        addi    -20,sp,sp
704
        st.w    r29,0[sp]
705
        st.w    r28,4[sp]
706
        st.w    r27,8[sp]
707
        st.w    r26,12[sp]
708
        st.w    r25,16[sp]
709
#endif
710
        jmp     [r10]
711
        .size   __save_r25_r29,.-__save_r25_r29
712
 
713
        /* Restore saved registers, deallocate stack and return to the user */
714
        /* Called via:  jr __return_r25_r29 */
715
        .align  2
716
        .globl  __return_r25_r29
717
        .type   __return_r25_r29,@function
718
__return_r25_r29:
719
#ifdef __EP__
720
        mov     ep,r1
721
        mov     sp,ep
722
        sld.w   0[ep],r29
723
        sld.w   4[ep],r28
724
        sld.w   8[ep],r27
725
        sld.w   12[ep],r26
726
        sld.w   16[ep],r25
727
        addi    20,sp,sp
728
        mov     r1,ep
729
#else
730
        ld.w    0[ep],r29
731
        ld.w    4[ep],r28
732
        ld.w    8[ep],r27
733
        ld.w    12[ep],r26
734
        ld.w    16[ep],r25
735
        addi    20,sp,sp
736
#endif
737
        jmp     [r31]
738
        .size   __return_r25_r29,.-__return_r25_r29
739
#endif /* L_save_25 */
740
 
741
#ifdef  L_save_26
742
        .text
743
        .align  2
744
        .globl  __save_r26_r29
745
        .type   __save_r26_r29,@function
746
        /* Allocate space and save registers 26 .. 29 on the stack */
747
        /* Called via:  jalr __save_r26_r29,r10 */
748
__save_r26_r29:
749
#ifdef __EP__
750
        mov     ep,r1
751
        add     -16,sp
752
        mov     sp,ep
753
        sst.w   r29,0[ep]
754
        sst.w   r28,4[ep]
755
        sst.w   r27,8[ep]
756
        sst.w   r26,12[ep]
757
        mov     r1,ep
758
#else
759
        add     -16,sp
760
        st.w    r29,0[sp]
761
        st.w    r28,4[sp]
762
        st.w    r27,8[sp]
763
        st.w    r26,12[sp]
764
#endif
765
        jmp     [r10]
766
        .size   __save_r26_r29,.-__save_r26_r29
767
 
768
        /* Restore saved registers, deallocate stack and return to the user */
769
        /* Called via:  jr __return_r26_r29 */
770
        .align  2
771
        .globl  __return_r26_r29
772
        .type   __return_r26_r29,@function
773
__return_r26_r29:
774
#ifdef __EP__
775
        mov     ep,r1
776
        mov     sp,ep
777
        sld.w   0[ep],r29
778
        sld.w   4[ep],r28
779
        sld.w   8[ep],r27
780
        sld.w   12[ep],r26
781
        addi    16,sp,sp
782
        mov     r1,ep
783
#else
784
        ld.w    0[sp],r29
785
        ld.w    4[sp],r28
786
        ld.w    8[sp],r27
787
        ld.w    12[sp],r26
788
        addi    16,sp,sp
789
#endif
790
        jmp     [r31]
791
        .size   __return_r26_r29,.-__return_r26_r29
792
#endif /* L_save_26 */
793
 
794
#ifdef  L_save_27
795
        .text
796
        .align  2
797
        .globl  __save_r27_r29
798
        .type   __save_r27_r29,@function
799
        /* Allocate space and save registers 27 .. 29 on the stack */
800
        /* Called via:  jalr __save_r27_r29,r10 */
801
__save_r27_r29:
802
        add     -12,sp
803
        st.w    r29,0[sp]
804
        st.w    r28,4[sp]
805
        st.w    r27,8[sp]
806
        jmp     [r10]
807
        .size   __save_r27_r29,.-__save_r27_r29
808
 
809
        /* Restore saved registers, deallocate stack and return to the user */
810
        /* Called via:  jr __return_r27_r29 */
811
        .align  2
812
        .globl  __return_r27_r29
813
        .type   __return_r27_r29,@function
814
__return_r27_r29:
815
        ld.w    0[sp],r29
816
        ld.w    4[sp],r28
817
        ld.w    8[sp],r27
818
        add     12,sp
819
        jmp     [r31]
820
        .size   __return_r27_r29,.-__return_r27_r29
821
#endif /* L_save_27 */
822
 
823
#ifdef  L_save_28
824
        .text
825
        .align  2
826
        .globl  __save_r28_r29
827
        .type   __save_r28_r29,@function
828
        /* Allocate space and save registers 28,29 on the stack */
829
        /* Called via:  jalr __save_r28_r29,r10 */
830
__save_r28_r29:
831
        add     -8,sp
832
        st.w    r29,0[sp]
833
        st.w    r28,4[sp]
834
        jmp     [r10]
835
        .size   __save_r28_r29,.-__save_r28_r29
836
 
837
        /* Restore saved registers, deallocate stack and return to the user */
838
        /* Called via:  jr __return_r28_r29 */
839
        .align  2
840
        .globl  __return_r28_r29
841
        .type   __return_r28_r29,@function
842
__return_r28_r29:
843
        ld.w    0[sp],r29
844
        ld.w    4[sp],r28
845
        add     8,sp
846
        jmp     [r31]
847
        .size   __return_r28_r29,.-__return_r28_r29
848
#endif /* L_save_28 */
849
 
850
#ifdef  L_save_29
851
        .text
852
        .align  2
853
        .globl  __save_r29
854
        .type   __save_r29,@function
855
        /* Allocate space and save register 29 on the stack */
856
        /* Called via:  jalr __save_r29,r10 */
857
__save_r29:
858
        add     -4,sp
859
        st.w    r29,0[sp]
860
        jmp     [r10]
861
        .size   __save_r29,.-__save_r29
862
 
863
        /* Restore saved register 29, deallocate stack and return to the user */
864
        /* Called via:  jr __return_r29 */
865
        .align  2
866
        .globl  __return_r29
867
        .type   __return_r29,@function
868
__return_r29:
869
        ld.w    0[sp],r29
870
        add     4,sp
871
        jmp     [r31]
872
        .size   __return_r29,.-__return_r29
873
#endif /* L_save_28 */
874
 
875
#ifdef  L_save_2c
876
        .text
877
        .align  2
878
        .globl  __save_r2_r31
879
        .type   __save_r2_r31,@function
880
        /* Allocate space and save registers 20 .. 29, 31 on the stack.  */
881
        /* Also allocate space for the argument save area.  */
882
        /* Called via:  jalr __save_r2_r31,r10.  */
883
__save_r2_r31:
884
#ifdef __EP__
885
        mov     ep,r1
886
        addi    -64,sp,sp
887
        mov     sp,ep
888
        sst.w   r29,16[ep]
889
        sst.w   r28,20[ep]
890
        sst.w   r27,24[ep]
891
        sst.w   r26,28[ep]
892
        sst.w   r25,32[ep]
893
        sst.w   r24,36[ep]
894
        sst.w   r23,40[ep]
895
        sst.w   r22,44[ep]
896
        sst.w   r21,48[ep]
897
        sst.w   r20,52[ep]
898
        sst.w   r2,56[ep]
899
        sst.w   r31,60[ep]
900
        mov     r1,ep
901
#else
902
        addi    -64,sp,sp
903
        st.w    r29,16[sp]
904
        st.w    r28,20[sp]
905
        st.w    r27,24[sp]
906
        st.w    r26,28[sp]
907
        st.w    r25,32[sp]
908
        st.w    r24,36[sp]
909
        st.w    r23,40[sp]
910
        st.w    r22,44[sp]
911
        st.w    r21,48[sp]
912
        st.w    r20,52[sp]
913
        st.w    r2,56[sp]
914
        st.w    r31,60[sp]
915
#endif
916
        jmp     [r10]
917
        .size   __save_r2_r31,.-__save_r2_r31
918
 
919
        /* Restore saved registers, deallocate stack and return to the user */
920
        /* Called via:  jr __return_r20_r31 */
921
        .align  2
922
        .globl  __return_r2_r31
923
        .type   __return_r2_r31,@function
924
__return_r2_r31:
925
#ifdef __EP__
926
        mov     ep,r1
927
        mov     sp,ep
928
        sld.w   16[ep],r29
929
        sld.w   20[ep],r28
930
        sld.w   24[ep],r27
931
        sld.w   28[ep],r26
932
        sld.w   32[ep],r25
933
        sld.w   36[ep],r24
934
        sld.w   40[ep],r23
935
        sld.w   44[ep],r22
936
        sld.w   48[ep],r21
937
        sld.w   52[ep],r20
938
        sld.w   56[ep],r2
939
        sld.w   60[ep],r31
940
        addi    64,sp,sp
941
        mov     r1,ep
942
#else
943
        ld.w    16[sp],r29
944
        ld.w    20[sp],r28
945
        ld.w    24[sp],r27
946
        ld.w    28[sp],r26
947
        ld.w    32[sp],r25
948
        ld.w    36[sp],r24
949
        ld.w    40[sp],r23
950
        ld.w    44[sp],r22
951
        ld.w    48[sp],r21
952
        ld.w    52[sp],r20
953
        ld.w    56[sp],r2
954
        ld.w    60[sp],r31
955
        addi    64,sp,sp
956
#endif
957
        jmp     [r31]
958
        .size   __return_r2_r31,.-__return_r2_r31
959
#endif /* L_save_2c */
960
 
961
#ifdef  L_save_20c
962
        .text
963
        .align  2
964
        .globl  __save_r20_r31
965
        .type   __save_r20_r31,@function
966
        /* Allocate space and save registers 20 .. 29, 31 on the stack */
967
        /* Also allocate space for the argument save area */
968
        /* Called via:  jalr __save_r20_r31,r10 */
969
__save_r20_r31:
970
#ifdef __EP__
971
        mov     ep,r1
972
        addi    -60,sp,sp
973
        mov     sp,ep
974
        sst.w   r29,16[ep]
975
        sst.w   r28,20[ep]
976
        sst.w   r27,24[ep]
977
        sst.w   r26,28[ep]
978
        sst.w   r25,32[ep]
979
        sst.w   r24,36[ep]
980
        sst.w   r23,40[ep]
981
        sst.w   r22,44[ep]
982
        sst.w   r21,48[ep]
983
        sst.w   r20,52[ep]
984
        sst.w   r31,56[ep]
985
        mov     r1,ep
986
#else
987
        addi    -60,sp,sp
988
        st.w    r29,16[sp]
989
        st.w    r28,20[sp]
990
        st.w    r27,24[sp]
991
        st.w    r26,28[sp]
992
        st.w    r25,32[sp]
993
        st.w    r24,36[sp]
994
        st.w    r23,40[sp]
995
        st.w    r22,44[sp]
996
        st.w    r21,48[sp]
997
        st.w    r20,52[sp]
998
        st.w    r31,56[sp]
999
#endif
1000
        jmp     [r10]
1001
        .size   __save_r20_r31,.-__save_r20_r31
1002
 
1003
        /* Restore saved registers, deallocate stack and return to the user */
1004
        /* Called via:  jr __return_r20_r31 */
1005
        .align  2
1006
        .globl  __return_r20_r31
1007
        .type   __return_r20_r31,@function
1008
__return_r20_r31:
1009
#ifdef __EP__
1010
        mov     ep,r1
1011
        mov     sp,ep
1012
        sld.w   16[ep],r29
1013
        sld.w   20[ep],r28
1014
        sld.w   24[ep],r27
1015
        sld.w   28[ep],r26
1016
        sld.w   32[ep],r25
1017
        sld.w   36[ep],r24
1018
        sld.w   40[ep],r23
1019
        sld.w   44[ep],r22
1020
        sld.w   48[ep],r21
1021
        sld.w   52[ep],r20
1022
        sld.w   56[ep],r31
1023
        addi    60,sp,sp
1024
        mov     r1,ep
1025
#else
1026
        ld.w    16[sp],r29
1027
        ld.w    20[sp],r28
1028
        ld.w    24[sp],r27
1029
        ld.w    28[sp],r26
1030
        ld.w    32[sp],r25
1031
        ld.w    36[sp],r24
1032
        ld.w    40[sp],r23
1033
        ld.w    44[sp],r22
1034
        ld.w    48[sp],r21
1035
        ld.w    52[sp],r20
1036
        ld.w    56[sp],r31
1037
        addi    60,sp,sp
1038
#endif
1039
        jmp     [r31]
1040
        .size   __return_r20_r31,.-__return_r20_r31
1041
#endif /* L_save_20c */
1042
 
1043
#ifdef  L_save_21c
1044
        .text
1045
        .align  2
1046
        .globl  __save_r21_r31
1047
        .type   __save_r21_r31,@function
1048
        /* Allocate space and save registers 21 .. 29, 31 on the stack */
1049
        /* Also allocate space for the argument save area */
1050
        /* Called via:  jalr __save_r21_r31,r10 */
1051
__save_r21_r31:
1052
#ifdef __EP__
1053
        mov     ep,r1
1054
        addi    -56,sp,sp
1055
        mov     sp,ep
1056
        sst.w   r29,16[ep]
1057
        sst.w   r28,20[ep]
1058
        sst.w   r27,24[ep]
1059
        sst.w   r26,28[ep]
1060
        sst.w   r25,32[ep]
1061
        sst.w   r24,36[ep]
1062
        sst.w   r23,40[ep]
1063
        sst.w   r22,44[ep]
1064
        sst.w   r21,48[ep]
1065
        sst.w   r31,52[ep]
1066
        mov     r1,ep
1067
#else
1068
        addi    -56,sp,sp
1069
        st.w    r29,16[sp]
1070
        st.w    r28,20[sp]
1071
        st.w    r27,24[sp]
1072
        st.w    r26,28[sp]
1073
        st.w    r25,32[sp]
1074
        st.w    r24,36[sp]
1075
        st.w    r23,40[sp]
1076
        st.w    r22,44[sp]
1077
        st.w    r21,48[sp]
1078
        st.w    r31,52[sp]
1079
#endif
1080
        jmp     [r10]
1081
        .size   __save_r21_r31,.-__save_r21_r31
1082
 
1083
        /* Restore saved registers, deallocate stack and return to the user */
1084
        /* Called via:  jr __return_r21_r31 */
1085
        .align  2
1086
        .globl  __return_r21_r31
1087
        .type   __return_r21_r31,@function
1088
__return_r21_r31:
1089
#ifdef __EP__
1090
        mov     ep,r1
1091
        mov     sp,ep
1092
        sld.w   16[ep],r29
1093
        sld.w   20[ep],r28
1094
        sld.w   24[ep],r27
1095
        sld.w   28[ep],r26
1096
        sld.w   32[ep],r25
1097
        sld.w   36[ep],r24
1098
        sld.w   40[ep],r23
1099
        sld.w   44[ep],r22
1100
        sld.w   48[ep],r21
1101
        sld.w   52[ep],r31
1102
        addi    56,sp,sp
1103
        mov     r1,ep
1104
#else
1105
        ld.w    16[sp],r29
1106
        ld.w    20[sp],r28
1107
        ld.w    24[sp],r27
1108
        ld.w    28[sp],r26
1109
        ld.w    32[sp],r25
1110
        ld.w    36[sp],r24
1111
        ld.w    40[sp],r23
1112
        ld.w    44[sp],r22
1113
        ld.w    48[sp],r21
1114
        ld.w    52[sp],r31
1115
        addi    56,sp,sp
1116
#endif
1117
        jmp     [r31]
1118
        .size   __return_r21_r31,.-__return_r21_r31
1119
#endif /* L_save_21c */
1120
 
1121
#ifdef  L_save_22c
1122
        .text
1123
        .align  2
1124
        .globl  __save_r22_r31
1125
        .type   __save_r22_r31,@function
1126
        /* Allocate space and save registers 22 .. 29, 31 on the stack */
1127
        /* Also allocate space for the argument save area */
1128
        /* Called via:  jalr __save_r22_r31,r10 */
1129
__save_r22_r31:
1130
#ifdef __EP__
1131
        mov     ep,r1
1132
        addi    -52,sp,sp
1133
        mov     sp,ep
1134
        sst.w   r29,16[ep]
1135
        sst.w   r28,20[ep]
1136
        sst.w   r27,24[ep]
1137
        sst.w   r26,28[ep]
1138
        sst.w   r25,32[ep]
1139
        sst.w   r24,36[ep]
1140
        sst.w   r23,40[ep]
1141
        sst.w   r22,44[ep]
1142
        sst.w   r31,48[ep]
1143
        mov     r1,ep
1144
#else
1145
        addi    -52,sp,sp
1146
        st.w    r29,16[sp]
1147
        st.w    r28,20[sp]
1148
        st.w    r27,24[sp]
1149
        st.w    r26,28[sp]
1150
        st.w    r25,32[sp]
1151
        st.w    r24,36[sp]
1152
        st.w    r23,40[sp]
1153
        st.w    r22,44[sp]
1154
        st.w    r31,48[sp]
1155
#endif
1156
        jmp     [r10]
1157
        .size   __save_r22_r31,.-__save_r22_r31
1158
 
1159
        /* Restore saved registers, deallocate stack and return to the user */
1160
        /* Called via:  jr __return_r22_r31 */
1161
        .align  2
1162
        .globl  __return_r22_r31
1163
        .type   __return_r22_r31,@function
1164
__return_r22_r31:
1165
#ifdef __EP__
1166
        mov     ep,r1
1167
        mov     sp,ep
1168
        sld.w   16[ep],r29
1169
        sld.w   20[ep],r28
1170
        sld.w   24[ep],r27
1171
        sld.w   28[ep],r26
1172
        sld.w   32[ep],r25
1173
        sld.w   36[ep],r24
1174
        sld.w   40[ep],r23
1175
        sld.w   44[ep],r22
1176
        sld.w   48[ep],r31
1177
        addi    52,sp,sp
1178
        mov     r1,ep
1179
#else
1180
        ld.w    16[sp],r29
1181
        ld.w    20[sp],r28
1182
        ld.w    24[sp],r27
1183
        ld.w    28[sp],r26
1184
        ld.w    32[sp],r25
1185
        ld.w    36[sp],r24
1186
        ld.w    40[sp],r23
1187
        ld.w    44[sp],r22
1188
        ld.w    48[sp],r31
1189
        addi    52,sp,sp
1190
#endif
1191
        jmp     [r31]
1192
        .size   __return_r22_r31,.-__return_r22_r31
1193
#endif /* L_save_22c */
1194
 
1195
#ifdef  L_save_23c
1196
        .text
1197
        .align  2
1198
        .globl  __save_r23_r31
1199
        .type   __save_r23_r31,@function
1200
        /* Allocate space and save registers 23 .. 29, 31 on the stack */
1201
        /* Also allocate space for the argument save area */
1202
        /* Called via:  jalr __save_r23_r31,r10 */
1203
__save_r23_r31:
1204
#ifdef __EP__
1205
        mov     ep,r1
1206
        addi    -48,sp,sp
1207
        mov     sp,ep
1208
        sst.w   r29,16[ep]
1209
        sst.w   r28,20[ep]
1210
        sst.w   r27,24[ep]
1211
        sst.w   r26,28[ep]
1212
        sst.w   r25,32[ep]
1213
        sst.w   r24,36[ep]
1214
        sst.w   r23,40[ep]
1215
        sst.w   r31,44[ep]
1216
        mov     r1,ep
1217
#else
1218
        addi    -48,sp,sp
1219
        st.w    r29,16[sp]
1220
        st.w    r28,20[sp]
1221
        st.w    r27,24[sp]
1222
        st.w    r26,28[sp]
1223
        st.w    r25,32[sp]
1224
        st.w    r24,36[sp]
1225
        st.w    r23,40[sp]
1226
        st.w    r31,44[sp]
1227
#endif
1228
        jmp     [r10]
1229
        .size   __save_r23_r31,.-__save_r23_r31
1230
 
1231
        /* Restore saved registers, deallocate stack and return to the user */
1232
        /* Called via:  jr __return_r23_r31 */
1233
        .align  2
1234
        .globl  __return_r23_r31
1235
        .type   __return_r23_r31,@function
1236
__return_r23_r31:
1237
#ifdef __EP__
1238
        mov     ep,r1
1239
        mov     sp,ep
1240
        sld.w   16[ep],r29
1241
        sld.w   20[ep],r28
1242
        sld.w   24[ep],r27
1243
        sld.w   28[ep],r26
1244
        sld.w   32[ep],r25
1245
        sld.w   36[ep],r24
1246
        sld.w   40[ep],r23
1247
        sld.w   44[ep],r31
1248
        addi    48,sp,sp
1249
        mov     r1,ep
1250
#else
1251
        ld.w    16[sp],r29
1252
        ld.w    20[sp],r28
1253
        ld.w    24[sp],r27
1254
        ld.w    28[sp],r26
1255
        ld.w    32[sp],r25
1256
        ld.w    36[sp],r24
1257
        ld.w    40[sp],r23
1258
        ld.w    44[sp],r31
1259
        addi    48,sp,sp
1260
#endif
1261
        jmp     [r31]
1262
        .size   __return_r23_r31,.-__return_r23_r31
1263
#endif /* L_save_23c */
1264
 
1265
#ifdef  L_save_24c
1266
        .text
1267
        .align  2
1268
        .globl  __save_r24_r31
1269
        .type   __save_r24_r31,@function
1270
        /* Allocate space and save registers 24 .. 29, 31 on the stack */
1271
        /* Also allocate space for the argument save area */
1272
        /* Called via:  jalr __save_r24_r31,r10 */
1273
__save_r24_r31:
1274
#ifdef __EP__
1275
        mov     ep,r1
1276
        addi    -44,sp,sp
1277
        mov     sp,ep
1278
        sst.w   r29,16[ep]
1279
        sst.w   r28,20[ep]
1280
        sst.w   r27,24[ep]
1281
        sst.w   r26,28[ep]
1282
        sst.w   r25,32[ep]
1283
        sst.w   r24,36[ep]
1284
        sst.w   r31,40[ep]
1285
        mov     r1,ep
1286
#else
1287
        addi    -44,sp,sp
1288
        st.w    r29,16[sp]
1289
        st.w    r28,20[sp]
1290
        st.w    r27,24[sp]
1291
        st.w    r26,28[sp]
1292
        st.w    r25,32[sp]
1293
        st.w    r24,36[sp]
1294
        st.w    r31,40[sp]
1295
#endif
1296
        jmp     [r10]
1297
        .size   __save_r24_r31,.-__save_r24_r31
1298
 
1299
        /* Restore saved registers, deallocate stack and return to the user */
1300
        /* Called via:  jr __return_r24_r31 */
1301
        .align  2
1302
        .globl  __return_r24_r31
1303
        .type   __return_r24_r31,@function
1304
__return_r24_r31:
1305
#ifdef __EP__
1306
        mov     ep,r1
1307
        mov     sp,ep
1308
        sld.w   16[ep],r29
1309
        sld.w   20[ep],r28
1310
        sld.w   24[ep],r27
1311
        sld.w   28[ep],r26
1312
        sld.w   32[ep],r25
1313
        sld.w   36[ep],r24
1314
        sld.w   40[ep],r31
1315
        addi    44,sp,sp
1316
        mov     r1,ep
1317
#else
1318
        ld.w    16[sp],r29
1319
        ld.w    20[sp],r28
1320
        ld.w    24[sp],r27
1321
        ld.w    28[sp],r26
1322
        ld.w    32[sp],r25
1323
        ld.w    36[sp],r24
1324
        ld.w    40[sp],r31
1325
        addi    44,sp,sp
1326
#endif
1327
        jmp     [r31]
1328
        .size   __return_r24_r31,.-__return_r24_r31
1329
#endif /* L_save_24c */
1330
 
1331
#ifdef  L_save_25c
1332
        .text
1333
        .align  2
1334
        .globl  __save_r25_r31
1335
        .type   __save_r25_r31,@function
1336
        /* Allocate space and save registers 25 .. 29, 31 on the stack */
1337
        /* Also allocate space for the argument save area */
1338
        /* Called via:  jalr __save_r25_r31,r10 */
1339
__save_r25_r31:
1340
#ifdef __EP__
1341
        mov     ep,r1
1342
        addi    -40,sp,sp
1343
        mov     sp,ep
1344
        sst.w   r29,16[ep]
1345
        sst.w   r28,20[ep]
1346
        sst.w   r27,24[ep]
1347
        sst.w   r26,28[ep]
1348
        sst.w   r25,32[ep]
1349
        sst.w   r31,36[ep]
1350
        mov     r1,ep
1351
#else
1352
        addi    -40,sp,sp
1353
        st.w    r29,16[sp]
1354
        st.w    r28,20[sp]
1355
        st.w    r27,24[sp]
1356
        st.w    r26,28[sp]
1357
        st.w    r25,32[sp]
1358
        st.w    r31,36[sp]
1359
#endif
1360
        jmp     [r10]
1361
        .size   __save_r25_r31,.-__save_r25_r31
1362
 
1363
        /* Restore saved registers, deallocate stack and return to the user */
1364
        /* Called via:  jr __return_r25_r31 */
1365
        .align  2
1366
        .globl  __return_r25_r31
1367
        .type   __return_r25_r31,@function
1368
__return_r25_r31:
1369
#ifdef __EP__
1370
        mov     ep,r1
1371
        mov     sp,ep
1372
        sld.w   16[ep],r29
1373
        sld.w   20[ep],r28
1374
        sld.w   24[ep],r27
1375
        sld.w   28[ep],r26
1376
        sld.w   32[ep],r25
1377
        sld.w   36[ep],r31
1378
        addi    40,sp,sp
1379
        mov     r1,ep
1380
#else
1381
        ld.w    16[sp],r29
1382
        ld.w    20[sp],r28
1383
        ld.w    24[sp],r27
1384
        ld.w    28[sp],r26
1385
        ld.w    32[sp],r25
1386
        ld.w    36[sp],r31
1387
        addi    40,sp,sp
1388
#endif
1389
        jmp     [r31]
1390
        .size   __return_r25_r31,.-__return_r25_r31
1391
#endif /* L_save_25c */
1392
 
1393
#ifdef  L_save_26c
1394
        .text
1395
        .align  2
1396
        .globl  __save_r26_r31
1397
        .type   __save_r26_r31,@function
1398
        /* Allocate space and save registers 26 .. 29, 31 on the stack */
1399
        /* Also allocate space for the argument save area */
1400
        /* Called via:  jalr __save_r26_r31,r10 */
1401
__save_r26_r31:
1402
#ifdef __EP__
1403
        mov     ep,r1
1404
        addi    -36,sp,sp
1405
        mov     sp,ep
1406
        sst.w   r29,16[ep]
1407
        sst.w   r28,20[ep]
1408
        sst.w   r27,24[ep]
1409
        sst.w   r26,28[ep]
1410
        sst.w   r31,32[ep]
1411
        mov     r1,ep
1412
#else
1413
        addi    -36,sp,sp
1414
        st.w    r29,16[sp]
1415
        st.w    r28,20[sp]
1416
        st.w    r27,24[sp]
1417
        st.w    r26,28[sp]
1418
        st.w    r31,32[sp]
1419
#endif
1420
        jmp     [r10]
1421
        .size   __save_r26_r31,.-__save_r26_r31
1422
 
1423
        /* Restore saved registers, deallocate stack and return to the user */
1424
        /* Called via:  jr __return_r26_r31 */
1425
        .align  2
1426
        .globl  __return_r26_r31
1427
        .type   __return_r26_r31,@function
1428
__return_r26_r31:
1429
#ifdef __EP__
1430
        mov     ep,r1
1431
        mov     sp,ep
1432
        sld.w   16[ep],r29
1433
        sld.w   20[ep],r28
1434
        sld.w   24[ep],r27
1435
        sld.w   28[ep],r26
1436
        sld.w   32[ep],r31
1437
        addi    36,sp,sp
1438
        mov     r1,ep
1439
#else
1440
        ld.w    16[sp],r29
1441
        ld.w    20[sp],r28
1442
        ld.w    24[sp],r27
1443
        ld.w    28[sp],r26
1444
        ld.w    32[sp],r31
1445
        addi    36,sp,sp
1446
#endif
1447
        jmp     [r31]
1448
        .size   __return_r26_r31,.-__return_r26_r31
1449
#endif /* L_save_26c */
1450
 
1451
#ifdef  L_save_27c
1452
        .text
1453
        .align  2
1454
        .globl  __save_r27_r31
1455
        .type   __save_r27_r31,@function
1456
        /* Allocate space and save registers 27 .. 29, 31 on the stack */
1457
        /* Also allocate space for the argument save area */
1458
        /* Called via:  jalr __save_r27_r31,r10 */
1459
__save_r27_r31:
1460
#ifdef __EP__
1461
        mov     ep,r1
1462
        addi    -32,sp,sp
1463
        mov     sp,ep
1464
        sst.w   r29,16[ep]
1465
        sst.w   r28,20[ep]
1466
        sst.w   r27,24[ep]
1467
        sst.w   r31,28[ep]
1468
        mov     r1,ep
1469
#else
1470
        addi    -32,sp,sp
1471
        st.w    r29,16[sp]
1472
        st.w    r28,20[sp]
1473
        st.w    r27,24[sp]
1474
        st.w    r31,28[sp]
1475
#endif
1476
        jmp     [r10]
1477
        .size   __save_r27_r31,.-__save_r27_r31
1478
 
1479
        /* Restore saved registers, deallocate stack and return to the user */
1480
        /* Called via:  jr __return_r27_r31 */
1481
        .align  2
1482
        .globl  __return_r27_r31
1483
        .type   __return_r27_r31,@function
1484
__return_r27_r31:
1485
#ifdef __EP__
1486
        mov     ep,r1
1487
        mov     sp,ep
1488
        sld.w   16[ep],r29
1489
        sld.w   20[ep],r28
1490
        sld.w   24[ep],r27
1491
        sld.w   28[ep],r31
1492
        addi    32,sp,sp
1493
        mov     r1,ep
1494
#else
1495
        ld.w    16[sp],r29
1496
        ld.w    20[sp],r28
1497
        ld.w    24[sp],r27
1498
        ld.w    28[sp],r31
1499
        addi    32,sp,sp
1500
#endif
1501
        jmp     [r31]
1502
        .size   __return_r27_r31,.-__return_r27_r31
1503
#endif /* L_save_27c */
1504
 
1505
#ifdef  L_save_28c
1506
        .text
1507
        .align  2
1508
        .globl  __save_r28_r31
1509
        .type   __save_r28_r31,@function
1510
        /* Allocate space and save registers 28 .. 29, 31 on the stack */
1511
        /* Also allocate space for the argument save area */
1512
        /* Called via:  jalr __save_r28_r31,r10 */
1513
__save_r28_r31:
1514
        addi    -28,sp,sp
1515
        st.w    r29,16[sp]
1516
        st.w    r28,20[sp]
1517
        st.w    r31,24[sp]
1518
        jmp     [r10]
1519
        .size   __save_r28_r31,.-__save_r28_r31
1520
 
1521
        /* Restore saved registers, deallocate stack and return to the user */
1522
        /* Called via:  jr __return_r28_r31 */
1523
        .align  2
1524
        .globl  __return_r28_r31
1525
        .type   __return_r28_r31,@function
1526
__return_r28_r31:
1527
        ld.w    16[sp],r29
1528
        ld.w    20[sp],r28
1529
        ld.w    24[sp],r31
1530
        addi    28,sp,sp
1531
        jmp     [r31]
1532
        .size   __return_r28_r31,.-__return_r28_r31
1533
#endif /* L_save_28c */
1534
 
1535
#ifdef  L_save_29c
1536
        .text
1537
        .align  2
1538
        .globl  __save_r29_r31
1539
        .type   __save_r29_r31,@function
1540
        /* Allocate space and save registers 29 & 31 on the stack */
1541
        /* Also allocate space for the argument save area */
1542
        /* Called via:  jalr __save_r29_r31,r10 */
1543
__save_r29_r31:
1544
        addi    -24,sp,sp
1545
        st.w    r29,16[sp]
1546
        st.w    r31,20[sp]
1547
        jmp     [r10]
1548
        .size   __save_r29_r31,.-__save_r29_r31
1549
 
1550
        /* Restore saved registers, deallocate stack and return to the user */
1551
        /* Called via:  jr __return_r29_r31 */
1552
        .align  2
1553
        .globl  __return_r29_r31
1554
        .type   __return_r29_r31,@function
1555
__return_r29_r31:
1556
        ld.w    16[sp],r29
1557
        ld.w    20[sp],r31
1558
        addi    24,sp,sp
1559
        jmp     [r31]
1560
        .size   __return_r29_r31,.-__return_r29_r31
1561
#endif /* L_save_29c */
1562
 
1563
#ifdef  L_save_31c
1564
        .text
1565
        .align  2
1566
        .globl  __save_r31
1567
        .type   __save_r31,@function
1568
        /* Allocate space and save register 31 on the stack.  */
1569
        /* Also allocate space for the argument save area.  */
1570
        /* Called via:  jalr __save_r31,r10 */
1571
__save_r31:
1572
        addi    -20,sp,sp
1573
        st.w    r31,16[sp]
1574
        jmp     [r10]
1575
        .size   __save_r31,.-__save_r31
1576
 
1577
        /* Restore saved registers, deallocate stack and return to the user.  */
1578
        /* Called via:  jr __return_r31 */
1579
        .align  2
1580
        .globl  __return_r31
1581
        .type   __return_r31,@function
1582
__return_r31:
1583
        ld.w    16[sp],r31
1584
        addi    20,sp,sp
1585
        jmp     [r31]
1586
        .size   __return_r31,.-__return_r31
1587
#endif /* L_save_31c */
1588
 
1589
#ifdef L_save_varargs
1590
        .text
1591
        .align  2
1592
        .globl  __save_r6_r9
1593
        .type   __save_r6_r9,@function
1594
        /* Save registers 6 .. 9 on the stack for variable argument functions.  */
1595
        /* Called via:  jalr __save_r6_r9,r10 */
1596
__save_r6_r9:
1597
#ifdef __EP__
1598
        mov     ep,r1
1599
        mov     sp,ep
1600
        sst.w   r6,0[ep]
1601
        sst.w   r7,4[ep]
1602
        sst.w   r8,8[ep]
1603
        sst.w   r9,12[ep]
1604
        mov     r1,ep
1605
#else
1606
        st.w    r6,0[sp]
1607
        st.w    r7,4[sp]
1608
        st.w    r8,8[sp]
1609
        st.w    r9,12[sp]
1610
#endif
1611
        jmp     [r10]
1612
        .size   __save_r6_r9,.-__save_r6_r9
1613
#endif /* L_save_varargs */
1614
 
1615
#ifdef  L_save_interrupt
1616
        .text
1617
        .align  2
1618
        .globl  __save_interrupt
1619
        .type   __save_interrupt,@function
1620
        /* Save registers r1, r4 on stack and load up with expected values.  */
1621
        /* Note, 12 bytes of stack have already been allocated.  */
1622
        /* Called via:  jalr __save_interrupt,r10 */
1623
__save_interrupt:
1624
        st.w    ep,0[sp]
1625
        st.w    gp,4[sp]
1626
        st.w    r1,8[sp]
1627
        movhi   hi(__ep),r0,ep
1628
        movea   lo(__ep),ep,ep
1629
        movhi   hi(__gp),r0,gp
1630
        movea   lo(__gp),gp,gp
1631
        jmp     [r10]
1632
        .size   __save_interrupt,.-__save_interrupt
1633
 
1634
        /* Restore saved registers, deallocate stack and return from the interrupt.  */
1635
        /* Called via:  jr __return_interrupt */
1636
        .align  2
1637
        .globl  __return_interrupt
1638
        .type   __return_interrupt,@function
1639
__return_interrupt:
1640
        ld.w    0[sp],ep
1641
        ld.w    4[sp],gp
1642
        ld.w    8[sp],r1
1643
        ld.w    12[sp],r10
1644
        addi    16,sp,sp
1645
        reti
1646
        .size   __return_interrupt,.-__return_interrupt
1647
#endif /* L_save_interrupt */
1648
 
1649
#ifdef L_save_all_interrupt
1650
        .text
1651
        .align  2
1652
        .globl  __save_all_interrupt
1653
        .type   __save_all_interrupt,@function
1654
        /* Save all registers except for those saved in __save_interrupt.  */
1655
        /* Allocate enough stack for all of the registers & 16 bytes of space.  */
1656
        /* Called via:  jalr __save_all_interrupt,r10 */
1657
__save_all_interrupt:
1658
        addi    -120,sp,sp
1659
#ifdef __EP__
1660
        mov     ep,r1
1661
        mov     sp,ep
1662
        sst.w   r31,116[ep]
1663
        sst.w   r2,112[ep]
1664
        sst.w   gp,108[ep]
1665
        sst.w   r6,104[ep]
1666
        sst.w   r7,100[ep]
1667
        sst.w   r8,96[ep]
1668
        sst.w   r9,92[ep]
1669
        sst.w   r11,88[ep]
1670
        sst.w   r12,84[ep]
1671
        sst.w   r13,80[ep]
1672
        sst.w   r14,76[ep]
1673
        sst.w   r15,72[ep]
1674
        sst.w   r16,68[ep]
1675
        sst.w   r17,64[ep]
1676
        sst.w   r18,60[ep]
1677
        sst.w   r19,56[ep]
1678
        sst.w   r20,52[ep]
1679
        sst.w   r21,48[ep]
1680
        sst.w   r22,44[ep]
1681
        sst.w   r23,40[ep]
1682
        sst.w   r24,36[ep]
1683
        sst.w   r25,32[ep]
1684
        sst.w   r26,28[ep]
1685
        sst.w   r27,24[ep]
1686
        sst.w   r28,20[ep]
1687
        sst.w   r29,16[ep]
1688
        mov     r1,ep
1689
#else
1690
        st.w    r31,116[sp]
1691
        st.w    r2,112[sp]
1692
        st.w    gp,108[sp]
1693
        st.w    r6,104[sp]
1694
        st.w    r7,100[sp]
1695
        st.w    r8,96[sp]
1696
        st.w    r9,92[sp]
1697
        st.w    r11,88[sp]
1698
        st.w    r12,84[sp]
1699
        st.w    r13,80[sp]
1700
        st.w    r14,76[sp]
1701
        st.w    r15,72[sp]
1702
        st.w    r16,68[sp]
1703
        st.w    r17,64[sp]
1704
        st.w    r18,60[sp]
1705
        st.w    r19,56[sp]
1706
        st.w    r20,52[sp]
1707
        st.w    r21,48[sp]
1708
        st.w    r22,44[sp]
1709
        st.w    r23,40[sp]
1710
        st.w    r24,36[sp]
1711
        st.w    r25,32[sp]
1712
        st.w    r26,28[sp]
1713
        st.w    r27,24[sp]
1714
        st.w    r28,20[sp]
1715
        st.w    r29,16[sp]
1716
#endif
1717
        jmp     [r10]
1718
        .size   __save_all_interrupt,.-__save_all_interrupt
1719
 
1720
        .globl  __restore_all_interrupt
1721
        .type   __restore_all_interrupt,@function
1722
        /* Restore all registers saved in __save_all_interrupt and
1723
           deallocate the stack space.  */
1724
        /* Called via:  jalr __restore_all_interrupt,r10 */
1725
__restore_all_interrupt:
1726
#ifdef __EP__
1727
        mov     ep,r1
1728
        mov     sp,ep
1729
        sld.w   116[ep],r31
1730
        sld.w   112[ep],r2
1731
        sld.w   108[ep],gp
1732
        sld.w   104[ep],r6
1733
        sld.w   100[ep],r7
1734
        sld.w   96[ep],r8
1735
        sld.w   92[ep],r9
1736
        sld.w   88[ep],r11
1737
        sld.w   84[ep],r12
1738
        sld.w   80[ep],r13
1739
        sld.w   76[ep],r14
1740
        sld.w   72[ep],r15
1741
        sld.w   68[ep],r16
1742
        sld.w   64[ep],r17
1743
        sld.w   60[ep],r18
1744
        sld.w   56[ep],r19
1745
        sld.w   52[ep],r20
1746
        sld.w   48[ep],r21
1747
        sld.w   44[ep],r22
1748
        sld.w   40[ep],r23
1749
        sld.w   36[ep],r24
1750
        sld.w   32[ep],r25
1751
        sld.w   28[ep],r26
1752
        sld.w   24[ep],r27
1753
        sld.w   20[ep],r28
1754
        sld.w   16[ep],r29
1755
        mov     r1,ep
1756
#else
1757
        ld.w    116[sp],r31
1758
        ld.w    112[sp],r2
1759
        ld.w    108[sp],gp
1760
        ld.w    104[sp],r6
1761
        ld.w    100[sp],r7
1762
        ld.w    96[sp],r8
1763
        ld.w    92[sp],r9
1764
        ld.w    88[sp],r11
1765
        ld.w    84[sp],r12
1766
        ld.w    80[sp],r13
1767
        ld.w    76[sp],r14
1768
        ld.w    72[sp],r15
1769
        ld.w    68[sp],r16
1770
        ld.w    64[sp],r17
1771
        ld.w    60[sp],r18
1772
        ld.w    56[sp],r19
1773
        ld.w    52[sp],r20
1774
        ld.w    48[sp],r21
1775
        ld.w    44[sp],r22
1776
        ld.w    40[sp],r23
1777
        ld.w    36[sp],r24
1778
        ld.w    32[sp],r25
1779
        ld.w    28[sp],r26
1780
        ld.w    24[sp],r27
1781
        ld.w    20[sp],r28
1782
        ld.w    16[sp],r29
1783
#endif
1784
        addi    120,sp,sp
1785
        jmp     [r10]
1786
        .size   __restore_all_interrupt,.-__restore_all_interrupt
1787
#endif /* L_save_all_interrupt */
1788
 
1789
 
1790
#if defined __v850e__
1791
#ifdef  L_callt_save_r2_r29
1792
        /* Put these functions into the call table area.  */
1793
        .call_table_text
1794
 
1795
        /* Allocate space and save registers 2, 20 .. 29 on the stack.  */
1796
        /* Called via:  callt ctoff(__callt_save_r2_r29).  */
1797
        .align  2
1798
.L_save_r2_r29:
1799
        add     -4, sp
1800
        st.w    r2, 0[sp]
1801
        prepare {r20 - r29}, 0
1802
        ctret
1803
 
1804
        /* Restore saved registers, deallocate stack and return to the user.  */
1805
        /* Called via:  callt ctoff(__callt_return_r2_r29).  */
1806
        .align  2
1807
.L_return_r2_r29:
1808
        dispose 0, {r20-r29}
1809
        ld.w    0[sp], r2
1810
        add     4, sp
1811
        jmp     [r31]
1812
 
1813
        /* Place the offsets of the start of these routines into the call table.  */
1814
        .call_table_data
1815
 
1816
        .global __callt_save_r2_r29
1817
        .type   __callt_save_r2_r29,@function
1818
__callt_save_r2_r29:    .short ctoff(.L_save_r2_r29)
1819
 
1820
        .global __callt_return_r2_r29
1821
        .type   __callt_return_r2_r29,@function
1822
__callt_return_r2_r29:  .short ctoff(.L_return_r2_r29)
1823
 
1824
#endif /* L_callt_save_r2_r29 */
1825
 
1826
#ifdef  L_callt_save_r2_r31
1827
        /* Put these functions into the call table area.  */
1828
        .call_table_text
1829
 
1830
        /* Allocate space and save registers 2 and 20 .. 29, 31 on the stack.  */
1831
        /* Also allocate space for the argument save area.  */
1832
        /* Called via:  callt ctoff(__callt_save_r2_r31).  */
1833
        .align  2
1834
.L_save_r2_r31:
1835
        add     -4, sp
1836
        st.w    r2, 0[sp]
1837
        prepare {r20 - r29, r31}, 4
1838
        ctret
1839
 
1840
        /* Restore saved registers, deallocate stack and return to the user.  */
1841
        /* Called via:  callt ctoff(__callt_return_r2_r31).  */
1842
        .align  2
1843
.L_return_r2_r31:
1844
        dispose 4, {r20 - r29, r31}
1845
        ld.w    0[sp], r2
1846
        addi    4, sp, sp
1847
        jmp     [r31]
1848
 
1849
        /* Place the offsets of the start of these routines into the call table.  */
1850
        .call_table_data
1851
 
1852
        .global __callt_save_r2_r31
1853
        .type   __callt_save_r2_r31,@function
1854
__callt_save_r2_r31:    .short ctoff(.L_save_r2_r31)
1855
 
1856
        .global __callt_return_r2_r31
1857
        .type   __callt_return_r2_r31,@function
1858
__callt_return_r2_r31:  .short ctoff(.L_return_r2_r31)
1859
 
1860
#endif /* L_callt_save_r2_r31 */
1861
 
1862
 
1863
#ifdef L_callt_save_r6_r9
1864
        /* Put these functions into the call table area.  */
1865
        .call_table_text
1866
 
1867
        /* Save registers r6 - r9 onto the stack in the space reserved for them.
1868
           Use by variable argument functions.
1869
           Called via:  callt ctoff(__callt_save_r6_r9).  */
1870
        .align  2
1871
.L_save_r6_r9:
1872
#ifdef __EP__
1873
        mov     ep,r1
1874
        mov     sp,ep
1875
        sst.w   r6,0[ep]
1876
        sst.w   r7,4[ep]
1877
        sst.w   r8,8[ep]
1878
        sst.w   r9,12[ep]
1879
        mov     r1,ep
1880
#else
1881
        st.w    r6,0[sp]
1882
        st.w    r7,4[sp]
1883
        st.w    r8,8[sp]
1884
        st.w    r9,12[sp]
1885
#endif
1886
        ctret
1887
 
1888
        /* Place the offsets of the start of this routines into the call table.  */
1889
        .call_table_data
1890
 
1891
        .global __callt_save_r6_r9
1892
        .type   __callt_save_r6_r9,@function
1893
__callt_save_r6_r9:     .short ctoff(.L_save_r6_r9)
1894
#endif /* L_callt_save_r6_r9 */
1895
 
1896
 
1897
#ifdef  L_callt_save_interrupt
1898
        /* Put these functions into the call table area.  */
1899
        .call_table_text
1900
 
1901
        /* Save registers r1, ep, gp, r10 on stack and load up with expected values.  */
1902
        /* Called via:  callt ctoff(__callt_save_interrupt).  */
1903
        .align  2
1904
.L_save_interrupt:
1905
        /* SP has already been moved before callt ctoff(_save_interrupt).  */
1906
        /* addi -24, sp, sp  */
1907
        st.w    ep,  0[sp]
1908
        st.w    gp,  4[sp]
1909
        st.w    r1,  8[sp]
1910
        /* R10 has already been saved before callt ctoff(_save_interrupt).  */
1911
        /* st.w    r10, 12[sp]  */
1912
        mov     hilo(__ep),ep
1913
        mov     hilo(__gp),gp
1914
        ctret
1915
 
1916
        /* Restore saved registers, deallocate stack and return from the interrupt.  */
1917
        /* Called via:  callt ctoff(__callt_restore_interrupt).  */
1918
        .align  2
1919
        .globl  __return_interrupt
1920
        .type   __return_interrupt,@function
1921
.L_return_interrupt:
1922
        ld.w    20[sp], r1
1923
        ldsr    r1,     ctpsw
1924
        ld.w    16[sp], r1
1925
        ldsr    r1,     ctpc
1926
        ld.w    12[sp], r10
1927
        ld.w     8[sp], r1
1928
        ld.w     4[sp], gp
1929
        ld.w     0[sp], ep
1930
        addi    24, sp, sp
1931
        reti
1932
 
1933
        /* Place the offsets of the start of these routines into the call table.  */
1934
        .call_table_data
1935
 
1936
        .global __callt_save_interrupt
1937
        .type   __callt_save_interrupt,@function
1938
__callt_save_interrupt:         .short ctoff(.L_save_interrupt)
1939
 
1940
        .global __callt_return_interrupt
1941
        .type   __callt_return_interrupt,@function
1942
__callt_return_interrupt:       .short ctoff(.L_return_interrupt)
1943
 
1944
#endif /* L_callt_save_interrupt */
1945
 
1946
#ifdef L_callt_save_all_interrupt
1947
        /* Put these functions into the call table area.  */
1948
        .call_table_text
1949
 
1950
        /* Save all registers except for those saved in __save_interrupt.  */
1951
        /* Allocate enough stack for all of the registers & 16 bytes of space.  */
1952
        /* Called via:  callt ctoff(__callt_save_all_interrupt).  */
1953
        .align  2
1954
.L_save_all_interrupt:
1955
        addi    -60, sp, sp
1956
#ifdef __EP__
1957
        mov     ep,  r1
1958
        mov     sp,  ep
1959
        sst.w   r2,  56[ep]
1960
        sst.w   r5,  52[ep]
1961
        sst.w   r6,  48[ep]
1962
        sst.w   r7,  44[ep]
1963
        sst.w   r8,  40[ep]
1964
        sst.w   r9,  36[ep]
1965
        sst.w   r11, 32[ep]
1966
        sst.w   r12, 28[ep]
1967
        sst.w   r13, 24[ep]
1968
        sst.w   r14, 20[ep]
1969
        sst.w   r15, 16[ep]
1970
        sst.w   r16, 12[ep]
1971
        sst.w   r17, 8[ep]
1972
        sst.w   r18, 4[ep]
1973
        sst.w   r19, 0[ep]
1974
        mov     r1,  ep
1975
#else
1976
        st.w    r2,  56[sp]
1977
        st.w    r5,  52[sp]
1978
        st.w    r6,  48[sp]
1979
        st.w    r7,  44[sp]
1980
        st.w    r8,  40[sp]
1981
        st.w    r9,  36[sp]
1982
        st.w    r11, 32[sp]
1983
        st.w    r12, 28[sp]
1984
        st.w    r13, 24[sp]
1985
        st.w    r14, 20[sp]
1986
        st.w    r15, 16[sp]
1987
        st.w    r16, 12[sp]
1988
        st.w    r17, 8[sp]
1989
        st.w    r18, 4[sp]
1990
        st.w    r19, 0[sp]
1991
#endif
1992
        prepare {r20 - r29, r31}, 4
1993
        ctret
1994
 
1995
        /* Restore all registers saved in __save_all_interrupt
1996
           deallocate the stack space.  */
1997
        /* Called via:  callt ctoff(__callt_restore_all_interrupt).  */
1998
        .align 2
1999
.L_restore_all_interrupt:
2000
        dispose 4, {r20 - r29, r31}
2001
#ifdef __EP__
2002
        mov     ep, r1
2003
        mov     sp, ep
2004
        sld.w   0 [ep], r19
2005
        sld.w   4 [ep], r18
2006
        sld.w   8 [ep], r17
2007
        sld.w   12[ep], r16
2008
        sld.w   16[ep], r15
2009
        sld.w   20[ep], r14
2010
        sld.w   24[ep], r13
2011
        sld.w   28[ep], r12
2012
        sld.w   32[ep], r11
2013
        sld.w   36[ep], r9
2014
        sld.w   40[ep], r8
2015
        sld.w   44[ep], r7
2016
        sld.w   48[ep], r6
2017
        sld.w   52[ep], r5
2018
        sld.w   56[ep], r2
2019
        mov     r1, ep
2020
#else
2021
        ld.w    0 [sp], r19
2022
        ld.w    4 [sp], r18
2023
        ld.w    8 [sp], r17
2024
        ld.w    12[sp], r16
2025
        ld.w    16[sp], r15
2026
        ld.w    20[sp], r14
2027
        ld.w    24[sp], r13
2028
        ld.w    28[sp], r12
2029
        ld.w    32[sp], r11
2030
        ld.w    36[sp], r9
2031
        ld.w    40[sp], r8
2032
        ld.w    44[sp], r7
2033
        ld.w    48[sp], r6
2034
        ld.w    52[sp], r5
2035
        ld.w    56[sp], r2
2036
#endif
2037
        addi    60, sp, sp
2038
        ctret
2039
 
2040
        /* Place the offsets of the start of these routines into the call table.  */
2041
        .call_table_data
2042
 
2043
        .global __callt_save_all_interrupt
2044
        .type   __callt_save_all_interrupt,@function
2045
__callt_save_all_interrupt:     .short ctoff(.L_save_all_interrupt)
2046
 
2047
        .global __callt_restore_all_interrupt
2048
        .type   __callt_restore_all_interrupt,@function
2049
__callt_restore_all_interrupt:  .short ctoff(.L_restore_all_interrupt)
2050
 
2051
#endif /* L_callt_save_all_interrupt */
2052
 
2053
 
2054
#define MAKE_CALLT_FUNCS( START )                                               \
2055
        .call_table_text                                                        ;\
2056
        .align  2                                                               ;\
2057
        /* Allocate space and save registers START .. r29 on the stack.  */     ;\
2058
        /* Called via:  callt ctoff(__callt_save_START_r29).  */                ;\
2059
.L_save_##START##_r29:                                                          ;\
2060
        prepare { START - r29 }, 0                                              ;\
2061
        ctret                                                                   ;\
2062
                                                                                ;\
2063
        /* Restore saved registers, deallocate stack and return.  */            ;\
2064
        /* Called via:  callt ctoff(__return_START_r29) */                      ;\
2065
        .align  2                                                               ;\
2066
.L_return_##START##_r29:                                                        ;\
2067
        dispose 0, { START - r29 }, r31                                         ;\
2068
                                                                                ;\
2069
        /* Place the offsets of the start of these funcs into the call table.  */;\
2070
        .call_table_data                                                        ;\
2071
                                                                                ;\
2072
        .global __callt_save_##START##_r29                                      ;\
2073
        .type   __callt_save_##START##_r29,@function                            ;\
2074
__callt_save_##START##_r29:     .short ctoff(.L_save_##START##_r29 )            ;\
2075
                                                                                ;\
2076
        .global __callt_return_##START##_r29                                    ;\
2077
        .type   __callt_return_##START##_r29,@function                          ;\
2078
__callt_return_##START##_r29:   .short ctoff(.L_return_##START##_r29 )
2079
 
2080
 
2081
#define MAKE_CALLT_CFUNCS( START )                                              \
2082
        .call_table_text                                                        ;\
2083
        .align  2                                                               ;\
2084
        /* Allocate space and save registers START .. r31 on the stack.  */     ;\
2085
        /* Called via:  callt ctoff(__callt_save_START_r31c).  */               ;\
2086
.L_save_##START##_r31c:                                                         ;\
2087
        prepare { START - r29, r31}, 4                                          ;\
2088
        ctret                                                                   ;\
2089
                                                                                ;\
2090
        /* Restore saved registers, deallocate stack and return.  */            ;\
2091
        /* Called via:  callt ctoff(__return_START_r31c).  */                   ;\
2092
        .align  2                                                               ;\
2093
.L_return_##START##_r31c:                                                       ;\
2094
        dispose 4, { START - r29, r31}, r31                                     ;\
2095
                                                                                ;\
2096
        /* Place the offsets of the start of these funcs into the call table.  */;\
2097
        .call_table_data                                                        ;\
2098
                                                                                ;\
2099
        .global __callt_save_##START##_r31c                                     ;\
2100
        .type   __callt_save_##START##_r31c,@function                           ;\
2101
__callt_save_##START##_r31c:    .short ctoff(.L_save_##START##_r31c )           ;\
2102
                                                                                ;\
2103
        .global __callt_return_##START##_r31c                                   ;\
2104
        .type   __callt_return_##START##_r31c,@function                         ;\
2105
__callt_return_##START##_r31c:  .short ctoff(.L_return_##START##_r31c )
2106
 
2107
 
2108
#ifdef  L_callt_save_20
2109
        MAKE_CALLT_FUNCS (r20)
2110
#endif
2111
#ifdef  L_callt_save_21
2112
        MAKE_CALLT_FUNCS (r21)
2113
#endif
2114
#ifdef  L_callt_save_22
2115
        MAKE_CALLT_FUNCS (r22)
2116
#endif
2117
#ifdef  L_callt_save_23
2118
        MAKE_CALLT_FUNCS (r23)
2119
#endif
2120
#ifdef  L_callt_save_24
2121
        MAKE_CALLT_FUNCS (r24)
2122
#endif
2123
#ifdef  L_callt_save_25
2124
        MAKE_CALLT_FUNCS (r25)
2125
#endif
2126
#ifdef  L_callt_save_26
2127
        MAKE_CALLT_FUNCS (r26)
2128
#endif
2129
#ifdef  L_callt_save_27
2130
        MAKE_CALLT_FUNCS (r27)
2131
#endif
2132
#ifdef  L_callt_save_28
2133
        MAKE_CALLT_FUNCS (r28)
2134
#endif
2135
#ifdef  L_callt_save_29
2136
        MAKE_CALLT_FUNCS (r29)
2137
#endif
2138
 
2139
#ifdef  L_callt_save_20c
2140
        MAKE_CALLT_CFUNCS (r20)
2141
#endif
2142
#ifdef  L_callt_save_21c
2143
        MAKE_CALLT_CFUNCS (r21)
2144
#endif
2145
#ifdef  L_callt_save_22c
2146
        MAKE_CALLT_CFUNCS (r22)
2147
#endif
2148
#ifdef  L_callt_save_23c
2149
        MAKE_CALLT_CFUNCS (r23)
2150
#endif
2151
#ifdef  L_callt_save_24c
2152
        MAKE_CALLT_CFUNCS (r24)
2153
#endif
2154
#ifdef  L_callt_save_25c
2155
        MAKE_CALLT_CFUNCS (r25)
2156
#endif
2157
#ifdef  L_callt_save_26c
2158
        MAKE_CALLT_CFUNCS (r26)
2159
#endif
2160
#ifdef  L_callt_save_27c
2161
        MAKE_CALLT_CFUNCS (r27)
2162
#endif
2163
#ifdef  L_callt_save_28c
2164
        MAKE_CALLT_CFUNCS (r28)
2165
#endif
2166
#ifdef  L_callt_save_29c
2167
        MAKE_CALLT_CFUNCS (r29)
2168
#endif
2169
 
2170
 
2171
#ifdef  L_callt_save_31c
2172
        .call_table_text
2173
        .align  2
2174
        /* Allocate space and save register r31 on the stack.  */
2175
        /* Called via:  callt ctoff(__callt_save_r31c).  */
2176
.L_callt_save_r31c:
2177
        prepare {r31}, 4
2178
        ctret
2179
 
2180
        /* Restore saved registers, deallocate stack and return.  */
2181
        /* Called via:  callt ctoff(__return_r31c).  */
2182
        .align  2
2183
.L_callt_return_r31c:
2184
        dispose 4, {r31}, r31
2185
 
2186
        /* Place the offsets of the start of these funcs into the call table.  */
2187
        .call_table_data
2188
 
2189
        .global __callt_save_r31c
2190
        .type   __callt_save_r31c,@function
2191
__callt_save_r31c:      .short ctoff(.L_callt_save_r31c)
2192
 
2193
        .global __callt_return_r31c
2194
        .type   __callt_return_r31c,@function
2195
__callt_return_r31c:    .short ctoff(.L_callt_return_r31c)
2196
#endif
2197
 
2198
#endif /* __v850e__ */
2199
 
2200
/*  libgcc2 routines for NEC V850.  */
2201
/*  Double Integer Arithmetical Operation.  */
2202
 
2203
#ifdef L_negdi2
2204
        .text
2205
        .global ___negdi2
2206
        .type   ___negdi2, @function
2207
___negdi2:
2208
        not     r6, r10
2209
        add     1,  r10
2210
        setf    l,  r6
2211
        not     r7, r11
2212
        add     r6, r11
2213
        jmp     [lp]
2214
 
2215
        .size ___negdi2,.-___negdi2
2216
#endif
2217
 
2218
#ifdef L_cmpdi2
2219
        .text
2220
        .global ___cmpdi2
2221
        .type   ___cmpdi2,@function
2222
___cmpdi2:
2223
        # Signed comparison bitween each high word.
2224
        cmp     r9, r7
2225
        be      .L_cmpdi_cmp_low
2226
        setf    ge, r10
2227
        setf    gt, r6
2228
        add     r6, r10
2229
        jmp     [lp]
2230
.L_cmpdi_cmp_low:
2231
        # Unsigned comparigon bitween each low word.
2232
        cmp     r8, r6
2233
        setf    nl, r10
2234
        setf    h,  r6
2235
        add     r6, r10
2236
        jmp     [lp]
2237
        .size ___cmpdi2, . - ___cmpdi2
2238
#endif
2239
 
2240
#ifdef L_ucmpdi2
2241
        .text
2242
        .global ___ucmpdi2
2243
        .type   ___ucmpdi2,@function
2244
___ucmpdi2:
2245
        cmp     r9, r7  # Check if each high word are same.
2246
        bne     .L_ucmpdi_check_psw
2247
        cmp     r8, r6  # Compare the word.
2248
.L_ucmpdi_check_psw:
2249
        setf    nl, r10 #
2250
        setf    h,  r6  #
2251
        add     r6, r10 # Add the result of comparison NL and comparison H.
2252
        jmp     [lp]
2253
        .size ___ucmpdi2, . - ___ucmpdi2
2254
#endif
2255
 
2256
#ifdef L_muldi3
2257
        .text
2258
        .global ___muldi3
2259
        .type   ___muldi3,@function
2260
___muldi3:
2261
#ifdef __v850__
2262
        jarl  __save_r26_r31, r10
2263
        addi  16,  sp, sp
2264
        mov   r6,  r28
2265
        shr   15,  r28
2266
        movea lo(32767), r0, r14
2267
        and   r14, r28
2268
        mov   r8,  r10
2269
        shr   15,  r10
2270
        and   r14, r10
2271
        mov   r6,  r19
2272
        shr   30,  r19
2273
        mov   r7,  r12
2274
        shl   2,   r12
2275
        or    r12, r19
2276
        and   r14, r19
2277
        mov   r8,  r13
2278
        shr   30,  r13
2279
        mov   r9,  r12
2280
        shl   2,   r12
2281
        or    r12, r13
2282
        and   r14, r13
2283
        mov   r7,  r11
2284
        shr   13,  r11
2285
        and   r14, r11
2286
        mov   r9,  r31
2287
        shr   13,  r31
2288
        and   r14, r31
2289
        mov   r7,  r29
2290
        shr   28,  r29
2291
        and   r14, r29
2292
        mov   r9,  r12
2293
        shr   28,  r12
2294
        and   r14, r12
2295
        and   r14, r6
2296
        and   r14, r8
2297
        mov   r6,  r14
2298
        mulh  r8,  r14
2299
        mov   r6,  r16
2300
        mulh  r10, r16
2301
        mov   r6,  r18
2302
        mulh  r13, r18
2303
        mov   r6,  r15
2304
        mulh  r31, r15
2305
        mulh  r12, r6
2306
        mov   r28,  r17
2307
        mulh  r10, r17
2308
        add   -16, sp
2309
        mov   r28,  r12
2310
        mulh  r8,  r12
2311
        add   r17, r18
2312
        mov   r28,  r17
2313
        mulh  r31, r17
2314
        add   r12, r16
2315
        mov   r28,  r12
2316
        mulh  r13, r12
2317
        add   r17, r6
2318
        mov   r19, r17
2319
        add   r12, r15
2320
        mov   r19, r12
2321
        mulh  r8,  r12
2322
        mulh  r10, r17
2323
        add   r12, r18
2324
        mov   r19, r12
2325
        mulh  r13, r12
2326
        add   r17, r15
2327
        mov   r11, r13
2328
        mulh  r8,  r13
2329
        add   r12, r6
2330
        mov   r11, r12
2331
        mulh  r10, r12
2332
        add   r13, r15
2333
        mulh  r29, r8
2334
        add   r12, r6
2335
        mov   r16, r13
2336
        shl   15,  r13
2337
        add   r14, r13
2338
        mov   r18, r12
2339
        shl   30,  r12
2340
        mov   r13, r26
2341
        add   r12, r26
2342
        shr   15,  r14
2343
        movhi hi(131071), r0,  r12
2344
        movea lo(131071), r12, r13
2345
        and   r13, r14
2346
        mov   r16, r12
2347
        and   r13, r12
2348
        add   r12, r14
2349
        mov   r18, r12
2350
        shl   15,  r12
2351
        and   r13, r12
2352
        add   r12, r14
2353
        shr   17,  r14
2354
        shr   17,  r16
2355
        add   r14, r16
2356
        shl   13,  r15
2357
        shr   2,   r18
2358
        add   r18, r15
2359
        add   r15, r16
2360
        mov   r16, r27
2361
        add   r8,  r6
2362
        shl   28,  r6
2363
        add   r6,  r27
2364
        mov   r26, r10
2365
        mov   r27, r11
2366
        jr    __return_r26_r31
2367
#endif /* __v850__ */
2368
#if defined(__v850e__) || defined(__v850ea__)
2369
        /*  (Ahi << 32 + Alo) * (Bhi << 32 + Blo) */
2370
        /*   r7           r6      r9         r8   */
2371
        mov  r8, r10
2372
        mulu r7, r8,  r0                /* Ahi * Blo */
2373
        mulu r6, r9,  r0                /* Alo * Bhi */
2374
        mulu r6, r10, r11               /* Alo * Blo */
2375
        add  r8, r11
2376
        add  r9, r11
2377
        jmp  [r31]
2378
 
2379
#endif /* defined(__v850e__)  || defined(__v850ea__) */
2380
        .size ___muldi3, . - ___muldi3
2381
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.