* config/sh/lib1funcs.asm (GLOBAL): Use __USER_LABEL_PREFIX__.
[official-gcc.git] / gcc / config / sh / lib1funcs.asm
blob4f78e2c55952929230170e819aafe2b3dacca17d
1 /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001
2 Free Software Foundation, Inc.
4 This file is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
9 In addition to the permissions in the GNU General Public License, the
10 Free Software Foundation gives you unlimited permission to link the
11 compiled version of this file into combinations with other programs,
12 and to distribute those combinations without any restriction coming
13 from the use of this file. (The General Public License restrictions
14 do apply in other respects; for example, they cover modification of
15 the file, and distribution when not linked into a combine
16 executable.)
18 This file is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; see the file COPYING. If not, write to
25 the Free Software Foundation, 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. */
28 !! libgcc routines for the Hitachi / SuperH SH CPUs.
29 !! Contributed by Steve Chamberlain.
30 !! sac@cygnus.com
32 !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
33 !! recoded in assembly by Toshiyasu Morita
34 !! tm@netcom.com
36 /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
37 ELF local label prefixes by J"orn Rennecke
38 amylaar@cygnus.com */
40 #ifdef __ELF__
41 #define LOCAL(X) .L_##X
42 #else
43 #define LOCAL(X) L_##X
44 #endif
46 #define CONCAT(A,B) A##B
47 #define GLOBAL0(U,X) CONCAT(U,__##X)
48 #define GLOBAL(X) GLOBAL0(__USER_LABEL_PREFIX__,X)
50 #if defined __SH5__ && ! defined __SH4_NOFPU__
51 #define FMOVD_WORKS
52 #endif
54 #if ! __SH5__
55 #ifdef L_ashiftrt
56 .global GLOBAL(ashiftrt_r4_0)
57 .global GLOBAL(ashiftrt_r4_1)
58 .global GLOBAL(ashiftrt_r4_2)
59 .global GLOBAL(ashiftrt_r4_3)
60 .global GLOBAL(ashiftrt_r4_4)
61 .global GLOBAL(ashiftrt_r4_5)
62 .global GLOBAL(ashiftrt_r4_6)
63 .global GLOBAL(ashiftrt_r4_7)
64 .global GLOBAL(ashiftrt_r4_8)
65 .global GLOBAL(ashiftrt_r4_9)
66 .global GLOBAL(ashiftrt_r4_10)
67 .global GLOBAL(ashiftrt_r4_11)
68 .global GLOBAL(ashiftrt_r4_12)
69 .global GLOBAL(ashiftrt_r4_13)
70 .global GLOBAL(ashiftrt_r4_14)
71 .global GLOBAL(ashiftrt_r4_15)
72 .global GLOBAL(ashiftrt_r4_16)
73 .global GLOBAL(ashiftrt_r4_17)
74 .global GLOBAL(ashiftrt_r4_18)
75 .global GLOBAL(ashiftrt_r4_19)
76 .global GLOBAL(ashiftrt_r4_20)
77 .global GLOBAL(ashiftrt_r4_21)
78 .global GLOBAL(ashiftrt_r4_22)
79 .global GLOBAL(ashiftrt_r4_23)
80 .global GLOBAL(ashiftrt_r4_24)
81 .global GLOBAL(ashiftrt_r4_25)
82 .global GLOBAL(ashiftrt_r4_26)
83 .global GLOBAL(ashiftrt_r4_27)
84 .global GLOBAL(ashiftrt_r4_28)
85 .global GLOBAL(ashiftrt_r4_29)
86 .global GLOBAL(ashiftrt_r4_30)
87 .global GLOBAL(ashiftrt_r4_31)
88 .global GLOBAL(ashiftrt_r4_32)
90 .align 1
91 GLOBAL(ashiftrt_r4_32):
92 GLOBAL(ashiftrt_r4_31):
93 rotcl r4
94 rts
95 subc r4,r4
97 GLOBAL(ashiftrt_r4_30):
98 shar r4
99 GLOBAL(ashiftrt_r4_29):
100 shar r4
101 GLOBAL(ashiftrt_r4_28):
102 shar r4
103 GLOBAL(ashiftrt_r4_27):
104 shar r4
105 GLOBAL(ashiftrt_r4_26):
106 shar r4
107 GLOBAL(ashiftrt_r4_25):
108 shar r4
109 GLOBAL(ashiftrt_r4_24):
110 shlr16 r4
111 shlr8 r4
113 exts.b r4,r4
115 GLOBAL(ashiftrt_r4_23):
116 shar r4
117 GLOBAL(ashiftrt_r4_22):
118 shar r4
119 GLOBAL(ashiftrt_r4_21):
120 shar r4
121 GLOBAL(ashiftrt_r4_20):
122 shar r4
123 GLOBAL(ashiftrt_r4_19):
124 shar r4
125 GLOBAL(ashiftrt_r4_18):
126 shar r4
127 GLOBAL(ashiftrt_r4_17):
128 shar r4
129 GLOBAL(ashiftrt_r4_16):
130 shlr16 r4
132 exts.w r4,r4
134 GLOBAL(ashiftrt_r4_15):
135 shar r4
136 GLOBAL(ashiftrt_r4_14):
137 shar r4
138 GLOBAL(ashiftrt_r4_13):
139 shar r4
140 GLOBAL(ashiftrt_r4_12):
141 shar r4
142 GLOBAL(ashiftrt_r4_11):
143 shar r4
144 GLOBAL(ashiftrt_r4_10):
145 shar r4
146 GLOBAL(ashiftrt_r4_9):
147 shar r4
148 GLOBAL(ashiftrt_r4_8):
149 shar r4
150 GLOBAL(ashiftrt_r4_7):
151 shar r4
152 GLOBAL(ashiftrt_r4_6):
153 shar r4
154 GLOBAL(ashiftrt_r4_5):
155 shar r4
156 GLOBAL(ashiftrt_r4_4):
157 shar r4
158 GLOBAL(ashiftrt_r4_3):
159 shar r4
160 GLOBAL(ashiftrt_r4_2):
161 shar r4
162 GLOBAL(ashiftrt_r4_1):
164 shar r4
166 GLOBAL(ashiftrt_r4_0):
169 #endif
171 #ifdef L_ashiftrt_n
174 ! GLOBAL(ashrsi3)
176 ! Entry:
178 ! r4: Value to shift
179 ! r5: Shifts
181 ! Exit:
183 ! r0: Result
185 ! Destroys:
187 ! (none)
190 .global GLOBAL(ashrsi3)
191 .align 2
192 GLOBAL(ashrsi3):
193 mov #31,r0
194 and r0,r5
195 mova LOCAL(ashrsi3_table),r0
196 mov.b @(r0,r5),r5
197 #ifdef __sh1__
198 add r5,r0
199 jmp @r0
200 #else
201 braf r5
202 #endif
203 mov r4,r0
205 .align 2
206 LOCAL(ashrsi3_table):
207 .byte LOCAL(ashrsi3_0)-LOCAL(ashrsi3_table)
208 .byte LOCAL(ashrsi3_1)-LOCAL(ashrsi3_table)
209 .byte LOCAL(ashrsi3_2)-LOCAL(ashrsi3_table)
210 .byte LOCAL(ashrsi3_3)-LOCAL(ashrsi3_table)
211 .byte LOCAL(ashrsi3_4)-LOCAL(ashrsi3_table)
212 .byte LOCAL(ashrsi3_5)-LOCAL(ashrsi3_table)
213 .byte LOCAL(ashrsi3_6)-LOCAL(ashrsi3_table)
214 .byte LOCAL(ashrsi3_7)-LOCAL(ashrsi3_table)
215 .byte LOCAL(ashrsi3_8)-LOCAL(ashrsi3_table)
216 .byte LOCAL(ashrsi3_9)-LOCAL(ashrsi3_table)
217 .byte LOCAL(ashrsi3_10)-LOCAL(ashrsi3_table)
218 .byte LOCAL(ashrsi3_11)-LOCAL(ashrsi3_table)
219 .byte LOCAL(ashrsi3_12)-LOCAL(ashrsi3_table)
220 .byte LOCAL(ashrsi3_13)-LOCAL(ashrsi3_table)
221 .byte LOCAL(ashrsi3_14)-LOCAL(ashrsi3_table)
222 .byte LOCAL(ashrsi3_15)-LOCAL(ashrsi3_table)
223 .byte LOCAL(ashrsi3_16)-LOCAL(ashrsi3_table)
224 .byte LOCAL(ashrsi3_17)-LOCAL(ashrsi3_table)
225 .byte LOCAL(ashrsi3_18)-LOCAL(ashrsi3_table)
226 .byte LOCAL(ashrsi3_19)-LOCAL(ashrsi3_table)
227 .byte LOCAL(ashrsi3_20)-LOCAL(ashrsi3_table)
228 .byte LOCAL(ashrsi3_21)-LOCAL(ashrsi3_table)
229 .byte LOCAL(ashrsi3_22)-LOCAL(ashrsi3_table)
230 .byte LOCAL(ashrsi3_23)-LOCAL(ashrsi3_table)
231 .byte LOCAL(ashrsi3_24)-LOCAL(ashrsi3_table)
232 .byte LOCAL(ashrsi3_25)-LOCAL(ashrsi3_table)
233 .byte LOCAL(ashrsi3_26)-LOCAL(ashrsi3_table)
234 .byte LOCAL(ashrsi3_27)-LOCAL(ashrsi3_table)
235 .byte LOCAL(ashrsi3_28)-LOCAL(ashrsi3_table)
236 .byte LOCAL(ashrsi3_29)-LOCAL(ashrsi3_table)
237 .byte LOCAL(ashrsi3_30)-LOCAL(ashrsi3_table)
238 .byte LOCAL(ashrsi3_31)-LOCAL(ashrsi3_table)
240 LOCAL(ashrsi3_31):
241 rotcl r0
243 subc r0,r0
245 LOCAL(ashrsi3_30):
246 shar r0
247 LOCAL(ashrsi3_29):
248 shar r0
249 LOCAL(ashrsi3_28):
250 shar r0
251 LOCAL(ashrsi3_27):
252 shar r0
253 LOCAL(ashrsi3_26):
254 shar r0
255 LOCAL(ashrsi3_25):
256 shar r0
257 LOCAL(ashrsi3_24):
258 shlr16 r0
259 shlr8 r0
261 exts.b r0,r0
263 LOCAL(ashrsi3_23):
264 shar r0
265 LOCAL(ashrsi3_22):
266 shar r0
267 LOCAL(ashrsi3_21):
268 shar r0
269 LOCAL(ashrsi3_20):
270 shar r0
271 LOCAL(ashrsi3_19):
272 shar r0
273 LOCAL(ashrsi3_18):
274 shar r0
275 LOCAL(ashrsi3_17):
276 shar r0
277 LOCAL(ashrsi3_16):
278 shlr16 r0
280 exts.w r0,r0
282 LOCAL(ashrsi3_15):
283 shar r0
284 LOCAL(ashrsi3_14):
285 shar r0
286 LOCAL(ashrsi3_13):
287 shar r0
288 LOCAL(ashrsi3_12):
289 shar r0
290 LOCAL(ashrsi3_11):
291 shar r0
292 LOCAL(ashrsi3_10):
293 shar r0
294 LOCAL(ashrsi3_9):
295 shar r0
296 LOCAL(ashrsi3_8):
297 shar r0
298 LOCAL(ashrsi3_7):
299 shar r0
300 LOCAL(ashrsi3_6):
301 shar r0
302 LOCAL(ashrsi3_5):
303 shar r0
304 LOCAL(ashrsi3_4):
305 shar r0
306 LOCAL(ashrsi3_3):
307 shar r0
308 LOCAL(ashrsi3_2):
309 shar r0
310 LOCAL(ashrsi3_1):
312 shar r0
314 LOCAL(ashrsi3_0):
318 #endif
320 #ifdef L_ashiftlt
323 ! GLOBAL(ashlsi3)
325 ! Entry:
327 ! r4: Value to shift
328 ! r5: Shifts
330 ! Exit:
332 ! r0: Result
334 ! Destroys:
336 ! (none)
338 .global GLOBAL(ashlsi3)
339 .align 2
340 GLOBAL(ashlsi3):
341 mov #31,r0
342 and r0,r5
343 mova LOCAL(ashlsi3_table),r0
344 mov.b @(r0,r5),r5
345 #ifdef __sh1__
346 add r5,r0
347 jmp @r0
348 #else
349 braf r5
350 #endif
351 mov r4,r0
353 .align 2
354 LOCAL(ashlsi3_table):
355 .byte LOCAL(ashlsi3_0)-LOCAL(ashlsi3_table)
356 .byte LOCAL(ashlsi3_1)-LOCAL(ashlsi3_table)
357 .byte LOCAL(ashlsi3_2)-LOCAL(ashlsi3_table)
358 .byte LOCAL(ashlsi3_3)-LOCAL(ashlsi3_table)
359 .byte LOCAL(ashlsi3_4)-LOCAL(ashlsi3_table)
360 .byte LOCAL(ashlsi3_5)-LOCAL(ashlsi3_table)
361 .byte LOCAL(ashlsi3_6)-LOCAL(ashlsi3_table)
362 .byte LOCAL(ashlsi3_7)-LOCAL(ashlsi3_table)
363 .byte LOCAL(ashlsi3_8)-LOCAL(ashlsi3_table)
364 .byte LOCAL(ashlsi3_9)-LOCAL(ashlsi3_table)
365 .byte LOCAL(ashlsi3_10)-LOCAL(ashlsi3_table)
366 .byte LOCAL(ashlsi3_11)-LOCAL(ashlsi3_table)
367 .byte LOCAL(ashlsi3_12)-LOCAL(ashlsi3_table)
368 .byte LOCAL(ashlsi3_13)-LOCAL(ashlsi3_table)
369 .byte LOCAL(ashlsi3_14)-LOCAL(ashlsi3_table)
370 .byte LOCAL(ashlsi3_15)-LOCAL(ashlsi3_table)
371 .byte LOCAL(ashlsi3_16)-LOCAL(ashlsi3_table)
372 .byte LOCAL(ashlsi3_17)-LOCAL(ashlsi3_table)
373 .byte LOCAL(ashlsi3_18)-LOCAL(ashlsi3_table)
374 .byte LOCAL(ashlsi3_19)-LOCAL(ashlsi3_table)
375 .byte LOCAL(ashlsi3_20)-LOCAL(ashlsi3_table)
376 .byte LOCAL(ashlsi3_21)-LOCAL(ashlsi3_table)
377 .byte LOCAL(ashlsi3_22)-LOCAL(ashlsi3_table)
378 .byte LOCAL(ashlsi3_23)-LOCAL(ashlsi3_table)
379 .byte LOCAL(ashlsi3_24)-LOCAL(ashlsi3_table)
380 .byte LOCAL(ashlsi3_25)-LOCAL(ashlsi3_table)
381 .byte LOCAL(ashlsi3_26)-LOCAL(ashlsi3_table)
382 .byte LOCAL(ashlsi3_27)-LOCAL(ashlsi3_table)
383 .byte LOCAL(ashlsi3_28)-LOCAL(ashlsi3_table)
384 .byte LOCAL(ashlsi3_29)-LOCAL(ashlsi3_table)
385 .byte LOCAL(ashlsi3_30)-LOCAL(ashlsi3_table)
386 .byte LOCAL(ashlsi3_31)-LOCAL(ashlsi3_table)
388 LOCAL(ashlsi3_6):
389 shll2 r0
390 LOCAL(ashlsi3_4):
391 shll2 r0
392 LOCAL(ashlsi3_2):
394 shll2 r0
396 LOCAL(ashlsi3_7):
397 shll2 r0
398 LOCAL(ashlsi3_5):
399 shll2 r0
400 LOCAL(ashlsi3_3):
401 shll2 r0
402 LOCAL(ashlsi3_1):
404 shll r0
406 LOCAL(ashlsi3_14):
407 shll2 r0
408 LOCAL(ashlsi3_12):
409 shll2 r0
410 LOCAL(ashlsi3_10):
411 shll2 r0
412 LOCAL(ashlsi3_8):
414 shll8 r0
416 LOCAL(ashlsi3_15):
417 shll2 r0
418 LOCAL(ashlsi3_13):
419 shll2 r0
420 LOCAL(ashlsi3_11):
421 shll2 r0
422 LOCAL(ashlsi3_9):
423 shll8 r0
425 shll r0
427 LOCAL(ashlsi3_22):
428 shll2 r0
429 LOCAL(ashlsi3_20):
430 shll2 r0
431 LOCAL(ashlsi3_18):
432 shll2 r0
433 LOCAL(ashlsi3_16):
435 shll16 r0
437 LOCAL(ashlsi3_23):
438 shll2 r0
439 LOCAL(ashlsi3_21):
440 shll2 r0
441 LOCAL(ashlsi3_19):
442 shll2 r0
443 LOCAL(ashlsi3_17):
444 shll16 r0
446 shll r0
448 LOCAL(ashlsi3_30):
449 shll2 r0
450 LOCAL(ashlsi3_28):
451 shll2 r0
452 LOCAL(ashlsi3_26):
453 shll2 r0
454 LOCAL(ashlsi3_24):
455 shll16 r0
457 shll8 r0
459 LOCAL(ashlsi3_31):
460 shll2 r0
461 LOCAL(ashlsi3_29):
462 shll2 r0
463 LOCAL(ashlsi3_27):
464 shll2 r0
465 LOCAL(ashlsi3_25):
466 shll16 r0
467 shll8 r0
469 shll r0
471 LOCAL(ashlsi3_0):
475 #endif
477 #ifdef L_lshiftrt
480 ! GLOBAL(lshrsi3)
482 ! Entry:
484 ! r4: Value to shift
485 ! r5: Shifts
487 ! Exit:
489 ! r0: Result
491 ! Destroys:
493 ! (none)
495 .global GLOBAL(lshrsi3)
496 .align 2
497 GLOBAL(lshrsi3):
498 mov #31,r0
499 and r0,r5
500 mova LOCAL(lshrsi3_table),r0
501 mov.b @(r0,r5),r5
502 #ifdef __sh1__
503 add r5,r0
504 jmp @r0
505 #else
506 braf r5
507 #endif
508 mov r4,r0
510 .align 2
511 LOCAL(lshrsi3_table):
512 .byte LOCAL(lshrsi3_0)-LOCAL(lshrsi3_table)
513 .byte LOCAL(lshrsi3_1)-LOCAL(lshrsi3_table)
514 .byte LOCAL(lshrsi3_2)-LOCAL(lshrsi3_table)
515 .byte LOCAL(lshrsi3_3)-LOCAL(lshrsi3_table)
516 .byte LOCAL(lshrsi3_4)-LOCAL(lshrsi3_table)
517 .byte LOCAL(lshrsi3_5)-LOCAL(lshrsi3_table)
518 .byte LOCAL(lshrsi3_6)-LOCAL(lshrsi3_table)
519 .byte LOCAL(lshrsi3_7)-LOCAL(lshrsi3_table)
520 .byte LOCAL(lshrsi3_8)-LOCAL(lshrsi3_table)
521 .byte LOCAL(lshrsi3_9)-LOCAL(lshrsi3_table)
522 .byte LOCAL(lshrsi3_10)-LOCAL(lshrsi3_table)
523 .byte LOCAL(lshrsi3_11)-LOCAL(lshrsi3_table)
524 .byte LOCAL(lshrsi3_12)-LOCAL(lshrsi3_table)
525 .byte LOCAL(lshrsi3_13)-LOCAL(lshrsi3_table)
526 .byte LOCAL(lshrsi3_14)-LOCAL(lshrsi3_table)
527 .byte LOCAL(lshrsi3_15)-LOCAL(lshrsi3_table)
528 .byte LOCAL(lshrsi3_16)-LOCAL(lshrsi3_table)
529 .byte LOCAL(lshrsi3_17)-LOCAL(lshrsi3_table)
530 .byte LOCAL(lshrsi3_18)-LOCAL(lshrsi3_table)
531 .byte LOCAL(lshrsi3_19)-LOCAL(lshrsi3_table)
532 .byte LOCAL(lshrsi3_20)-LOCAL(lshrsi3_table)
533 .byte LOCAL(lshrsi3_21)-LOCAL(lshrsi3_table)
534 .byte LOCAL(lshrsi3_22)-LOCAL(lshrsi3_table)
535 .byte LOCAL(lshrsi3_23)-LOCAL(lshrsi3_table)
536 .byte LOCAL(lshrsi3_24)-LOCAL(lshrsi3_table)
537 .byte LOCAL(lshrsi3_25)-LOCAL(lshrsi3_table)
538 .byte LOCAL(lshrsi3_26)-LOCAL(lshrsi3_table)
539 .byte LOCAL(lshrsi3_27)-LOCAL(lshrsi3_table)
540 .byte LOCAL(lshrsi3_28)-LOCAL(lshrsi3_table)
541 .byte LOCAL(lshrsi3_29)-LOCAL(lshrsi3_table)
542 .byte LOCAL(lshrsi3_30)-LOCAL(lshrsi3_table)
543 .byte LOCAL(lshrsi3_31)-LOCAL(lshrsi3_table)
545 LOCAL(lshrsi3_6):
546 shlr2 r0
547 LOCAL(lshrsi3_4):
548 shlr2 r0
549 LOCAL(lshrsi3_2):
551 shlr2 r0
553 LOCAL(lshrsi3_7):
554 shlr2 r0
555 LOCAL(lshrsi3_5):
556 shlr2 r0
557 LOCAL(lshrsi3_3):
558 shlr2 r0
559 LOCAL(lshrsi3_1):
561 shlr r0
563 LOCAL(lshrsi3_14):
564 shlr2 r0
565 LOCAL(lshrsi3_12):
566 shlr2 r0
567 LOCAL(lshrsi3_10):
568 shlr2 r0
569 LOCAL(lshrsi3_8):
571 shlr8 r0
573 LOCAL(lshrsi3_15):
574 shlr2 r0
575 LOCAL(lshrsi3_13):
576 shlr2 r0
577 LOCAL(lshrsi3_11):
578 shlr2 r0
579 LOCAL(lshrsi3_9):
580 shlr8 r0
582 shlr r0
584 LOCAL(lshrsi3_22):
585 shlr2 r0
586 LOCAL(lshrsi3_20):
587 shlr2 r0
588 LOCAL(lshrsi3_18):
589 shlr2 r0
590 LOCAL(lshrsi3_16):
592 shlr16 r0
594 LOCAL(lshrsi3_23):
595 shlr2 r0
596 LOCAL(lshrsi3_21):
597 shlr2 r0
598 LOCAL(lshrsi3_19):
599 shlr2 r0
600 LOCAL(lshrsi3_17):
601 shlr16 r0
603 shlr r0
605 LOCAL(lshrsi3_30):
606 shlr2 r0
607 LOCAL(lshrsi3_28):
608 shlr2 r0
609 LOCAL(lshrsi3_26):
610 shlr2 r0
611 LOCAL(lshrsi3_24):
612 shlr16 r0
614 shlr8 r0
616 LOCAL(lshrsi3_31):
617 shlr2 r0
618 LOCAL(lshrsi3_29):
619 shlr2 r0
620 LOCAL(lshrsi3_27):
621 shlr2 r0
622 LOCAL(lshrsi3_25):
623 shlr16 r0
624 shlr8 r0
626 shlr r0
628 LOCAL(lshrsi3_0):
632 #endif
634 #ifdef L_movstr
635 .text
636 ! done all the large groups, do the remainder
638 ! jump to movstr+
639 done:
640 add #64,r5
641 mova GLOBAL(movstrSI0),r0
642 shll2 r6
643 add r6,r0
644 jmp @r0
645 add #64,r4
646 .align 4
647 .global GLOBAL(movstrSI64)
648 GLOBAL(movstrSI64):
649 mov.l @(60,r5),r0
650 mov.l r0,@(60,r4)
651 .global GLOBAL(movstrSI60)
652 GLOBAL(movstrSI60):
653 mov.l @(56,r5),r0
654 mov.l r0,@(56,r4)
655 .global GLOBAL(movstrSI56)
656 GLOBAL(movstrSI56):
657 mov.l @(52,r5),r0
658 mov.l r0,@(52,r4)
659 .global GLOBAL(movstrSI52)
660 GLOBAL(movstrSI52):
661 mov.l @(48,r5),r0
662 mov.l r0,@(48,r4)
663 .global GLOBAL(movstrSI48)
664 GLOBAL(movstrSI48):
665 mov.l @(44,r5),r0
666 mov.l r0,@(44,r4)
667 .global GLOBAL(movstrSI44)
668 GLOBAL(movstrSI44):
669 mov.l @(40,r5),r0
670 mov.l r0,@(40,r4)
671 .global GLOBAL(movstrSI40)
672 GLOBAL(movstrSI40):
673 mov.l @(36,r5),r0
674 mov.l r0,@(36,r4)
675 .global GLOBAL(movstrSI36)
676 GLOBAL(movstrSI36):
677 mov.l @(32,r5),r0
678 mov.l r0,@(32,r4)
679 .global GLOBAL(movstrSI32)
680 GLOBAL(movstrSI32):
681 mov.l @(28,r5),r0
682 mov.l r0,@(28,r4)
683 .global GLOBAL(movstrSI28)
684 GLOBAL(movstrSI28):
685 mov.l @(24,r5),r0
686 mov.l r0,@(24,r4)
687 .global GLOBAL(movstrSI24)
688 GLOBAL(movstrSI24):
689 mov.l @(20,r5),r0
690 mov.l r0,@(20,r4)
691 .global GLOBAL(movstrSI20)
692 GLOBAL(movstrSI20):
693 mov.l @(16,r5),r0
694 mov.l r0,@(16,r4)
695 .global GLOBAL(movstrSI16)
696 GLOBAL(movstrSI16):
697 mov.l @(12,r5),r0
698 mov.l r0,@(12,r4)
699 .global GLOBAL(movstrSI12)
700 GLOBAL(movstrSI12):
701 mov.l @(8,r5),r0
702 mov.l r0,@(8,r4)
703 .global GLOBAL(movstrSI8)
704 GLOBAL(movstrSI8):
705 mov.l @(4,r5),r0
706 mov.l r0,@(4,r4)
707 .global GLOBAL(movstrSI4)
708 GLOBAL(movstrSI4):
709 mov.l @(0,r5),r0
710 mov.l r0,@(0,r4)
711 GLOBAL(movstrSI0):
715 .align 4
717 .global GLOBAL(movstr)
718 GLOBAL(movstr):
719 mov.l @(60,r5),r0
720 mov.l r0,@(60,r4)
722 mov.l @(56,r5),r0
723 mov.l r0,@(56,r4)
725 mov.l @(52,r5),r0
726 mov.l r0,@(52,r4)
728 mov.l @(48,r5),r0
729 mov.l r0,@(48,r4)
731 mov.l @(44,r5),r0
732 mov.l r0,@(44,r4)
734 mov.l @(40,r5),r0
735 mov.l r0,@(40,r4)
737 mov.l @(36,r5),r0
738 mov.l r0,@(36,r4)
740 mov.l @(32,r5),r0
741 mov.l r0,@(32,r4)
743 mov.l @(28,r5),r0
744 mov.l r0,@(28,r4)
746 mov.l @(24,r5),r0
747 mov.l r0,@(24,r4)
749 mov.l @(20,r5),r0
750 mov.l r0,@(20,r4)
752 mov.l @(16,r5),r0
753 mov.l r0,@(16,r4)
755 mov.l @(12,r5),r0
756 mov.l r0,@(12,r4)
758 mov.l @(8,r5),r0
759 mov.l r0,@(8,r4)
761 mov.l @(4,r5),r0
762 mov.l r0,@(4,r4)
764 mov.l @(0,r5),r0
765 mov.l r0,@(0,r4)
767 add #-16,r6
768 cmp/pl r6
769 bf done
771 add #64,r5
772 bra GLOBAL(movstr)
773 add #64,r4
774 #endif
776 #ifdef L_movstr_i4
777 .text
778 .global GLOBAL(movstr_i4_even)
779 .global GLOBAL(movstr_i4_odd)
780 .global GLOBAL(movstrSI12_i4)
782 .p2align 5
783 L_movstr_2mod4_end:
784 mov.l r0,@(16,r4)
786 mov.l r1,@(20,r4)
788 .p2align 2
790 GLOBAL(movstr_i4_odd):
791 mov.l @r5+,r1
792 add #-4,r4
793 mov.l @r5+,r2
794 mov.l @r5+,r3
795 mov.l r1,@(4,r4)
796 mov.l r2,@(8,r4)
798 L_movstr_loop:
799 mov.l r3,@(12,r4)
800 dt r6
801 mov.l @r5+,r0
802 bt/s L_movstr_2mod4_end
803 mov.l @r5+,r1
804 add #16,r4
805 L_movstr_start_even:
806 mov.l @r5+,r2
807 mov.l @r5+,r3
808 mov.l r0,@r4
809 dt r6
810 mov.l r1,@(4,r4)
811 bf/s L_movstr_loop
812 mov.l r2,@(8,r4)
814 mov.l r3,@(12,r4)
816 GLOBAL(movstr_i4_even):
817 mov.l @r5+,r0
818 bra L_movstr_start_even
819 mov.l @r5+,r1
821 .p2align 4
822 GLOBAL(movstrSI12_i4):
823 mov.l @r5,r0
824 mov.l @(4,r5),r1
825 mov.l @(8,r5),r2
826 mov.l r0,@r4
827 mov.l r1,@(4,r4)
829 mov.l r2,@(8,r4)
830 #endif
832 #ifdef L_mulsi3
835 .global GLOBAL(mulsi3)
837 ! r4 = aabb
838 ! r5 = ccdd
839 ! r0 = aabb*ccdd via partial products
841 ! if aa == 0 and cc = 0
842 ! r0 = bb*dd
844 ! else
845 ! aa = bb*dd + (aa*dd*65536) + (cc*bb*65536)
848 GLOBAL(mulsi3):
849 mulu.w r4,r5 ! multiply the lsws macl=bb*dd
850 mov r5,r3 ! r3 = ccdd
851 swap.w r4,r2 ! r2 = bbaa
852 xtrct r2,r3 ! r3 = aacc
853 tst r3,r3 ! msws zero ?
854 bf hiset
855 rts ! yes - then we have the answer
856 sts macl,r0
858 hiset: sts macl,r0 ! r0 = bb*dd
859 mulu.w r2,r5 ! brewing macl = aa*dd
860 sts macl,r1
861 mulu.w r3,r4 ! brewing macl = cc*bb
862 sts macl,r2
863 add r1,r2
864 shll16 r2
866 add r2,r0
869 #endif
870 #endif /* ! __SH5__ */
871 #ifdef L_sdivsi3_i4
872 .title "SH DIVIDE"
873 !! 4 byte integer Divide code for the Hitachi SH
874 #ifdef __SH4__
875 !! args in r4 and r5, result in fpul, clobber dr0, dr2
877 .global GLOBAL(sdivsi3_i4)
878 GLOBAL(sdivsi3_i4):
879 lds r4,fpul
880 float fpul,dr0
881 lds r5,fpul
882 float fpul,dr2
883 fdiv dr2,dr0
885 ftrc dr0,fpul
887 #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
888 !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2
890 #if ! __SH5__ || __SH5__ == 32
891 #if __SH5__
892 .mode SHcompact
893 #endif
894 .global GLOBAL(sdivsi3_i4)
895 GLOBAL(sdivsi3_i4):
896 sts.l fpscr,@-r15
897 mov #8,r2
898 swap.w r2,r2
899 lds r2,fpscr
900 lds r4,fpul
901 float fpul,dr0
902 lds r5,fpul
903 float fpul,dr2
904 fdiv dr2,dr0
905 ftrc dr0,fpul
907 lds.l @r15+,fpscr
909 #endif /* ! __SH5__ || __SH5__ == 32 */
910 #endif /* ! __SH4__ */
911 #endif
913 #ifdef L_sdivsi3
914 /* __SH4_SINGLE_ONLY__ keeps this part for link compatibility with
915 sh3e code. */
916 #if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)
918 !! Steve Chamberlain
919 !! sac@cygnus.com
923 !! args in r4 and r5, result in r0 clobber r1,r2,r3
925 .global GLOBAL(sdivsi3)
926 #if __SHMEDIA__
927 #if __SH5__ == 32
928 .section .text..SHmedia32,"ax"
929 #else
930 .text
931 #endif
932 .align 2
933 /* The assembly code that follows is a hand-optimized version of the C
934 code that follows. Note that the registers that are modified are
935 exactly those listed as clobbered in the patterns divsi3_i1 and
936 divsi3_i1_media.
938 int __sdivsi3 (i, j)
939 int i, j;
941 register unsigned long long r18 asm ("r18");
942 register unsigned long long r19 asm ("r19");
943 register unsigned long long r0 asm ("r0") = 0;
944 register unsigned long long r1 asm ("r1") = 1;
945 register int r2 asm ("r2") = i >> 31;
946 register int r3 asm ("r3") = j >> 31;
948 r2 = r2 ? r2 : r1;
949 r3 = r3 ? r3 : r1;
950 r18 = i * r2;
951 r19 = j * r3;
952 r2 *= r3;
954 r19 <<= 31;
955 r1 <<= 31;
957 if (r18 >= r19)
958 r0 |= r1, r18 -= r19;
959 while (r19 >>= 1, r1 >>= 1);
961 return r2 * (int)r0;
964 GLOBAL(sdivsi3):
965 pt/l LOCAL(sdivsi3_dontadd), tr2
966 pt/l LOCAL(sdivsi3_loop), tr1
967 ptabs/l r18, tr0
968 movi 0, r0
969 movi 1, r1
970 shari.l r4, 31, r2
971 shari.l r5, 31, r3
972 cmveq r2, r1, r2
973 cmveq r3, r1, r3
974 muls.l r4, r2, r18
975 muls.l r5, r3, r19
976 muls.l r2, r3, r2
977 shlli r19, 31, r19
978 shlli r1, 31, r1
979 LOCAL(sdivsi3_loop):
980 bgtu r19, r18, tr2
981 or r0, r1, r0
982 sub r18, r19, r18
983 LOCAL(sdivsi3_dontadd):
984 shlri r1, 1, r1
985 shlri r19, 1, r19
986 bnei r1, 0, tr1
987 muls.l r0, r2, r0
988 add.l r0, r63, r0
989 blink tr0, r63
990 #else
991 GLOBAL(sdivsi3):
992 mov r4,r1
993 mov r5,r0
995 tst r0,r0
996 bt div0
997 mov #0,r2
998 div0s r2,r1
999 subc r3,r3
1000 subc r2,r1
1001 div0s r0,r3
1002 rotcl r1
1003 div1 r0,r3
1004 rotcl r1
1005 div1 r0,r3
1006 rotcl r1
1007 div1 r0,r3
1008 rotcl r1
1009 div1 r0,r3
1010 rotcl r1
1011 div1 r0,r3
1012 rotcl r1
1013 div1 r0,r3
1014 rotcl r1
1015 div1 r0,r3
1016 rotcl r1
1017 div1 r0,r3
1018 rotcl r1
1019 div1 r0,r3
1020 rotcl r1
1021 div1 r0,r3
1022 rotcl r1
1023 div1 r0,r3
1024 rotcl r1
1025 div1 r0,r3
1026 rotcl r1
1027 div1 r0,r3
1028 rotcl r1
1029 div1 r0,r3
1030 rotcl r1
1031 div1 r0,r3
1032 rotcl r1
1033 div1 r0,r3
1034 rotcl r1
1035 div1 r0,r3
1036 rotcl r1
1037 div1 r0,r3
1038 rotcl r1
1039 div1 r0,r3
1040 rotcl r1
1041 div1 r0,r3
1042 rotcl r1
1043 div1 r0,r3
1044 rotcl r1
1045 div1 r0,r3
1046 rotcl r1
1047 div1 r0,r3
1048 rotcl r1
1049 div1 r0,r3
1050 rotcl r1
1051 div1 r0,r3
1052 rotcl r1
1053 div1 r0,r3
1054 rotcl r1
1055 div1 r0,r3
1056 rotcl r1
1057 div1 r0,r3
1058 rotcl r1
1059 div1 r0,r3
1060 rotcl r1
1061 div1 r0,r3
1062 rotcl r1
1063 div1 r0,r3
1064 rotcl r1
1065 div1 r0,r3
1066 rotcl r1
1067 addc r2,r1
1069 mov r1,r0
1072 div0: rts
1073 mov #0,r0
1075 #endif /* ! __SHMEDIA__ */
1076 #endif /* ! __SH4__ */
1077 #endif
1078 #ifdef L_udivsi3_i4
1080 .title "SH DIVIDE"
1081 !! 4 byte integer Divide code for the Hitachi SH
1082 #ifdef __SH4__
1083 !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
1085 .global GLOBAL(udivsi3_i4)
1086 GLOBAL(udivsi3_i4):
1087 mov #1,r1
1088 cmp/hi r1,r5
1089 bf trivial
1090 rotr r1
1091 xor r1,r4
1092 lds r4,fpul
1093 mova L1,r0
1094 #ifdef FMOVD_WORKS
1095 fmov.d @r0+,dr4
1096 #else
1097 #ifdef __LITTLE_ENDIAN__
1098 fmov.s @r0+,fr5
1099 fmov.s @r0,fr4
1100 #else
1101 fmov.s @r0+,fr4
1102 fmov.s @r0,fr5
1103 #endif
1104 #endif
1105 float fpul,dr0
1106 xor r1,r5
1107 lds r5,fpul
1108 float fpul,dr2
1109 fadd dr4,dr0
1110 fadd dr4,dr2
1111 fdiv dr2,dr0
1113 ftrc dr0,fpul
1115 trivial:
1117 lds r4,fpul
1119 .align 2
1120 #ifdef FMOVD_WORKS
1121 .align 3 ! make double below 8 byte aligned.
1122 #endif
1124 .double 2147483648
1126 #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
1127 !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
1129 #if ! __SH5__ || __SH5__ == 32
1130 #if __SH5__
1131 .mode SHcompact
1132 #endif
1133 .global GLOBAL(udivsi3_i4)
1134 GLOBAL(udivsi3_i4):
1135 mov #1,r1
1136 cmp/hi r1,r5
1137 bf trivial
1138 sts.l fpscr,@-r15
1139 mova L1,r0
1140 lds.l @r0+,fpscr
1141 rotr r1
1142 xor r1,r4
1143 lds r4,fpul
1144 #ifdef FMOVD_WORKS
1145 fmov.d @r0+,dr4
1146 #else
1147 #ifdef __LITTLE_ENDIAN__
1148 fmov.s @r0+,fr5
1149 fmov.s @r0,fr4
1150 #else
1151 fmov.s @r0+,fr4
1152 fmov.s @r0,fr5
1153 #endif
1154 #endif
1155 float fpul,dr0
1156 xor r1,r5
1157 lds r5,fpul
1158 float fpul,dr2
1159 fadd dr4,dr0
1160 fadd dr4,dr2
1161 fdiv dr2,dr0
1162 ftrc dr0,fpul
1164 lds.l @r15+,fpscr
1166 #ifdef FMOVD_WORKS
1167 .align 3 ! make double below 8 byte aligned.
1168 #endif
1169 trivial:
1171 lds r4,fpul
1173 .align 2
1175 #ifndef FMOVD_WORKS
1176 .long 0x80000
1177 #else
1178 .long 0x180000
1179 #endif
1180 .double 2147483648
1182 #endif /* ! __SH5__ || __SH5__ == 32 */
1183 #endif /* ! __SH4__ */
1184 #endif
1186 #ifdef L_udivsi3
1187 /* __SH4_SINGLE_ONLY__ keeps this part for link compatibility with
1188 sh3e code. */
1189 #if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)
1191 !! Steve Chamberlain
1192 !! sac@cygnus.com
1196 !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
1197 .global GLOBAL(udivsi3)
1199 #if __SHMEDIA__
1200 #if __SH5__ == 32
1201 .section .text..SHmedia32,"ax"
1202 #else
1203 .text
1204 #endif
1205 .align 2
1206 /* The assembly code that follows is a hand-optimized version of the C
1207 code that follows. Note that the registers that are modified are
1208 exactly those listed as clobbered in the patterns udivsi3_i1 and
1209 udivsi3_i1_media.
1211 unsigned
1212 __udivsi3 (i, j)
1213 unsigned i, j;
1215 register unsigned long long r0 asm ("r0") = 0;
1216 register unsigned long long r18 asm ("r18") = 1;
1217 register unsigned long long r4 asm ("r4") = i;
1218 register unsigned long long r19 asm ("r19") = j;
1220 r19 <<= 31;
1221 r18 <<= 31;
1223 if (r4 >= r19)
1224 r0 |= r18, r4 -= r19;
1225 while (r19 >>= 1, r18 >>= 1);
1227 return r0;
1230 GLOBAL(udivsi3):
1231 pt/l LOCAL(udivsi3_dontadd), tr2
1232 pt/l LOCAL(udivsi3_loop), tr1
1233 ptabs/l r18, tr0
1234 movi 0, r0
1235 movi 1, r18
1236 addz.l r5, r63, r19
1237 addz.l r4, r63, r4
1238 shlli r19, 31, r19
1239 shlli r18, 31, r18
1240 LOCAL(udivsi3_loop):
1241 bgtu r19, r4, tr2
1242 or r0, r18, r0
1243 sub r4, r19, r4
1244 LOCAL(udivsi3_dontadd):
1245 shlri r18, 1, r18
1246 shlri r19, 1, r19
1247 bnei r18, 0, tr1
1248 blink tr0, r63
1249 #else
1250 GLOBAL(udivsi3):
1251 longway:
1252 mov #0,r0
1253 div0u
1254 ! get one bit from the msb of the numerator into the T
1255 ! bit and divide it by whats in r5. Put the answer bit
1256 ! into the T bit so it can come out again at the bottom
1258 rotcl r4 ; div1 r5,r0
1259 rotcl r4 ; div1 r5,r0
1260 rotcl r4 ; div1 r5,r0
1261 rotcl r4 ; div1 r5,r0
1262 rotcl r4 ; div1 r5,r0
1263 rotcl r4 ; div1 r5,r0
1264 rotcl r4 ; div1 r5,r0
1265 rotcl r4 ; div1 r5,r0
1267 rotcl r4 ; div1 r5,r0
1268 rotcl r4 ; div1 r5,r0
1269 rotcl r4 ; div1 r5,r0
1270 rotcl r4 ; div1 r5,r0
1271 rotcl r4 ; div1 r5,r0
1272 rotcl r4 ; div1 r5,r0
1273 rotcl r4 ; div1 r5,r0
1274 rotcl r4 ; div1 r5,r0
1275 shortway:
1276 rotcl r4 ; div1 r5,r0
1277 rotcl r4 ; div1 r5,r0
1278 rotcl r4 ; div1 r5,r0
1279 rotcl r4 ; div1 r5,r0
1280 rotcl r4 ; div1 r5,r0
1281 rotcl r4 ; div1 r5,r0
1282 rotcl r4 ; div1 r5,r0
1283 rotcl r4 ; div1 r5,r0
1285 vshortway:
1286 rotcl r4 ; div1 r5,r0
1287 rotcl r4 ; div1 r5,r0
1288 rotcl r4 ; div1 r5,r0
1289 rotcl r4 ; div1 r5,r0
1290 rotcl r4 ; div1 r5,r0
1291 rotcl r4 ; div1 r5,r0
1292 rotcl r4 ; div1 r5,r0
1293 rotcl r4 ; div1 r5,r0
1294 rotcl r4
1295 ret: rts
1296 mov r4,r0
1298 #endif /* ! __SHMEDIA__ */
1299 #endif /* __SH4__ */
1300 #endif
1301 #ifdef L_set_fpscr
1302 #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || __SH5__ == 32
1303 #ifdef __SH5__
1304 .mode SHcompact
1305 #endif
1306 .global GLOBAL(set_fpscr)
1307 GLOBAL(set_fpscr):
1308 lds r4,fpscr
1309 mov.l LOCAL(set_fpscr_L1),r1
1310 swap.w r4,r0
1311 or #24,r0
1312 #ifndef FMOVD_WORKS
1313 xor #16,r0
1314 #endif
1315 #if defined(__SH4__)
1316 swap.w r0,r3
1317 mov.l r3,@(4,r1)
1318 #else /* defined(__SH3E__) || defined(__SH4_SINGLE*__) */
1319 swap.w r0,r2
1320 mov.l r2,@r1
1321 #endif
1322 #ifndef FMOVD_WORKS
1323 xor #8,r0
1324 #else
1325 xor #24,r0
1326 #endif
1327 #if defined(__SH4__)
1328 swap.w r0,r2
1330 mov.l r2,@r1
1331 #else /* defined(__SH3E__) || defined(__SH4_SINGLE*__) */
1332 swap.w r0,r3
1334 mov.l r3,@(4,r1)
1335 #endif
1336 .align 2
1337 LOCAL(set_fpscr_L1):
1338 .long GLOBAL(fpscr_values)
1339 #ifdef __ELF__
1340 .comm GLOBAL(fpscr_values),8,4
1341 #else
1342 .comm GLOBAL(fpscr_values),8
1343 #endif /* ELF */
1344 #endif /* SH3E / SH4 */
1345 #endif /* L_set_fpscr */
1346 #ifdef L_ic_invalidate
1347 #if __SH5__ == 32
1348 .mode SHmedia
1349 .section .text..SHmedia32,"ax"
1350 .align 2
1351 .global GLOBAL(ic_invalidate)
1352 GLOBAL(ic_invalidate):
1353 icbi r0, 0
1354 ptabs r18, tr0
1355 synci
1356 blink tr0, r63
1357 #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
1358 .global GLOBAL(ic_invalidate)
1359 GLOBAL(ic_invalidate):
1360 ocbwb @r4
1361 mova 0f,r0
1362 mov.w 1f,r1
1363 /* Compute how many cache lines 0f is away from r4. */
1364 sub r0,r4
1365 and r1,r4
1366 /* Prepare to branch to 0f plus the cache-line offset. */
1367 add # 0f - 1f,r4
1368 braf r4
1371 .short 0x1fe0
1372 .p2align 5
1373 /* This must be aligned to the beginning of a cache line. */
1375 .rept 256 /* There are 256 cache lines of 32 bytes. */
1377 .rept 15
1379 .endr
1380 .endr
1381 #endif /* SH4 */
1382 #endif /* L_ic_invalidate */
1384 #if defined (__SH5__) && __SH5__ == 32
1385 #ifdef L_shcompact_call_trampoline
1386 .section .rodata
1387 .align 1
1388 LOCAL(ct_main_table):
1389 .word LOCAL(ct_r2_fp) - datalabel LOCAL(ct_main_label)
1390 .word LOCAL(ct_r2_ld) - datalabel LOCAL(ct_main_label)
1391 .word LOCAL(ct_r2_pop) - datalabel LOCAL(ct_main_label)
1392 .word LOCAL(ct_r3_fp) - datalabel LOCAL(ct_main_label)
1393 .word LOCAL(ct_r3_ld) - datalabel LOCAL(ct_main_label)
1394 .word LOCAL(ct_r3_pop) - datalabel LOCAL(ct_main_label)
1395 .word LOCAL(ct_r4_fp) - datalabel LOCAL(ct_main_label)
1396 .word LOCAL(ct_r4_ld) - datalabel LOCAL(ct_main_label)
1397 .word LOCAL(ct_r4_pop) - datalabel LOCAL(ct_main_label)
1398 .word LOCAL(ct_r5_fp) - datalabel LOCAL(ct_main_label)
1399 .word LOCAL(ct_r5_ld) - datalabel LOCAL(ct_main_label)
1400 .word LOCAL(ct_r5_pop) - datalabel LOCAL(ct_main_label)
1401 .word LOCAL(ct_r6_fph) - datalabel LOCAL(ct_main_label)
1402 .word LOCAL(ct_r6_fpl) - datalabel LOCAL(ct_main_label)
1403 .word LOCAL(ct_r6_ld) - datalabel LOCAL(ct_main_label)
1404 .word LOCAL(ct_r6_pop) - datalabel LOCAL(ct_main_label)
1405 .word LOCAL(ct_r7_fph) - datalabel LOCAL(ct_main_label)
1406 .word LOCAL(ct_r7_fpl) - datalabel LOCAL(ct_main_label)
1407 .word LOCAL(ct_r7_ld) - datalabel LOCAL(ct_main_label)
1408 .word LOCAL(ct_r7_pop) - datalabel LOCAL(ct_main_label)
1409 .word LOCAL(ct_r8_fph) - datalabel LOCAL(ct_main_label)
1410 .word LOCAL(ct_r8_fpl) - datalabel LOCAL(ct_main_label)
1411 .word LOCAL(ct_r8_ld) - datalabel LOCAL(ct_main_label)
1412 .word LOCAL(ct_r8_pop) - datalabel LOCAL(ct_main_label)
1413 .word LOCAL(ct_r9_fph) - datalabel LOCAL(ct_main_label)
1414 .word LOCAL(ct_r9_fpl) - datalabel LOCAL(ct_main_label)
1415 .word LOCAL(ct_r9_ld) - datalabel LOCAL(ct_main_label)
1416 .word LOCAL(ct_r9_pop) - datalabel LOCAL(ct_main_label)
1417 .word LOCAL(ct_pop_seq) - datalabel LOCAL(ct_main_label)
1418 .word LOCAL(ct_pop_seq) - datalabel LOCAL(ct_main_label)
1419 .word LOCAL(ct_r9_pop) - datalabel LOCAL(ct_main_label)
1420 .word LOCAL(ct_ret_wide) - datalabel LOCAL(ct_main_label)
1421 .word LOCAL(ct_call_func) - datalabel LOCAL(ct_main_label)
1422 .mode SHmedia
1423 .section .text..SHmedia32, "ax"
1424 .align 2
1426 /* This function loads 64-bit general-purpose registers from the
1427 stack, from a memory address contained in them or from an FP
1428 register, according to a cookie passed in r1. Its execution
1429 time is linear on the number of registers that actually have
1430 to be copied. See sh.h for details on the actual bit pattern.
1432 The function to be called is passed in r0. If a 32-bit return
1433 value is expected, the actual function will be tail-called,
1434 otherwise the return address will be stored in r10 (that the
1435 caller should expect to be clobbered) and the return value
1436 will be expanded into r2/r3 upon return. */
1438 .global GLOBAL(GCC_shcompact_call_trampoline)
1439 GLOBAL(GCC_shcompact_call_trampoline):
1440 ptabs/l r0, tr0 /* Prepare to call the actual function. */
1441 movi ((datalabel LOCAL(ct_main_table) - 31 * 2) >> 16) & 65535, r0
1442 pt/l LOCAL(ct_loop), tr1
1443 addz.l r1, r63, r1
1444 shori ((datalabel LOCAL(ct_main_table) - 31 * 2)) & 65535, r0
1445 LOCAL(ct_loop):
1446 nsb r1, r28
1447 shlli r28, 1, r29
1448 ldx.w r0, r29, r30
1449 LOCAL(ct_main_label):
1450 ptrel/l r30, tr2
1451 blink tr2, r63
1452 LOCAL(ct_r2_fp): /* Copy r2 from an FP register. */
1453 /* It must be dr0, so just do it. */
1454 fmov.dq dr0, r2
1455 movi 7, r30
1456 shlli r30, 29, r31
1457 andc r1, r31, r1
1458 blink tr1, r63
1459 LOCAL(ct_r3_fp): /* Copy r3 from an FP register. */
1460 /* It is either dr0 or dr2. */
1461 movi 7, r30
1462 shlri r1, 26, r32
1463 shlli r30, 26, r31
1464 andc r1, r31, r1
1465 fmov.dq dr0, r3
1466 beqi/l r32, 4, tr1
1467 fmov.dq dr2, r3
1468 blink tr1, r63
1469 LOCAL(ct_r4_fp): /* Copy r4 from an FP register. */
1470 shlri r1, 23 - 3, r34
1471 andi r34, 3 << 3, r33
1472 addi r33, LOCAL(ct_r4_fp_copy) - datalabel LOCAL(ct_r4_fp_base), r32
1473 LOCAL(ct_r4_fp_base):
1474 ptrel/l r32, tr2
1475 movi 7, r30
1476 shlli r30, 23, r31
1477 andc r1, r31, r1
1478 blink tr2, r63
1479 LOCAL(ct_r4_fp_copy):
1480 fmov.dq dr0, r4
1481 blink tr1, r63
1482 fmov.dq dr2, r4
1483 blink tr1, r63
1484 fmov.dq dr4, r4
1485 blink tr1, r63
1486 LOCAL(ct_r5_fp): /* Copy r5 from an FP register. */
1487 shlri r1, 20 - 3, r34
1488 andi r34, 3 << 3, r33
1489 addi r33, LOCAL(ct_r5_fp_copy) - datalabel LOCAL(ct_r5_fp_base), r32
1490 LOCAL(ct_r5_fp_base):
1491 ptrel/l r32, tr2
1492 movi 7, r30
1493 shlli r30, 20, r31
1494 andc r1, r31, r1
1495 blink tr2, r63
1496 LOCAL(ct_r5_fp_copy):
1497 fmov.dq dr0, r5
1498 blink tr1, r63
1499 fmov.dq dr2, r5
1500 blink tr1, r63
1501 fmov.dq dr4, r5
1502 blink tr1, r63
1503 fmov.dq dr6, r5
1504 blink tr1, r63
1505 LOCAL(ct_r6_fph): /* Copy r6 from a high FP register. */
1506 /* It must be dr8. */
1507 fmov.dq dr8, r6
1508 movi 15, r30
1509 shlli r30, 16, r31
1510 andc r1, r31, r1
1511 blink tr1, r63
1512 LOCAL(ct_r6_fpl): /* Copy r6 from a low FP register. */
1513 shlri r1, 16 - 3, r34
1514 andi r34, 3 << 3, r33
1515 addi r33, LOCAL(ct_r6_fp_copy) - datalabel LOCAL(ct_r6_fp_base), r32
1516 LOCAL(ct_r6_fp_base):
1517 ptrel/l r32, tr2
1518 movi 7, r30
1519 shlli r30, 16, r31
1520 andc r1, r31, r1
1521 blink tr2, r63
1522 LOCAL(ct_r6_fp_copy):
1523 fmov.dq dr0, r6
1524 blink tr1, r63
1525 fmov.dq dr2, r6
1526 blink tr1, r63
1527 fmov.dq dr4, r6
1528 blink tr1, r63
1529 fmov.dq dr6, r6
1530 blink tr1, r63
1531 LOCAL(ct_r7_fph): /* Copy r7 from a high FP register. */
1532 /* It is either dr8 or dr10. */
1533 movi 15 << 12, r31
1534 shlri r1, 12, r32
1535 andc r1, r31, r1
1536 fmov.dq dr8, r7
1537 beqi/l r32, 8, tr1
1538 fmov.dq dr10, r7
1539 blink tr1, r63
1540 LOCAL(ct_r7_fpl): /* Copy r7 from a low FP register. */
1541 shlri r1, 12 - 3, r34
1542 andi r34, 3 << 3, r33
1543 addi r33, LOCAL(ct_r7_fp_copy) - datalabel LOCAL(ct_r7_fp_base), r32
1544 LOCAL(ct_r7_fp_base):
1545 ptrel/l r32, tr2
1546 movi 7 << 12, r31
1547 andc r1, r31, r1
1548 blink tr2, r63
1549 LOCAL(ct_r7_fp_copy):
1550 fmov.dq dr0, r7
1551 blink tr1, r63
1552 fmov.dq dr2, r7
1553 blink tr1, r63
1554 fmov.dq dr4, r7
1555 blink tr1, r63
1556 fmov.dq dr6, r7
1557 blink tr1, r63
1558 LOCAL(ct_r8_fph): /* Copy r8 from a high FP register. */
1559 /* It is either dr8 or dr10. */
1560 movi 15 << 8, r31
1561 andi r1, 1 << 8, r32
1562 andc r1, r31, r1
1563 fmov.dq dr8, r8
1564 beq/l r32, r63, tr1
1565 fmov.dq dr10, r8
1566 blink tr1, r63
1567 LOCAL(ct_r8_fpl): /* Copy r8 from a low FP register. */
1568 shlri r1, 8 - 3, r34
1569 andi r34, 3 << 3, r33
1570 addi r33, LOCAL(ct_r8_fp_copy) - datalabel LOCAL(ct_r8_fp_base), r32
1571 LOCAL(ct_r8_fp_base):
1572 ptrel/l r32, tr2
1573 movi 7 << 8, r31
1574 andc r1, r31, r1
1575 blink tr2, r63
1576 LOCAL(ct_r8_fp_copy):
1577 fmov.dq dr0, r8
1578 blink tr1, r63
1579 fmov.dq dr2, r8
1580 blink tr1, r63
1581 fmov.dq dr4, r8
1582 blink tr1, r63
1583 fmov.dq dr6, r8
1584 blink tr1, r63
1585 LOCAL(ct_r9_fph): /* Copy r9 from a high FP register. */
1586 /* It is either dr8 or dr10. */
1587 movi 15 << 4, r31
1588 andi r1, 1 << 4, r32
1589 andc r1, r31, r1
1590 fmov.dq dr8, r9
1591 beq/l r32, r63, tr1
1592 fmov.dq dr10, r9
1593 blink tr1, r63
1594 LOCAL(ct_r9_fpl): /* Copy r9 from a low FP register. */
1595 shlri r1, 4 - 3, r34
1596 andi r34, 3 << 3, r33
1597 addi r33, LOCAL(ct_r9_fp_copy) - datalabel LOCAL(ct_r9_fp_base), r32
1598 LOCAL(ct_r9_fp_base):
1599 ptrel/l r32, tr2
1600 movi 7 << 4, r31
1601 andc r1, r31, r1
1602 blink tr2, r63
1603 LOCAL(ct_r9_fp_copy):
1604 fmov.dq dr0, r9
1605 blink tr1, r63
1606 fmov.dq dr2, r9
1607 blink tr1, r63
1608 fmov.dq dr4, r9
1609 blink tr1, r63
1610 fmov.dq dr6, r9
1611 blink tr1, r63
1612 LOCAL(ct_r2_ld): /* Copy r2 from a memory address. */
1613 pt/l LOCAL(ct_r2_load), tr2
1614 movi 3, r30
1615 shlli r30, 29, r31
1616 and r1, r31, r32
1617 andc r1, r31, r1
1618 beq/l r31, r32, tr2
1619 addi.l r2, 8, r3
1620 ldx.q r2, r63, r2
1621 /* Fall through. */
1622 LOCAL(ct_r3_ld): /* Copy r3 from a memory address. */
1623 pt/l LOCAL(ct_r3_load), tr2
1624 movi 3, r30
1625 shlli r30, 26, r31
1626 and r1, r31, r32
1627 andc r1, r31, r1
1628 beq/l r31, r32, tr2
1629 addi.l r3, 8, r4
1630 ldx.q r3, r63, r3
1631 LOCAL(ct_r4_ld): /* Copy r4 from a memory address. */
1632 pt/l LOCAL(ct_r4_load), tr2
1633 movi 3, r30
1634 shlli r30, 23, r31
1635 and r1, r31, r32
1636 andc r1, r31, r1
1637 beq/l r31, r32, tr2
1638 addi.l r4, 8, r5
1639 ldx.q r4, r63, r4
1640 LOCAL(ct_r5_ld): /* Copy r5 from a memory address. */
1641 pt/l LOCAL(ct_r5_load), tr2
1642 movi 3, r30
1643 shlli r30, 20, r31
1644 and r1, r31, r32
1645 andc r1, r31, r1
1646 beq/l r31, r32, tr2
1647 addi.l r5, 8, r6
1648 ldx.q r5, r63, r5
1649 LOCAL(ct_r6_ld): /* Copy r6 from a memory address. */
1650 pt/l LOCAL(ct_r6_load), tr2
1651 movi 3 << 16, r31
1652 and r1, r31, r32
1653 andc r1, r31, r1
1654 beq/l r31, r32, tr2
1655 addi.l r6, 8, r7
1656 ldx.q r6, r63, r6
1657 LOCAL(ct_r7_ld): /* Copy r7 from a memory address. */
1658 pt/l LOCAL(ct_r7_load), tr2
1659 movi 3 << 12, r31
1660 and r1, r31, r32
1661 andc r1, r31, r1
1662 beq/l r31, r32, tr2
1663 addi.l r7, 8, r8
1664 ldx.q r7, r63, r7
1665 LOCAL(ct_r8_ld): /* Copy r8 from a memory address. */
1666 pt/l LOCAL(ct_r8_load), tr2
1667 movi 3 << 8, r31
1668 and r1, r31, r32
1669 andc r1, r31, r1
1670 beq/l r31, r32, tr2
1671 addi.l r8, 8, r9
1672 ldx.q r8, r63, r8
1673 LOCAL(ct_r9_ld): /* Copy r9 from a memory address. */
1674 pt/l LOCAL(ct_check_tramp), tr2
1675 ldx.q r9, r63, r9
1676 blink tr2, r63
1677 LOCAL(ct_r2_load):
1678 ldx.q r2, r63, r2
1679 blink tr1, r63
1680 LOCAL(ct_r3_load):
1681 ldx.q r3, r63, r3
1682 blink tr1, r63
1683 LOCAL(ct_r4_load):
1684 ldx.q r4, r63, r4
1685 blink tr1, r63
1686 LOCAL(ct_r5_load):
1687 ldx.q r5, r63, r5
1688 blink tr1, r63
1689 LOCAL(ct_r6_load):
1690 ldx.q r6, r63, r6
1691 blink tr1, r63
1692 LOCAL(ct_r7_load):
1693 ldx.q r7, r63, r7
1694 blink tr1, r63
1695 LOCAL(ct_r8_load):
1696 ldx.q r8, r63, r8
1697 blink tr1, r63
1698 LOCAL(ct_r2_pop): /* Pop r2 from the stack. */
1699 movi 1, r30
1700 ldx.q r15, r63, r2
1701 shlli r30, 29, r31
1702 addi.l r15, 8, r15
1703 andc r1, r31, r1
1704 blink tr1, r63
1705 LOCAL(ct_r3_pop): /* Pop r3 from the stack. */
1706 movi 1, r30
1707 ldx.q r15, r63, r3
1708 shlli r30, 26, r31
1709 addi.l r15, 8, r15
1710 andc r1, r31, r1
1711 blink tr1, r63
1712 LOCAL(ct_r4_pop): /* Pop r4 from the stack. */
1713 movi 1, r30
1714 ldx.q r15, r63, r4
1715 shlli r30, 23, r31
1716 addi.l r15, 8, r15
1717 andc r1, r31, r1
1718 blink tr1, r63
1719 LOCAL(ct_r5_pop): /* Pop r5 from the stack. */
1720 movi 1, r30
1721 ldx.q r15, r63, r5
1722 shlli r30, 20, r31
1723 addi.l r15, 8, r15
1724 andc r1, r31, r1
1725 blink tr1, r63
1726 LOCAL(ct_r6_pop): /* Pop r6 from the stack. */
1727 movi 1, r30
1728 ldx.q r15, r63, r6
1729 shlli r30, 16, r31
1730 addi.l r15, 8, r15
1731 andc r1, r31, r1
1732 blink tr1, r63
1733 LOCAL(ct_r7_pop): /* Pop r7 from the stack. */
1734 ldx.q r15, r63, r7
1735 movi 1 << 12, r31
1736 addi.l r15, 8, r15
1737 andc r1, r31, r1
1738 blink tr1, r63
1739 LOCAL(ct_r8_pop): /* Pop r8 from the stack. */
1740 ldx.q r15, r63, r8
1741 movi 1 << 8, r31
1742 addi.l r15, 8, r15
1743 andc r1, r31, r1
1744 blink tr1, r63
1745 LOCAL(ct_pop_seq): /* Pop a sequence of registers off the stack. */
1746 andi r1, 7 << 1, r30
1747 movi (LOCAL(ct_end_of_pop_seq) >> 16) & 65535, r32
1748 shlli r30, 2, r31
1749 shori LOCAL(ct_end_of_pop_seq) & 65535, r32
1750 sub.l r32, r31, r33
1751 ptabs/l r33, tr2
1752 blink tr2, r63
1753 LOCAL(ct_start_of_pop_seq): /* Beginning of pop sequence. */
1754 ldx.q r15, r63, r3
1755 addi.l r15, 8, r15
1756 ldx.q r15, r63, r4
1757 addi.l r15, 8, r15
1758 ldx.q r15, r63, r5
1759 addi.l r15, 8, r15
1760 ldx.q r15, r63, r6
1761 addi.l r15, 8, r15
1762 ldx.q r15, r63, r7
1763 addi.l r15, 8, r15
1764 ldx.q r15, r63, r8
1765 addi.l r15, 8, r15
1766 LOCAL(ct_r9_pop): /* Pop r9 from the stack. */
1767 ldx.q r15, r63, r9
1768 addi.l r15, 8, r15
1769 LOCAL(ct_end_of_pop_seq): /* Label used to compute first pop instruction. */
1770 LOCAL(ct_check_tramp): /* Check whether we need a trampoline. */
1771 pt/u LOCAL(ct_ret_wide), tr2
1772 andi r1, 1, r1
1773 bne/u r1, r63, tr2
1774 LOCAL(ct_call_func): /* Just branch to the function. */
1775 blink tr0, r63
1776 LOCAL(ct_ret_wide): /* Call the function, so that we can unpack its
1777 64-bit return value. */
1778 add.l r18, r63, r10
1779 blink tr0, r18
1780 ptabs r10, tr0
1781 #if __LITTLE_ENDIAN__
1782 shari r2, 32, r3
1783 add.l r2, r63, r2
1784 #else
1785 add.l r2, r63, r3
1786 shari r2, 32, r2
1787 #endif
1788 blink tr0, r63
1789 #endif /* L_shcompact_call_trampoline */
1791 #ifdef L_shcompact_return_trampoline
1792 /* This function does the converse of the code in `ret_wide'
1793 above. It is tail-called by SHcompact functions returning
1794 64-bit non-floating-point values, to pack the 32-bit values in
1795 r2 and r3 into r2. */
1797 .mode SHmedia
1798 .section .text..SHmedia32, "ax"
1799 .align 2
1800 .global GLOBAL(GCC_shcompact_return_trampoline)
1801 GLOBAL(GCC_shcompact_return_trampoline):
1802 ptabs/l r18, tr0
1803 #if __LITTLE_ENDIAN__
1804 addz.l r2, r63, r2
1805 shlli r3, 32, r3
1806 #else
1807 addz.l r3, r63, r3
1808 shlli r2, 32, r2
1809 #endif
1810 or r3, r2, r2
1811 blink tr0, r63
1812 #endif /* L_shcompact_return_trampoline */
1814 #ifdef L_shcompact_incoming_args
1815 .section .rodata
1816 .align 1
1817 LOCAL(ia_main_table):
1818 .word 1 /* Invalid, just loop */
1819 .word LOCAL(ia_r2_ld) - datalabel LOCAL(ia_main_label)
1820 .word LOCAL(ia_r2_push) - datalabel LOCAL(ia_main_label)
1821 .word 1 /* Invalid, just loop */
1822 .word LOCAL(ia_r3_ld) - datalabel LOCAL(ia_main_label)
1823 .word LOCAL(ia_r3_push) - datalabel LOCAL(ia_main_label)
1824 .word 1 /* Invalid, just loop */
1825 .word LOCAL(ia_r4_ld) - datalabel LOCAL(ia_main_label)
1826 .word LOCAL(ia_r4_push) - datalabel LOCAL(ia_main_label)
1827 .word 1 /* Invalid, just loop */
1828 .word LOCAL(ia_r5_ld) - datalabel LOCAL(ia_main_label)
1829 .word LOCAL(ia_r5_push) - datalabel LOCAL(ia_main_label)
1830 .word 1 /* Invalid, just loop */
1831 .word 1 /* Invalid, just loop */
1832 .word LOCAL(ia_r6_ld) - datalabel LOCAL(ia_main_label)
1833 .word LOCAL(ia_r6_push) - datalabel LOCAL(ia_main_label)
1834 .word 1 /* Invalid, just loop */
1835 .word 1 /* Invalid, just loop */
1836 .word LOCAL(ia_r7_ld) - datalabel LOCAL(ia_main_label)
1837 .word LOCAL(ia_r7_push) - datalabel LOCAL(ia_main_label)
1838 .word 1 /* Invalid, just loop */
1839 .word 1 /* Invalid, just loop */
1840 .word LOCAL(ia_r8_ld) - datalabel LOCAL(ia_main_label)
1841 .word LOCAL(ia_r8_push) - datalabel LOCAL(ia_main_label)
1842 .word 1 /* Invalid, just loop */
1843 .word 1 /* Invalid, just loop */
1844 .word LOCAL(ia_r9_ld) - datalabel LOCAL(ia_main_label)
1845 .word LOCAL(ia_r9_push) - datalabel LOCAL(ia_main_label)
1846 .word LOCAL(ia_push_seq) - datalabel LOCAL(ia_main_label)
1847 .word LOCAL(ia_push_seq) - datalabel LOCAL(ia_main_label)
1848 .word LOCAL(ia_r9_push) - datalabel LOCAL(ia_main_label)
1849 .word LOCAL(ia_return) - datalabel LOCAL(ia_main_label)
1850 .word LOCAL(ia_return) - datalabel LOCAL(ia_main_label)
1851 .mode SHmedia
1852 .section .text..SHmedia32, "ax"
1853 .align 2
1855 /* This function stores 64-bit general-purpose registers back in
1856 the stack, starting at @(r1), where the cookie is supposed to
1857 have been stored, and loads the address in which each register
1858 was stored into itself. Its execution time is linear on the
1859 number of registers that actually have to be copied, and it is
1860 optimized for structures larger than 64 bits, as opposed to
1861 invidivual `long long' arguments. See sh.h for details on the
1862 actual bit pattern. */
1864 .global GLOBAL(GCC_shcompact_incoming_args)
1865 GLOBAL(GCC_shcompact_incoming_args):
1866 ptabs/l r18, tr0 /* Prepare to return. */
1867 shlri r17, 32, r0 /* Load the cookie. */
1868 movi ((datalabel LOCAL(ia_main_table) - 31 * 2) >> 16) & 65535, r35
1869 pt/l LOCAL(ia_loop), tr1
1870 add.l r17, r63, r17
1871 shori ((datalabel LOCAL(ia_main_table) - 31 * 2)) & 65535, r35
1872 LOCAL(ia_loop):
1873 nsb r0, r28
1874 shlli r28, 1, r29
1875 ldx.w r35, r29, r30
1876 LOCAL(ia_main_label):
1877 ptrel/l r30, tr2
1878 blink tr2, r63
1879 LOCAL(ia_r2_ld): /* Store r2 and load its address. */
1880 movi 3, r30
1881 shlli r30, 29, r31
1882 and r0, r31, r32
1883 andc r0, r31, r0
1884 stx.q r17, r63, r2
1885 add.l r17, r63, r2
1886 addi.l r17, 8, r17
1887 beq/u r31, r32, tr1
1888 LOCAL(ia_r3_ld): /* Store r3 and load its address. */
1889 movi 3, r30
1890 shlli r30, 26, r31
1891 and r0, r31, r32
1892 andc r0, r31, r0
1893 stx.q r17, r63, r3
1894 add.l r17, r63, r3
1895 addi.l r17, 8, r17
1896 beq/u r31, r32, tr1
1897 LOCAL(ia_r4_ld): /* Store r4 and load its address. */
1898 movi 3, r30
1899 shlli r30, 23, r31
1900 and r0, r31, r32
1901 andc r0, r31, r0
1902 stx.q r17, r63, r4
1903 add.l r17, r63, r4
1904 addi.l r17, 8, r17
1905 beq/u r31, r32, tr1
1906 LOCAL(ia_r5_ld): /* Store r5 and load its address. */
1907 movi 3, r30
1908 shlli r30, 20, r31
1909 and r0, r31, r32
1910 andc r0, r31, r0
1911 stx.q r17, r63, r5
1912 add.l r17, r63, r5
1913 addi.l r17, 8, r17
1914 beq/u r31, r32, tr1
1915 LOCAL(ia_r6_ld): /* Store r6 and load its address. */
1916 movi 3, r30
1917 shlli r30, 16, r31
1918 and r0, r31, r32
1919 andc r0, r31, r0
1920 stx.q r17, r63, r6
1921 add.l r17, r63, r6
1922 addi.l r17, 8, r17
1923 beq/u r31, r32, tr1
1924 LOCAL(ia_r7_ld): /* Store r7 and load its address. */
1925 movi 3 << 12, r31
1926 and r0, r31, r32
1927 andc r0, r31, r0
1928 stx.q r17, r63, r7
1929 add.l r17, r63, r7
1930 addi.l r17, 8, r17
1931 beq/u r31, r32, tr1
1932 LOCAL(ia_r8_ld): /* Store r8 and load its address. */
1933 movi 3 << 8, r31
1934 and r0, r31, r32
1935 andc r0, r31, r0
1936 stx.q r17, r63, r8
1937 add.l r17, r63, r8
1938 addi.l r17, 8, r17
1939 beq/u r31, r32, tr1
1940 LOCAL(ia_r9_ld): /* Store r9 and load its address. */
1941 stx.q r17, r63, r9
1942 add.l r17, r63, r9
1943 blink tr0, r63
1944 LOCAL(ia_r2_push): /* Push r2 onto the stack. */
1945 movi 1, r30
1946 shlli r30, 29, r31
1947 andc r0, r31, r0
1948 stx.q r17, r63, r2
1949 addi.l r17, 8, r17
1950 blink tr1, r63
1951 LOCAL(ia_r3_push): /* Push r3 onto the stack. */
1952 movi 1, r30
1953 shlli r30, 26, r31
1954 andc r0, r31, r0
1955 stx.q r17, r63, r3
1956 addi.l r17, 8, r17
1957 blink tr1, r63
1958 LOCAL(ia_r4_push): /* Push r4 onto the stack. */
1959 movi 1, r30
1960 shlli r30, 23, r31
1961 andc r0, r31, r0
1962 stx.q r17, r63, r4
1963 addi.l r17, 8, r17
1964 blink tr1, r63
1965 LOCAL(ia_r5_push): /* Push r5 onto the stack. */
1966 movi 1, r30
1967 shlli r30, 20, r31
1968 andc r0, r31, r0
1969 stx.q r17, r63, r5
1970 addi.l r17, 8, r17
1971 blink tr1, r63
1972 LOCAL(ia_r6_push): /* Push r6 onto the stack. */
1973 movi 1, r30
1974 shlli r30, 16, r31
1975 andc r0, r31, r0
1976 stx.q r17, r63, r6
1977 addi.l r17, 8, r17
1978 blink tr1, r63
1979 LOCAL(ia_r7_push): /* Push r7 onto the stack. */
1980 movi 1 << 12, r31
1981 andc r0, r31, r0
1982 stx.q r17, r63, r7
1983 addi.l r17, 8, r17
1984 blink tr1, r63
1985 LOCAL(ia_r8_push): /* Push r8 onto the stack. */
1986 movi 1 << 8, r31
1987 andc r0, r31, r0
1988 stx.q r17, r63, r8
1989 addi.l r17, 8, r17
1990 blink tr1, r63
1991 LOCAL(ia_push_seq): /* Push a sequence of registers onto the stack. */
1992 andi r0, 7 << 1, r30
1993 movi (LOCAL(ia_end_of_push_seq) >> 16) & 65535, r32
1994 shlli r30, 2, r31
1995 shori LOCAL(ia_end_of_push_seq) & 65535, r32
1996 sub.l r32, r31, r33
1997 ptabs/l r33, tr2
1998 blink tr2, r63
1999 LOCAL(ia_stack_of_push_seq): /* Beginning of push sequence. */
2000 stx.q r17, r63, r3
2001 addi.l r17, 8, r17
2002 stx.q r17, r63, r4
2003 addi.l r17, 8, r17
2004 stx.q r17, r63, r5
2005 addi.l r17, 8, r17
2006 stx.q r17, r63, r6
2007 addi.l r17, 8, r17
2008 stx.q r17, r63, r7
2009 addi.l r17, 8, r17
2010 stx.q r17, r63, r8
2011 addi.l r17, 8, r17
2012 LOCAL(ia_r9_push): /* Push r9 onto the stack. */
2013 stx.q r17, r63, r9
2014 LOCAL(ia_return): /* Return. */
2015 blink tr0, r63
2016 LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */
2017 #endif /* L_shcompact_incoming_args */
2018 #endif
2019 #if __SH5__
2020 #ifdef L_nested_trampoline
2021 #if __SH5__ == 32
2022 .section .text..SHmedia32,"ax"
2023 #else
2024 .text
2025 #endif
2026 .align 3 /* It is copied in units of 8 bytes in SHmedia mode. */
2027 .global GLOBAL(GCC_nested_trampoline)
2028 GLOBAL(GCC_nested_trampoline):
2029 .mode SHmedia
2030 ptrel/u r63, tr0
2031 gettr tr0, r0
2032 #if __SH5__ == 64
2033 ld.q r0, 24, r1
2034 #else
2035 ld.l r0, 24, r1
2036 #endif
2037 ptabs/l r1, tr1
2038 #if __SH5__ == 64
2039 ld.q r0, 32, r1
2040 #else
2041 ld.l r0, 28, r1
2042 #endif
2043 blink tr1, r63
2044 #endif /* L_nested_trampoline */
2045 #endif /* __SH5__ */
2046 #if __SH5__ == 32
2047 #ifdef L_push_pop_shmedia_regs
2048 .section .text..SHmedia32,"ax"
2049 .mode SHmedia
2050 .align 2
2051 #ifndef __SH4_NOFPU__
2052 .global GLOBAL(GCC_push_shmedia_regs)
2053 GLOBAL(GCC_push_shmedia_regs):
2054 addi.l r15, -14*8, r15
2055 fst.d r15, 13*8, dr62
2056 fst.d r15, 12*8, dr60
2057 fst.d r15, 11*8, dr58
2058 fst.d r15, 10*8, dr56
2059 fst.d r15, 9*8, dr54
2060 fst.d r15, 8*8, dr52
2061 fst.d r15, 7*8, dr50
2062 fst.d r15, 6*8, dr48
2063 fst.d r15, 5*8, dr46
2064 fst.d r15, 4*8, dr44
2065 fst.d r15, 3*8, dr42
2066 fst.d r15, 2*8, dr40
2067 fst.d r15, 1*8, dr38
2068 fst.d r15, 0*8, dr36
2069 #endif
2070 .global GLOBAL(GCC_push_shmedia_regs_nofpu)
2071 GLOBAL(GCC_push_shmedia_regs_nofpu):
2072 ptabs/l r18, tr0
2073 addi.l r15, -27*8, r15
2074 gettr tr7, r62
2075 gettr tr6, r61
2076 gettr tr5, r60
2077 st.q r15, 26*8, r62
2078 st.q r15, 25*8, r61
2079 st.q r15, 24*8, r60
2080 st.q r15, 23*8, r59
2081 st.q r15, 22*8, r58
2082 st.q r15, 21*8, r57
2083 st.q r15, 20*8, r56
2084 st.q r15, 19*8, r55
2085 st.q r15, 18*8, r54
2086 st.q r15, 17*8, r53
2087 st.q r15, 16*8, r52
2088 st.q r15, 15*8, r51
2089 st.q r15, 14*8, r50
2090 st.q r15, 13*8, r49
2091 st.q r15, 12*8, r48
2092 st.q r15, 11*8, r47
2093 st.q r15, 10*8, r46
2094 st.q r15, 9*8, r45
2095 st.q r15, 8*8, r44
2096 st.q r15, 7*8, r35
2097 st.q r15, 6*8, r34
2098 st.q r15, 5*8, r33
2099 st.q r15, 4*8, r32
2100 st.q r15, 3*8, r31
2101 st.q r15, 2*8, r30
2102 st.q r15, 1*8, r29
2103 st.q r15, 0*8, r28
2104 blink tr0, r63
2106 #ifndef __SH4_NOFPU__
2107 .global GLOBAL(GCC_pop_shmedia_regs)
2108 GLOBAL(GCC_pop_shmedia_regs):
2109 pt .L0, tr1
2110 movi 41*8, r0
2111 fld.d r15, 40*8, dr62
2112 fld.d r15, 39*8, dr60
2113 fld.d r15, 38*8, dr58
2114 fld.d r15, 37*8, dr56
2115 fld.d r15, 36*8, dr54
2116 fld.d r15, 35*8, dr52
2117 fld.d r15, 34*8, dr50
2118 fld.d r15, 33*8, dr48
2119 fld.d r15, 32*8, dr46
2120 fld.d r15, 31*8, dr44
2121 fld.d r15, 30*8, dr42
2122 fld.d r15, 29*8, dr40
2123 fld.d r15, 28*8, dr38
2124 fld.d r15, 27*8, dr36
2125 blink tr1, r63
2126 #endif
2127 .global GLOBAL(GCC_pop_shmedia_regs_nofpu)
2128 GLOBAL(GCC_pop_shmedia_regs_nofpu):
2129 movi 27*8, r0
2130 .L0:
2131 ptabs r18, tr0
2132 ld.q r15, 26*8, r62
2133 ld.q r15, 25*8, r61
2134 ld.q r15, 24*8, r60
2135 ptabs r62, tr7
2136 ptabs r61, tr6
2137 ptabs r60, tr5
2138 ld.q r15, 23*8, r59
2139 ld.q r15, 22*8, r58
2140 ld.q r15, 21*8, r57
2141 ld.q r15, 20*8, r56
2142 ld.q r15, 19*8, r55
2143 ld.q r15, 18*8, r54
2144 ld.q r15, 17*8, r53
2145 ld.q r15, 16*8, r52
2146 ld.q r15, 15*8, r51
2147 ld.q r15, 14*8, r50
2148 ld.q r15, 13*8, r49
2149 ld.q r15, 12*8, r48
2150 ld.q r15, 11*8, r47
2151 ld.q r15, 10*8, r46
2152 ld.q r15, 9*8, r45
2153 ld.q r15, 8*8, r44
2154 ld.q r15, 7*8, r35
2155 ld.q r15, 6*8, r34
2156 ld.q r15, 5*8, r33
2157 ld.q r15, 4*8, r32
2158 ld.q r15, 3*8, r31
2159 ld.q r15, 2*8, r30
2160 ld.q r15, 1*8, r29
2161 ld.q r15, 0*8, r28
2162 add.l r15, r0, r15
2163 blink tr0, r63
2164 #endif /* __SH5__ == 32 */
2165 #endif /* L_push_pop_shmedia_regs */