blob: 4940a87218719f90ed425e73adf3d3329c3cb9b0 [file] [log] [blame]
Phil Edworthyeeb84df2011-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! GLOBAL(ashlsi3)
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 __ashlsi3
58 .align 2
59__ashlsi3:
60 mov #31,r0
61 and r0,r5
62 mova __ashlsi3_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__ashlsi3_table:
74 .byte __ashlsi3_0-__ashlsi3_table
75 .byte __ashlsi3_1-__ashlsi3_table
76 .byte __ashlsi3_2-__ashlsi3_table
77 .byte __ashlsi3_3-__ashlsi3_table
78 .byte __ashlsi3_4-__ashlsi3_table
79 .byte __ashlsi3_5-__ashlsi3_table
80 .byte __ashlsi3_6-__ashlsi3_table
81 .byte __ashlsi3_7-__ashlsi3_table
82 .byte __ashlsi3_8-__ashlsi3_table
83 .byte __ashlsi3_9-__ashlsi3_table
84 .byte __ashlsi3_10-__ashlsi3_table
85 .byte __ashlsi3_11-__ashlsi3_table
86 .byte __ashlsi3_12-__ashlsi3_table
87 .byte __ashlsi3_13-__ashlsi3_table
88 .byte __ashlsi3_14-__ashlsi3_table
89 .byte __ashlsi3_15-__ashlsi3_table
90 .byte __ashlsi3_16-__ashlsi3_table
91 .byte __ashlsi3_17-__ashlsi3_table
92 .byte __ashlsi3_18-__ashlsi3_table
93 .byte __ashlsi3_19-__ashlsi3_table
94 .byte __ashlsi3_20-__ashlsi3_table
95 .byte __ashlsi3_21-__ashlsi3_table
96 .byte __ashlsi3_22-__ashlsi3_table
97 .byte __ashlsi3_23-__ashlsi3_table
98 .byte __ashlsi3_24-__ashlsi3_table
99 .byte __ashlsi3_25-__ashlsi3_table
100 .byte __ashlsi3_26-__ashlsi3_table
101 .byte __ashlsi3_27-__ashlsi3_table
102 .byte __ashlsi3_28-__ashlsi3_table
103 .byte __ashlsi3_29-__ashlsi3_table
104 .byte __ashlsi3_30-__ashlsi3_table
105 .byte __ashlsi3_31-__ashlsi3_table
106
107__ashlsi3_6:
108 shll2 r0
109__ashlsi3_4:
110 shll2 r0
111__ashlsi3_2:
112 rts
113 shll2 r0
114
115__ashlsi3_7:
116 shll2 r0
117__ashlsi3_5:
118 shll2 r0
119__ashlsi3_3:
120 shll2 r0
121__ashlsi3_1:
122 rts
123 shll r0
124
125__ashlsi3_14:
126 shll2 r0
127__ashlsi3_12:
128 shll2 r0
129__ashlsi3_10:
130 shll2 r0
131__ashlsi3_8:
132 rts
133 shll8 r0
134
135__ashlsi3_15:
136 shll2 r0
137__ashlsi3_13:
138 shll2 r0
139__ashlsi3_11:
140 shll2 r0
141__ashlsi3_9:
142 shll8 r0
143 rts
144 shll r0
145
146__ashlsi3_22:
147 shll2 r0
148__ashlsi3_20:
149 shll2 r0
150__ashlsi3_18:
151 shll2 r0
152__ashlsi3_16:
153 rts
154 shll16 r0
155
156__ashlsi3_23:
157 shll2 r0
158__ashlsi3_21:
159 shll2 r0
160__ashlsi3_19:
161 shll2 r0
162__ashlsi3_17:
163 shll16 r0
164 rts
165 shll r0
166
167__ashlsi3_30:
168 shll2 r0
169__ashlsi3_28:
170 shll2 r0
171__ashlsi3_26:
172 shll2 r0
173__ashlsi3_24:
174 shll16 r0
175 rts
176 shll8 r0
177
178__ashlsi3_31:
179 shll2 r0
180__ashlsi3_29:
181 shll2 r0
182__ashlsi3_27:
183 shll2 r0
184__ashlsi3_25:
185 shll16 r0
186 shll8 r0
187 rts
188 shll r0
189
190__ashlsi3_0:
191 rts
192 nop