]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/sh/lib/lshiftrt.S
socfpga: Move board/socfpga_cyclone5 to board/socfpga
[karo-tx-uboot.git] / arch / sh / lib / lshiftrt.S
1 /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2    2004, 2005, 2006
3    Free Software Foundation, Inc.
4
5 This file is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 In addition to the permissions in the GNU General Public License, the
11 Free Software Foundation gives you unlimited permission to link the
12 compiled version of this file into combinations with other programs,
13 and to distribute those combinations without any restriction coming
14 from the use of this file.  (The General Public License restrictions
15 do apply in other respects; for example, they cover modification of
16 the file, and distribution when not linked into a combine
17 executable.)
18
19 This file is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; see the file COPYING.  If not, write to
26 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27 Boston, 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