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

Subversion Repositories openrisc_me

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

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

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

powered by: WebSVN 2.1.0

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