1 /* Copyright (C) 1994 Free Software Foundation, Inc.
3 This file is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
8 In addition to the permissions in the GNU General Public License, the
9 Free Software Foundation gives you unlimited permission to link the
10 compiled version of this file with other programs, and to distribute
11 those programs without any restriction coming from the use of this
12 file. (The General Public License restrictions do apply in other
13 respects; for example, they cover modification of the file, and
14 distribution when not linked into another program.)
16 This file is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; see the file COPYING. If not, write to
23 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
25 /* As a special exception, if you link this library with other files,
26 some of which are compiled with GCC, to produce an executable,
27 this library does not by itself cause the resulting executable
28 to be covered by the GNU General Public License.
29 This exception does not however invalidate any other reasons why
30 the executable file might be covered by the GNU General Public License. */
33 !! libgcc1 routines for the Hitachi SH cpu.
34 !! Contributed by Steve Chamberlain.
37 !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
38 !! recoded in assembly by Toshiyasu Morita
42 .global ___ashiftrt_r4_0
43 .global ___ashiftrt_r4_1
44 .global ___ashiftrt_r4_2
45 .global ___ashiftrt_r4_3
46 .global ___ashiftrt_r4_4
47 .global ___ashiftrt_r4_5
48 .global ___ashiftrt_r4_6
49 .global ___ashiftrt_r4_7
50 .global ___ashiftrt_r4_8
51 .global ___ashiftrt_r4_9
52 .global ___ashiftrt_r4_10
53 .global ___ashiftrt_r4_11
54 .global ___ashiftrt_r4_12
55 .global ___ashiftrt_r4_13
56 .global ___ashiftrt_r4_14
57 .global ___ashiftrt_r4_15
58 .global ___ashiftrt_r4_16
59 .global ___ashiftrt_r4_17
60 .global ___ashiftrt_r4_18
61 .global ___ashiftrt_r4_19
62 .global ___ashiftrt_r4_20
63 .global ___ashiftrt_r4_21
64 .global ___ashiftrt_r4_22
65 .global ___ashiftrt_r4_23
66 .global ___ashiftrt_r4_24
67 .global ___ashiftrt_r4_25
68 .global ___ashiftrt_r4_26
69 .global ___ashiftrt_r4_27
70 .global ___ashiftrt_r4_28
71 .global ___ashiftrt_r4_29
72 .global ___ashiftrt_r4_30
73 .global ___ashiftrt_r4_31
74 .global ___ashiftrt_r4_32
182 mov r5,r1 ! Remove later
183 mova L_ashrsi3_table,r0
184 shll r1 ! Remove later
185 mov.w @(r0,r1),r1 ! Change to mov.b @(r0,r5),r1
191 .word L_ashrsi3_0-L_ashrsi3_table ! Change to .bytes
192 .word L_ashrsi3_1-L_ashrsi3_table
193 .word L_ashrsi3_2-L_ashrsi3_table
194 .word L_ashrsi3_3-L_ashrsi3_table
195 .word L_ashrsi3_4-L_ashrsi3_table
196 .word L_ashrsi3_5-L_ashrsi3_table
197 .word L_ashrsi3_6-L_ashrsi3_table
198 .word L_ashrsi3_7-L_ashrsi3_table
199 .word L_ashrsi3_8-L_ashrsi3_table
200 .word L_ashrsi3_9-L_ashrsi3_table
201 .word L_ashrsi3_10-L_ashrsi3_table
202 .word L_ashrsi3_11-L_ashrsi3_table
203 .word L_ashrsi3_12-L_ashrsi3_table
204 .word L_ashrsi3_13-L_ashrsi3_table
205 .word L_ashrsi3_14-L_ashrsi3_table
206 .word L_ashrsi3_15-L_ashrsi3_table
207 .word L_ashrsi3_16-L_ashrsi3_table
208 .word L_ashrsi3_17-L_ashrsi3_table
209 .word L_ashrsi3_18-L_ashrsi3_table
210 .word L_ashrsi3_19-L_ashrsi3_table
211 .word L_ashrsi3_20-L_ashrsi3_table
212 .word L_ashrsi3_21-L_ashrsi3_table
213 .word L_ashrsi3_22-L_ashrsi3_table
214 .word L_ashrsi3_23-L_ashrsi3_table
215 .word L_ashrsi3_24-L_ashrsi3_table
216 .word L_ashrsi3_25-L_ashrsi3_table
217 .word L_ashrsi3_26-L_ashrsi3_table
218 .word L_ashrsi3_27-L_ashrsi3_table
219 .word L_ashrsi3_28-L_ashrsi3_table
220 .word L_ashrsi3_29-L_ashrsi3_table
221 .word L_ashrsi3_30-L_ashrsi3_table
222 .word L_ashrsi3_31-L_ashrsi3_table
328 mov r5,r1 ! Remove later
329 mova L_ashlsi3_table,r0
330 shll r1 ! Remove later
331 mov.w @(r0,r1),r1 ! Change to mov.b @(r0,r5),r1
337 .word L_ashlsi3_0-L_ashlsi3_table ! Change to .bytes
338 .word L_ashlsi3_1-L_ashlsi3_table
339 .word L_ashlsi3_2-L_ashlsi3_table
340 .word L_ashlsi3_3-L_ashlsi3_table
341 .word L_ashlsi3_4-L_ashlsi3_table
342 .word L_ashlsi3_5-L_ashlsi3_table
343 .word L_ashlsi3_6-L_ashlsi3_table
344 .word L_ashlsi3_7-L_ashlsi3_table
345 .word L_ashlsi3_8-L_ashlsi3_table
346 .word L_ashlsi3_9-L_ashlsi3_table
347 .word L_ashlsi3_10-L_ashlsi3_table
348 .word L_ashlsi3_11-L_ashlsi3_table
349 .word L_ashlsi3_12-L_ashlsi3_table
350 .word L_ashlsi3_13-L_ashlsi3_table
351 .word L_ashlsi3_14-L_ashlsi3_table
352 .word L_ashlsi3_15-L_ashlsi3_table
353 .word L_ashlsi3_16-L_ashlsi3_table
354 .word L_ashlsi3_17-L_ashlsi3_table
355 .word L_ashlsi3_18-L_ashlsi3_table
356 .word L_ashlsi3_19-L_ashlsi3_table
357 .word L_ashlsi3_20-L_ashlsi3_table
358 .word L_ashlsi3_21-L_ashlsi3_table
359 .word L_ashlsi3_22-L_ashlsi3_table
360 .word L_ashlsi3_23-L_ashlsi3_table
361 .word L_ashlsi3_24-L_ashlsi3_table
362 .word L_ashlsi3_25-L_ashlsi3_table
363 .word L_ashlsi3_26-L_ashlsi3_table
364 .word L_ashlsi3_27-L_ashlsi3_table
365 .word L_ashlsi3_28-L_ashlsi3_table
366 .word L_ashlsi3_29-L_ashlsi3_table
367 .word L_ashlsi3_30-L_ashlsi3_table
368 .word L_ashlsi3_31-L_ashlsi3_table
487 mov r5,r1 ! Remove later
488 mova L_lshrsi3_table,r0
489 shll r1 ! Remove later
490 mov.w @(r0,r1),r1 ! Change to mov.b @(r0,r5),r1
496 .word L_lshrsi3_0-L_lshrsi3_table ! Change to .bytes
497 .word L_lshrsi3_1-L_lshrsi3_table
498 .word L_lshrsi3_2-L_lshrsi3_table
499 .word L_lshrsi3_3-L_lshrsi3_table
500 .word L_lshrsi3_4-L_lshrsi3_table
501 .word L_lshrsi3_5-L_lshrsi3_table
502 .word L_lshrsi3_6-L_lshrsi3_table
503 .word L_lshrsi3_7-L_lshrsi3_table
504 .word L_lshrsi3_8-L_lshrsi3_table
505 .word L_lshrsi3_9-L_lshrsi3_table
506 .word L_lshrsi3_10-L_lshrsi3_table
507 .word L_lshrsi3_11-L_lshrsi3_table
508 .word L_lshrsi3_12-L_lshrsi3_table
509 .word L_lshrsi3_13-L_lshrsi3_table
510 .word L_lshrsi3_14-L_lshrsi3_table
511 .word L_lshrsi3_15-L_lshrsi3_table
512 .word L_lshrsi3_16-L_lshrsi3_table
513 .word L_lshrsi3_17-L_lshrsi3_table
514 .word L_lshrsi3_18-L_lshrsi3_table
515 .word L_lshrsi3_19-L_lshrsi3_table
516 .word L_lshrsi3_20-L_lshrsi3_table
517 .word L_lshrsi3_21-L_lshrsi3_table
518 .word L_lshrsi3_22-L_lshrsi3_table
519 .word L_lshrsi3_23-L_lshrsi3_table
520 .word L_lshrsi3_24-L_lshrsi3_table
521 .word L_lshrsi3_25-L_lshrsi3_table
522 .word L_lshrsi3_26-L_lshrsi3_table
523 .word L_lshrsi3_27-L_lshrsi3_table
524 .word L_lshrsi3_28-L_lshrsi3_table
525 .word L_lshrsi3_29-L_lshrsi3_table
526 .word L_lshrsi3_30-L_lshrsi3_table
527 .word L_lshrsi3_31-L_lshrsi3_table
624 ! done all the large groups, do the remainder
635 .global ___movstrSI64
639 .global ___movstrSI60
643 .global ___movstrSI56
647 .global ___movstrSI52
651 .global ___movstrSI48
655 .global ___movstrSI44
659 .global ___movstrSI40
663 .global ___movstrSI36
667 .global ___movstrSI32
671 .global ___movstrSI28
675 .global ___movstrSI24
679 .global ___movstrSI20
683 .global ___movstrSI16
687 .global ___movstrSI12
771 ! r0 = aabb*ccdd via partial products
773 ! if aa == 0 and cc = 0
777 ! aa = bb*dd + (aa*dd*65536) + (cc*bb*65536)
781 mulu r4,r5 ! multiply the lsws macl=bb*dd
782 mov r5,r3 ! r3 = ccdd
783 swap.w r4,r2 ! r2 = bbaa
784 xtrct r2,r3 ! r3 = aacc
785 tst r3,r3 ! msws zero ?
787 rts ! yes - then weve got the answer
790 hiset: sts macl,r0 ! r0 = bb*dd
791 mulu r2,r5 | brewing macl = aa*dd
793 mulu r3,r4 | brewing macl = cc*bb
804 !! 4 byte integer Divide code for the Hitachi SH
811 !! args in r4 and r5, result in r0 clobber r1,r2,r3
902 !! 4 byte integer Divide code for the Hitachi SH
909 !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
916 ! get one bit from the msb of the numerator into the T
917 ! bit and divide it by whats in r5. Put the answer bit
918 ! into the T bit so it can come out again at the bottom
920 rotcl r4 ; div1 r5,r0
921 rotcl r4 ; div1 r5,r0
922 rotcl r4 ; div1 r5,r0
923 rotcl r4 ; div1 r5,r0
924 rotcl r4 ; div1 r5,r0
925 rotcl r4 ; div1 r5,r0
926 rotcl r4 ; div1 r5,r0
927 rotcl r4 ; div1 r5,r0
929 rotcl r4 ; div1 r5,r0
930 rotcl r4 ; div1 r5,r0
931 rotcl r4 ; div1 r5,r0
932 rotcl r4 ; div1 r5,r0
933 rotcl r4 ; div1 r5,r0
934 rotcl r4 ; div1 r5,r0
935 rotcl r4 ; div1 r5,r0
936 rotcl r4 ; div1 r5,r0
938 rotcl r4 ; div1 r5,r0
939 rotcl r4 ; div1 r5,r0
940 rotcl r4 ; div1 r5,r0
941 rotcl r4 ; div1 r5,r0
942 rotcl r4 ; div1 r5,r0
943 rotcl r4 ; div1 r5,r0
944 rotcl r4 ; div1 r5,r0
945 rotcl r4 ; div1 r5,r0
948 rotcl r4 ; div1 r5,r0
949 rotcl r4 ; div1 r5,r0
950 rotcl r4 ; div1 r5,r0
951 rotcl r4 ; div1 r5,r0
952 rotcl r4 ; div1 r5,r0
953 rotcl r4 ; div1 r5,r0
954 rotcl r4 ; div1 r5,r0
955 rotcl r4 ; div1 r5,r0