xref: /openbmc/linux/arch/sh/lib/lshrsi3.S (revision b78412b8)
1/* 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! __lshrsi3_r0
58!
59! Entry:
60!
61! r0: Value to shift
62! r5: Shifts
63!
64! Exit:
65!
66! r0: Result
67!
68! Destroys:
69!
70! (none)
71!
72	.global	__lshrsi3
73	.global	__lshrsi3_r0
74
75	.align	2
76__lshrsi3:
77	mov	r5,r0
78	.align	2
79__lshrsi3_r0:
80	and	#31,r0
81	mov.l	r4,@-r15
82	mov	r0,r4
83	mova	lshrsi3_table,r0
84	mov.b	@(r0,r4),r4
85	add	r4,r0
86	jmp	@r0
87	mov.l	@r15+,r0
88
89	.align	2
90lshrsi3_table:
91	.byte		lshrsi3_0-lshrsi3_table
92	.byte		lshrsi3_1-lshrsi3_table
93	.byte		lshrsi3_2-lshrsi3_table
94	.byte		lshrsi3_3-lshrsi3_table
95	.byte		lshrsi3_4-lshrsi3_table
96	.byte		lshrsi3_5-lshrsi3_table
97	.byte		lshrsi3_6-lshrsi3_table
98	.byte		lshrsi3_7-lshrsi3_table
99	.byte		lshrsi3_8-lshrsi3_table
100	.byte		lshrsi3_9-lshrsi3_table
101	.byte		lshrsi3_10-lshrsi3_table
102	.byte		lshrsi3_11-lshrsi3_table
103	.byte		lshrsi3_12-lshrsi3_table
104	.byte		lshrsi3_13-lshrsi3_table
105	.byte		lshrsi3_14-lshrsi3_table
106	.byte		lshrsi3_15-lshrsi3_table
107	.byte		lshrsi3_16-lshrsi3_table
108	.byte		lshrsi3_17-lshrsi3_table
109	.byte		lshrsi3_18-lshrsi3_table
110	.byte		lshrsi3_19-lshrsi3_table
111	.byte		lshrsi3_20-lshrsi3_table
112	.byte		lshrsi3_21-lshrsi3_table
113	.byte		lshrsi3_22-lshrsi3_table
114	.byte		lshrsi3_23-lshrsi3_table
115	.byte		lshrsi3_24-lshrsi3_table
116	.byte		lshrsi3_25-lshrsi3_table
117	.byte		lshrsi3_26-lshrsi3_table
118	.byte		lshrsi3_27-lshrsi3_table
119	.byte		lshrsi3_28-lshrsi3_table
120	.byte		lshrsi3_29-lshrsi3_table
121	.byte		lshrsi3_30-lshrsi3_table
122	.byte		lshrsi3_31-lshrsi3_table
123
124lshrsi3_6:
125	shlr2	r0
126lshrsi3_4:
127	shlr2	r0
128lshrsi3_2:
129	rts
130	shlr2	r0
131
132lshrsi3_7:
133	shlr2	r0
134lshrsi3_5:
135	shlr2	r0
136lshrsi3_3:
137	shlr2	r0
138lshrsi3_1:
139	rts
140	shlr	r0
141
142lshrsi3_14:
143	shlr2	r0
144lshrsi3_12:
145	shlr2	r0
146lshrsi3_10:
147	shlr2	r0
148lshrsi3_8:
149	rts
150	shlr8	r0
151
152lshrsi3_15:
153	shlr2	r0
154lshrsi3_13:
155	shlr2	r0
156lshrsi3_11:
157	shlr2	r0
158lshrsi3_9:
159	shlr8	r0
160	rts
161	shlr	r0
162
163lshrsi3_22:
164	shlr2	r0
165lshrsi3_20:
166	shlr2	r0
167lshrsi3_18:
168	shlr2	r0
169lshrsi3_16:
170	rts
171	shlr16	r0
172
173lshrsi3_23:
174	shlr2	r0
175lshrsi3_21:
176	shlr2	r0
177lshrsi3_19:
178	shlr2	r0
179lshrsi3_17:
180	shlr16	r0
181	rts
182	shlr	r0
183
184lshrsi3_30:
185	shlr2	r0
186lshrsi3_28:
187	shlr2	r0
188lshrsi3_26:
189	shlr2	r0
190lshrsi3_24:
191	shlr16	r0
192	rts
193	shlr8	r0
194
195lshrsi3_31:
196	shlr2	r0
197lshrsi3_29:
198	shlr2	r0
199lshrsi3_27:
200	shlr2	r0
201lshrsi3_25:
202	shlr16	r0
203	shlr8	r0
204	rts
205	shlr	r0
206
207lshrsi3_0:
208	rts
209	nop
210