blob: e6fc1cfe62ab9666095efa79e5658c7506e7d1b2 [file] [log] [blame]
Phil Edworthy8e5ab4b2011-06-02 22:15:27 +00001/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 2004, 2005, 2006
3 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file into combinations with other programs,
13and to distribute those combinations without any restriction coming
14from the use of this file. (The General Public License restrictions
15do apply in other respects; for example, they cover modification of
16the file, and distribution when not linked into a combine
17executable.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27Boston, MA 02110-1301, USA. */
28
29!! libgcc routines for the Renesas / SuperH SH CPUs.
30!! Contributed by Steve Chamberlain.
31!! sac@cygnus.com
32
33!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
34!! recoded in assembly by Toshiyasu Morita
35!! tm@netcom.com
36
37/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
38 ELF local label prefixes by J"orn Rennecke
39 amylaar@cygnus.com */
40
41!
42! __lshrsi3)
43!
44! Entry:
45!
46! r4: Value to shift
47! r5: Shifts
48!
49! Exit:
50!
51! r0: Result
52!
53! Destroys:
54!
55! (none)
56!
57 .global __lshrsi3
58 .align 2
59__lshrsi3:
60 mov #31,r0
61 and r0,r5
62 mova __lshrsi3_table,r0
63 mov.b @(r0,r5),r5
64#ifdef __sh1__
65 add r5,r0
66 jmp @r0
67#else
68 braf r5
69#endif
70 mov r4,r0
71
72 .align 2
73__lshrsi3_table:
74 .byte __lshrsi3_0-__lshrsi3_table
75 .byte __lshrsi3_1-__lshrsi3_table
76 .byte __lshrsi3_2-__lshrsi3_table
77 .byte __lshrsi3_3-__lshrsi3_table
78 .byte __lshrsi3_4-__lshrsi3_table
79 .byte __lshrsi3_5-__lshrsi3_table
80 .byte __lshrsi3_6-__lshrsi3_table
81 .byte __lshrsi3_7-__lshrsi3_table
82 .byte __lshrsi3_8-__lshrsi3_table
83 .byte __lshrsi3_9-__lshrsi3_table
84 .byte __lshrsi3_10-__lshrsi3_table
85 .byte __lshrsi3_11-__lshrsi3_table
86 .byte __lshrsi3_12-__lshrsi3_table
87 .byte __lshrsi3_13-__lshrsi3_table
88 .byte __lshrsi3_14-__lshrsi3_table
89 .byte __lshrsi3_15-__lshrsi3_table
90 .byte __lshrsi3_16-__lshrsi3_table
91 .byte __lshrsi3_17-__lshrsi3_table
92 .byte __lshrsi3_18-__lshrsi3_table
93 .byte __lshrsi3_19-__lshrsi3_table
94 .byte __lshrsi3_20-__lshrsi3_table
95 .byte __lshrsi3_21-__lshrsi3_table
96 .byte __lshrsi3_22-__lshrsi3_table
97 .byte __lshrsi3_23-__lshrsi3_table
98 .byte __lshrsi3_24-__lshrsi3_table
99 .byte __lshrsi3_25-__lshrsi3_table
100 .byte __lshrsi3_26-__lshrsi3_table
101 .byte __lshrsi3_27-__lshrsi3_table
102 .byte __lshrsi3_28-__lshrsi3_table
103 .byte __lshrsi3_29-__lshrsi3_table
104 .byte __lshrsi3_30-__lshrsi3_table
105 .byte __lshrsi3_31-__lshrsi3_table
106
107__lshrsi3_6:
108 shlr2 r0
109__lshrsi3_4:
110 shlr2 r0
111__lshrsi3_2:
112 rts
113 shlr2 r0
114
115__lshrsi3_7:
116 shlr2 r0
117__lshrsi3_5:
118 shlr2 r0
119__lshrsi3_3:
120 shlr2 r0
121__lshrsi3_1:
122 rts
123 shlr r0
124
125__lshrsi3_14:
126 shlr2 r0
127__lshrsi3_12:
128 shlr2 r0
129__lshrsi3_10:
130 shlr2 r0
131__lshrsi3_8:
132 rts
133 shlr8 r0
134
135__lshrsi3_15:
136 shlr2 r0
137__lshrsi3_13:
138 shlr2 r0
139__lshrsi3_11:
140 shlr2 r0
141__lshrsi3_9:
142 shlr8 r0
143 rts
144 shlr r0
145
146__lshrsi3_22:
147 shlr2 r0
148__lshrsi3_20:
149 shlr2 r0
150__lshrsi3_18:
151 shlr2 r0
152__lshrsi3_16:
153 rts
154 shlr16 r0
155
156__lshrsi3_23:
157 shlr2 r0
158__lshrsi3_21:
159 shlr2 r0
160__lshrsi3_19:
161 shlr2 r0
162__lshrsi3_17:
163 shlr16 r0
164 rts
165 shlr r0
166
167__lshrsi3_30:
168 shlr2 r0
169__lshrsi3_28:
170 shlr2 r0
171__lshrsi3_26:
172 shlr2 r0
173__lshrsi3_24:
174 shlr16 r0
175 rts
176 shlr8 r0
177
178__lshrsi3_31:
179 shlr2 r0
180__lshrsi3_29:
181 shlr2 r0
182__lshrsi3_27:
183 shlr2 r0
184__lshrsi3_25:
185 shlr16 r0
186 shlr8 r0
187 rts
188 shlr r0
189
190__lshrsi3_0:
191 rts
192 nop