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