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