xref: /openbmc/u-boot/arch/sh/lib/ashrsi3.S (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini/* SPDX-License-Identifier: GPL-2.0+ */
2cb4046c5SPhil Edworthy/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3cb4046c5SPhil Edworthy   2004, 2005, 2006
4cb4046c5SPhil Edworthy   Free Software Foundation, Inc.
51a459660SWolfgang Denk */
6cb4046c5SPhil Edworthy
7cb4046c5SPhil Edworthy!! libgcc routines for the Renesas / SuperH SH CPUs.
8cb4046c5SPhil Edworthy!! Contributed by Steve Chamberlain.
9cb4046c5SPhil Edworthy!! sac@cygnus.com
10cb4046c5SPhil Edworthy
11cb4046c5SPhil Edworthy!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
12cb4046c5SPhil Edworthy!! recoded in assembly by Toshiyasu Morita
13cb4046c5SPhil Edworthy!! tm@netcom.com
14cb4046c5SPhil Edworthy
15cb4046c5SPhil Edworthy/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
16cb4046c5SPhil Edworthy   ELF local label prefixes by J"orn Rennecke
17cb4046c5SPhil Edworthy   amylaar@cygnus.com  */
18cb4046c5SPhil Edworthy
19cb4046c5SPhil Edworthy!
20cb4046c5SPhil Edworthy! __ashrsi3
21cb4046c5SPhil Edworthy!
22cb4046c5SPhil Edworthy! Entry:
23cb4046c5SPhil Edworthy!
24cb4046c5SPhil Edworthy! r4: Value to shift
25cb4046c5SPhil Edworthy! r5: Shifts
26cb4046c5SPhil Edworthy!
27cb4046c5SPhil Edworthy! Exit:
28cb4046c5SPhil Edworthy!
29cb4046c5SPhil Edworthy! r0: Result
30cb4046c5SPhil Edworthy!
31cb4046c5SPhil Edworthy! Destroys:
32cb4046c5SPhil Edworthy!
33cb4046c5SPhil Edworthy! (none)
34cb4046c5SPhil Edworthy!
35cb4046c5SPhil Edworthy
36cb4046c5SPhil Edworthy	.global	__ashrsi3
37cb4046c5SPhil Edworthy
38cb4046c5SPhil Edworthy	.align	2
39cb4046c5SPhil Edworthy__ashrsi3:
40cb4046c5SPhil Edworthy	mov	#31,r0
41cb4046c5SPhil Edworthy	and	r0,r5
42cb4046c5SPhil Edworthy	mova	ashrsi3_table,r0
43cb4046c5SPhil Edworthy	mov.b	@(r0,r5),r5
44cb4046c5SPhil Edworthy#ifdef __sh1__
45cb4046c5SPhil Edworthy	add	r5,r0
46cb4046c5SPhil Edworthy	jmp	@r0
47cb4046c5SPhil Edworthy#else
48cb4046c5SPhil Edworthy	braf	r5
49cb4046c5SPhil Edworthy#endif
50cb4046c5SPhil Edworthy	mov	r4,r0
51cb4046c5SPhil Edworthy
52cb4046c5SPhil Edworthy	.align	2
53cb4046c5SPhil Edworthyashrsi3_table:
54cb4046c5SPhil Edworthy	.byte		ashrsi3_0-ashrsi3_table
55cb4046c5SPhil Edworthy	.byte		ashrsi3_1-ashrsi3_table
56cb4046c5SPhil Edworthy	.byte		ashrsi3_2-ashrsi3_table
57cb4046c5SPhil Edworthy	.byte		ashrsi3_3-ashrsi3_table
58cb4046c5SPhil Edworthy	.byte		ashrsi3_4-ashrsi3_table
59cb4046c5SPhil Edworthy	.byte		ashrsi3_5-ashrsi3_table
60cb4046c5SPhil Edworthy	.byte		ashrsi3_6-ashrsi3_table
61cb4046c5SPhil Edworthy	.byte		ashrsi3_7-ashrsi3_table
62cb4046c5SPhil Edworthy	.byte		ashrsi3_8-ashrsi3_table
63cb4046c5SPhil Edworthy	.byte		ashrsi3_9-ashrsi3_table
64cb4046c5SPhil Edworthy	.byte		ashrsi3_10-ashrsi3_table
65cb4046c5SPhil Edworthy	.byte		ashrsi3_11-ashrsi3_table
66cb4046c5SPhil Edworthy	.byte		ashrsi3_12-ashrsi3_table
67cb4046c5SPhil Edworthy	.byte		ashrsi3_13-ashrsi3_table
68cb4046c5SPhil Edworthy	.byte		ashrsi3_14-ashrsi3_table
69cb4046c5SPhil Edworthy	.byte		ashrsi3_15-ashrsi3_table
70cb4046c5SPhil Edworthy	.byte		ashrsi3_16-ashrsi3_table
71cb4046c5SPhil Edworthy	.byte		ashrsi3_17-ashrsi3_table
72cb4046c5SPhil Edworthy	.byte		ashrsi3_18-ashrsi3_table
73cb4046c5SPhil Edworthy	.byte		ashrsi3_19-ashrsi3_table
74cb4046c5SPhil Edworthy	.byte		ashrsi3_20-ashrsi3_table
75cb4046c5SPhil Edworthy	.byte		ashrsi3_21-ashrsi3_table
76cb4046c5SPhil Edworthy	.byte		ashrsi3_22-ashrsi3_table
77cb4046c5SPhil Edworthy	.byte		ashrsi3_23-ashrsi3_table
78cb4046c5SPhil Edworthy	.byte		ashrsi3_24-ashrsi3_table
79cb4046c5SPhil Edworthy	.byte		ashrsi3_25-ashrsi3_table
80cb4046c5SPhil Edworthy	.byte		ashrsi3_26-ashrsi3_table
81cb4046c5SPhil Edworthy	.byte		ashrsi3_27-ashrsi3_table
82cb4046c5SPhil Edworthy	.byte		ashrsi3_28-ashrsi3_table
83cb4046c5SPhil Edworthy	.byte		ashrsi3_29-ashrsi3_table
84cb4046c5SPhil Edworthy	.byte		ashrsi3_30-ashrsi3_table
85cb4046c5SPhil Edworthy	.byte		ashrsi3_31-ashrsi3_table
86cb4046c5SPhil Edworthy
87cb4046c5SPhil Edworthyashrsi3_31:
88cb4046c5SPhil Edworthy	rotcl	r0
89cb4046c5SPhil Edworthy	rts
90cb4046c5SPhil Edworthy	subc	r0,r0
91cb4046c5SPhil Edworthy
92cb4046c5SPhil Edworthyashrsi3_30:
93cb4046c5SPhil Edworthy	shar	r0
94cb4046c5SPhil Edworthyashrsi3_29:
95cb4046c5SPhil Edworthy	shar	r0
96cb4046c5SPhil Edworthyashrsi3_28:
97cb4046c5SPhil Edworthy	shar	r0
98cb4046c5SPhil Edworthyashrsi3_27:
99cb4046c5SPhil Edworthy	shar	r0
100cb4046c5SPhil Edworthyashrsi3_26:
101cb4046c5SPhil Edworthy	shar	r0
102cb4046c5SPhil Edworthyashrsi3_25:
103cb4046c5SPhil Edworthy	shar	r0
104cb4046c5SPhil Edworthyashrsi3_24:
105cb4046c5SPhil Edworthy	shlr16	r0
106cb4046c5SPhil Edworthy	shlr8	r0
107cb4046c5SPhil Edworthy	rts
108cb4046c5SPhil Edworthy	exts.b	r0,r0
109cb4046c5SPhil Edworthy
110cb4046c5SPhil Edworthyashrsi3_23:
111cb4046c5SPhil Edworthy	shar	r0
112cb4046c5SPhil Edworthyashrsi3_22:
113cb4046c5SPhil Edworthy	shar	r0
114cb4046c5SPhil Edworthyashrsi3_21:
115cb4046c5SPhil Edworthy	shar	r0
116cb4046c5SPhil Edworthyashrsi3_20:
117cb4046c5SPhil Edworthy	shar	r0
118cb4046c5SPhil Edworthyashrsi3_19:
119cb4046c5SPhil Edworthy	shar	r0
120cb4046c5SPhil Edworthyashrsi3_18:
121cb4046c5SPhil Edworthy	shar	r0
122cb4046c5SPhil Edworthyashrsi3_17:
123cb4046c5SPhil Edworthy	shar	r0
124cb4046c5SPhil Edworthyashrsi3_16:
125cb4046c5SPhil Edworthy	shlr16	r0
126cb4046c5SPhil Edworthy	rts
127cb4046c5SPhil Edworthy	exts.w	r0,r0
128cb4046c5SPhil Edworthy
129cb4046c5SPhil Edworthyashrsi3_15:
130cb4046c5SPhil Edworthy	shar	r0
131cb4046c5SPhil Edworthyashrsi3_14:
132cb4046c5SPhil Edworthy	shar	r0
133cb4046c5SPhil Edworthyashrsi3_13:
134cb4046c5SPhil Edworthy	shar	r0
135cb4046c5SPhil Edworthyashrsi3_12:
136cb4046c5SPhil Edworthy	shar	r0
137cb4046c5SPhil Edworthyashrsi3_11:
138cb4046c5SPhil Edworthy	shar	r0
139cb4046c5SPhil Edworthyashrsi3_10:
140cb4046c5SPhil Edworthy	shar	r0
141cb4046c5SPhil Edworthyashrsi3_9:
142cb4046c5SPhil Edworthy	shar	r0
143cb4046c5SPhil Edworthyashrsi3_8:
144cb4046c5SPhil Edworthy	shar	r0
145cb4046c5SPhil Edworthyashrsi3_7:
146cb4046c5SPhil Edworthy	shar	r0
147cb4046c5SPhil Edworthyashrsi3_6:
148cb4046c5SPhil Edworthy	shar	r0
149cb4046c5SPhil Edworthyashrsi3_5:
150cb4046c5SPhil Edworthy	shar	r0
151cb4046c5SPhil Edworthyashrsi3_4:
152cb4046c5SPhil Edworthy	shar	r0
153cb4046c5SPhil Edworthyashrsi3_3:
154cb4046c5SPhil Edworthy	shar	r0
155cb4046c5SPhil Edworthyashrsi3_2:
156cb4046c5SPhil Edworthy	shar	r0
157cb4046c5SPhil Edworthyashrsi3_1:
158cb4046c5SPhil Edworthy	rts
159cb4046c5SPhil Edworthy	shar	r0
160cb4046c5SPhil Edworthy
161cb4046c5SPhil Edworthyashrsi3_0:
162cb4046c5SPhil Edworthy	rts
163cb4046c5SPhil Edworthy	nop
164