xref: /openbmc/u-boot/arch/sh/lib/ashrsi3.S (revision 552a848e)
1/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2   2004, 2005, 2006
3   Free Software Foundation, Inc.
4
5 * SPDX-License-Identifier:	GPL-2.0+
6 */
7
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! __ashrsi3
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
37	.global	__ashrsi3
38
39	.align	2
40__ashrsi3:
41	mov	#31,r0
42	and	r0,r5
43	mova	ashrsi3_table,r0
44	mov.b	@(r0,r5),r5
45#ifdef __sh1__
46	add	r5,r0
47	jmp	@r0
48#else
49	braf	r5
50#endif
51	mov	r4,r0
52
53	.align	2
54ashrsi3_table:
55	.byte		ashrsi3_0-ashrsi3_table
56	.byte		ashrsi3_1-ashrsi3_table
57	.byte		ashrsi3_2-ashrsi3_table
58	.byte		ashrsi3_3-ashrsi3_table
59	.byte		ashrsi3_4-ashrsi3_table
60	.byte		ashrsi3_5-ashrsi3_table
61	.byte		ashrsi3_6-ashrsi3_table
62	.byte		ashrsi3_7-ashrsi3_table
63	.byte		ashrsi3_8-ashrsi3_table
64	.byte		ashrsi3_9-ashrsi3_table
65	.byte		ashrsi3_10-ashrsi3_table
66	.byte		ashrsi3_11-ashrsi3_table
67	.byte		ashrsi3_12-ashrsi3_table
68	.byte		ashrsi3_13-ashrsi3_table
69	.byte		ashrsi3_14-ashrsi3_table
70	.byte		ashrsi3_15-ashrsi3_table
71	.byte		ashrsi3_16-ashrsi3_table
72	.byte		ashrsi3_17-ashrsi3_table
73	.byte		ashrsi3_18-ashrsi3_table
74	.byte		ashrsi3_19-ashrsi3_table
75	.byte		ashrsi3_20-ashrsi3_table
76	.byte		ashrsi3_21-ashrsi3_table
77	.byte		ashrsi3_22-ashrsi3_table
78	.byte		ashrsi3_23-ashrsi3_table
79	.byte		ashrsi3_24-ashrsi3_table
80	.byte		ashrsi3_25-ashrsi3_table
81	.byte		ashrsi3_26-ashrsi3_table
82	.byte		ashrsi3_27-ashrsi3_table
83	.byte		ashrsi3_28-ashrsi3_table
84	.byte		ashrsi3_29-ashrsi3_table
85	.byte		ashrsi3_30-ashrsi3_table
86	.byte		ashrsi3_31-ashrsi3_table
87
88ashrsi3_31:
89	rotcl	r0
90	rts
91	subc	r0,r0
92
93ashrsi3_30:
94	shar	r0
95ashrsi3_29:
96	shar	r0
97ashrsi3_28:
98	shar	r0
99ashrsi3_27:
100	shar	r0
101ashrsi3_26:
102	shar	r0
103ashrsi3_25:
104	shar	r0
105ashrsi3_24:
106	shlr16	r0
107	shlr8	r0
108	rts
109	exts.b	r0,r0
110
111ashrsi3_23:
112	shar	r0
113ashrsi3_22:
114	shar	r0
115ashrsi3_21:
116	shar	r0
117ashrsi3_20:
118	shar	r0
119ashrsi3_19:
120	shar	r0
121ashrsi3_18:
122	shar	r0
123ashrsi3_17:
124	shar	r0
125ashrsi3_16:
126	shlr16	r0
127	rts
128	exts.w	r0,r0
129
130ashrsi3_15:
131	shar	r0
132ashrsi3_14:
133	shar	r0
134ashrsi3_13:
135	shar	r0
136ashrsi3_12:
137	shar	r0
138ashrsi3_11:
139	shar	r0
140ashrsi3_10:
141	shar	r0
142ashrsi3_9:
143	shar	r0
144ashrsi3_8:
145	shar	r0
146ashrsi3_7:
147	shar	r0
148ashrsi3_6:
149	shar	r0
150ashrsi3_5:
151	shar	r0
152ashrsi3_4:
153	shar	r0
154ashrsi3_3:
155	shar	r0
156ashrsi3_2:
157	shar	r0
158ashrsi3_1:
159	rts
160	shar	r0
161
162ashrsi3_0:
163	rts
164	nop
165