blob: 787044d2e6462598a8f2dd5ccceb19173d502bff [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
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
6 */
Phil Edworthyeeb84df2011-06-02 22:15:27 +00007
8!! libgcc routines for the Renesas / SuperH SH CPUs.
9!! Contributed by Steve Chamberlain.
10!! sac@cygnus.com
11
12!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
13!! recoded in assembly by Toshiyasu Morita
14!! tm@netcom.com
15
16/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
17 ELF local label prefixes by J"orn Rennecke
18 amylaar@cygnus.com */
19
20!
21! __lshrsi3)
22!
23! Entry:
24!
25! r4: Value to shift
26! r5: Shifts
27!
28! Exit:
29!
30! r0: Result
31!
32! Destroys:
33!
34! (none)
35!
36 .global __lshrsi3
37 .align 2
38__lshrsi3:
39 mov #31,r0
40 and r0,r5
41 mova __lshrsi3_table,r0
42 mov.b @(r0,r5),r5
43#ifdef __sh1__
44 add r5,r0
45 jmp @r0
46#else
47 braf r5
48#endif
49 mov r4,r0
50
51 .align 2
52__lshrsi3_table:
53 .byte __lshrsi3_0-__lshrsi3_table
54 .byte __lshrsi3_1-__lshrsi3_table
55 .byte __lshrsi3_2-__lshrsi3_table
56 .byte __lshrsi3_3-__lshrsi3_table
57 .byte __lshrsi3_4-__lshrsi3_table
58 .byte __lshrsi3_5-__lshrsi3_table
59 .byte __lshrsi3_6-__lshrsi3_table
60 .byte __lshrsi3_7-__lshrsi3_table
61 .byte __lshrsi3_8-__lshrsi3_table
62 .byte __lshrsi3_9-__lshrsi3_table
63 .byte __lshrsi3_10-__lshrsi3_table
64 .byte __lshrsi3_11-__lshrsi3_table
65 .byte __lshrsi3_12-__lshrsi3_table
66 .byte __lshrsi3_13-__lshrsi3_table
67 .byte __lshrsi3_14-__lshrsi3_table
68 .byte __lshrsi3_15-__lshrsi3_table
69 .byte __lshrsi3_16-__lshrsi3_table
70 .byte __lshrsi3_17-__lshrsi3_table
71 .byte __lshrsi3_18-__lshrsi3_table
72 .byte __lshrsi3_19-__lshrsi3_table
73 .byte __lshrsi3_20-__lshrsi3_table
74 .byte __lshrsi3_21-__lshrsi3_table
75 .byte __lshrsi3_22-__lshrsi3_table
76 .byte __lshrsi3_23-__lshrsi3_table
77 .byte __lshrsi3_24-__lshrsi3_table
78 .byte __lshrsi3_25-__lshrsi3_table
79 .byte __lshrsi3_26-__lshrsi3_table
80 .byte __lshrsi3_27-__lshrsi3_table
81 .byte __lshrsi3_28-__lshrsi3_table
82 .byte __lshrsi3_29-__lshrsi3_table
83 .byte __lshrsi3_30-__lshrsi3_table
84 .byte __lshrsi3_31-__lshrsi3_table
85
86__lshrsi3_6:
87 shlr2 r0
88__lshrsi3_4:
89 shlr2 r0
90__lshrsi3_2:
91 rts
92 shlr2 r0
93
94__lshrsi3_7:
95 shlr2 r0
96__lshrsi3_5:
97 shlr2 r0
98__lshrsi3_3:
99 shlr2 r0
100__lshrsi3_1:
101 rts
102 shlr r0
103
104__lshrsi3_14:
105 shlr2 r0
106__lshrsi3_12:
107 shlr2 r0
108__lshrsi3_10:
109 shlr2 r0
110__lshrsi3_8:
111 rts
112 shlr8 r0
113
114__lshrsi3_15:
115 shlr2 r0
116__lshrsi3_13:
117 shlr2 r0
118__lshrsi3_11:
119 shlr2 r0
120__lshrsi3_9:
121 shlr8 r0
122 rts
123 shlr r0
124
125__lshrsi3_22:
126 shlr2 r0
127__lshrsi3_20:
128 shlr2 r0
129__lshrsi3_18:
130 shlr2 r0
131__lshrsi3_16:
132 rts
133 shlr16 r0
134
135__lshrsi3_23:
136 shlr2 r0
137__lshrsi3_21:
138 shlr2 r0
139__lshrsi3_19:
140 shlr2 r0
141__lshrsi3_17:
142 shlr16 r0
143 rts
144 shlr r0
145
146__lshrsi3_30:
147 shlr2 r0
148__lshrsi3_28:
149 shlr2 r0
150__lshrsi3_26:
151 shlr2 r0
152__lshrsi3_24:
153 shlr16 r0
154 rts
155 shlr8 r0
156
157__lshrsi3_31:
158 shlr2 r0
159__lshrsi3_29:
160 shlr2 r0
161__lshrsi3_27:
162 shlr2 r0
163__lshrsi3_25:
164 shlr16 r0
165 shlr8 r0
166 rts
167 shlr r0
168
169__lshrsi3_0:
170 rts
171 nop