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