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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [v850/] [lib1funcs.S] - Blame information for rev 747

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

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

powered by: WebSVN 2.1.0

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