xref: /linux/arch/sh/lib/ashlsi3.S (revision 940d4113f3306e07a1f86541489b686d1a979d54)
11aad54a9SPaul Mundt/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
21aad54a9SPaul Mundt   2004, 2005, 2006
31aad54a9SPaul Mundt   Free Software Foundation, Inc.
41aad54a9SPaul Mundt
51aad54a9SPaul MundtThis file is free software; you can redistribute it and/or modify it
61aad54a9SPaul Mundtunder the terms of the GNU General Public License as published by the
71aad54a9SPaul MundtFree Software Foundation; either version 2, or (at your option) any
81aad54a9SPaul Mundtlater version.
91aad54a9SPaul Mundt
101aad54a9SPaul MundtIn addition to the permissions in the GNU General Public License, the
111aad54a9SPaul MundtFree Software Foundation gives you unlimited permission to link the
121aad54a9SPaul Mundtcompiled version of this file into combinations with other programs,
131aad54a9SPaul Mundtand to distribute those combinations without any restriction coming
141aad54a9SPaul Mundtfrom the use of this file.  (The General Public License restrictions
151aad54a9SPaul Mundtdo apply in other respects; for example, they cover modification of
161aad54a9SPaul Mundtthe file, and distribution when not linked into a combine
171aad54a9SPaul Mundtexecutable.)
181aad54a9SPaul Mundt
191aad54a9SPaul MundtThis file is distributed in the hope that it will be useful, but
201aad54a9SPaul MundtWITHOUT ANY WARRANTY; without even the implied warranty of
211aad54a9SPaul MundtMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
221aad54a9SPaul MundtGeneral Public License for more details.
231aad54a9SPaul Mundt
241aad54a9SPaul MundtYou should have received a copy of the GNU General Public License
251aad54a9SPaul Mundtalong with this program; see the file COPYING.  If not, write to
261aad54a9SPaul Mundtthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
271aad54a9SPaul MundtBoston, MA 02110-1301, USA.  */
281aad54a9SPaul Mundt
291aad54a9SPaul Mundt!! libgcc routines for the Renesas / SuperH SH CPUs.
301aad54a9SPaul Mundt!! Contributed by Steve Chamberlain.
311aad54a9SPaul Mundt!! sac@cygnus.com
321aad54a9SPaul Mundt
331aad54a9SPaul Mundt!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
341aad54a9SPaul Mundt!! recoded in assembly by Toshiyasu Morita
351aad54a9SPaul Mundt!! tm@netcom.com
361aad54a9SPaul Mundt
371aad54a9SPaul Mundt/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
381aad54a9SPaul Mundt   ELF local label prefixes by J"orn Rennecke
391aad54a9SPaul Mundt   amylaar@cygnus.com  */
401aad54a9SPaul Mundt
411aad54a9SPaul Mundt!
421aad54a9SPaul Mundt! __ashlsi3
431aad54a9SPaul Mundt!
441aad54a9SPaul Mundt! Entry:
451aad54a9SPaul Mundt!
461aad54a9SPaul Mundt! r4: Value to shift
471aad54a9SPaul Mundt! r5: Shifts
481aad54a9SPaul Mundt!
491aad54a9SPaul Mundt! Exit:
501aad54a9SPaul Mundt!
511aad54a9SPaul Mundt! r0: Result
521aad54a9SPaul Mundt!
531aad54a9SPaul Mundt! Destroys:
541aad54a9SPaul Mundt!
551aad54a9SPaul Mundt! (none)
561aad54a9SPaul Mundt!
57*940d4113SYoshinori Sato! __ashlsi3_r0
58*940d4113SYoshinori Sato!
59*940d4113SYoshinori Sato! Entry:
60*940d4113SYoshinori Sato!
61*940d4113SYoshinori Sato! r4: Value to shift
62*940d4113SYoshinori Sato! r0: Shifts
63*940d4113SYoshinori Sato!
64*940d4113SYoshinori Sato! Exit:
65*940d4113SYoshinori Sato!
66*940d4113SYoshinori Sato! r0: Result
67*940d4113SYoshinori Sato!
68*940d4113SYoshinori Sato! Destroys:
69*940d4113SYoshinori Sato!
70*940d4113SYoshinori Sato! (none)
71*940d4113SYoshinori Sato
72*940d4113SYoshinori Sato
731aad54a9SPaul Mundt	.global	__ashlsi3
74*940d4113SYoshinori Sato	.global	__ashlsi3_r0
751aad54a9SPaul Mundt
761aad54a9SPaul Mundt	.align	2
771aad54a9SPaul Mundt__ashlsi3:
78*940d4113SYoshinori Sato	mov	r5,r0
79*940d4113SYoshinori Sato	.align	2
80*940d4113SYoshinori Sato__ashlsi3_r0:
81*940d4113SYoshinori Sato	and	#31,r0
82*940d4113SYoshinori Sato	mov.l	r4,@-r15
83*940d4113SYoshinori Sato	mov	r0,r4
841aad54a9SPaul Mundt	mova	ashlsi3_table,r0
85*940d4113SYoshinori Sato	mov.b	@(r0,r4),r4
86*940d4113SYoshinori Sato	add	r4,r0
871aad54a9SPaul Mundt	jmp	@r0
88*940d4113SYoshinori Sato	mov.l	@r15+,r0
891aad54a9SPaul Mundt
901aad54a9SPaul Mundt	.align	2
911aad54a9SPaul Mundtashlsi3_table:
921aad54a9SPaul Mundt	.byte		ashlsi3_0-ashlsi3_table
931aad54a9SPaul Mundt	.byte		ashlsi3_1-ashlsi3_table
941aad54a9SPaul Mundt	.byte		ashlsi3_2-ashlsi3_table
951aad54a9SPaul Mundt	.byte		ashlsi3_3-ashlsi3_table
961aad54a9SPaul Mundt	.byte		ashlsi3_4-ashlsi3_table
971aad54a9SPaul Mundt	.byte		ashlsi3_5-ashlsi3_table
981aad54a9SPaul Mundt	.byte		ashlsi3_6-ashlsi3_table
991aad54a9SPaul Mundt	.byte		ashlsi3_7-ashlsi3_table
1001aad54a9SPaul Mundt	.byte		ashlsi3_8-ashlsi3_table
1011aad54a9SPaul Mundt	.byte		ashlsi3_9-ashlsi3_table
1021aad54a9SPaul Mundt	.byte		ashlsi3_10-ashlsi3_table
1031aad54a9SPaul Mundt	.byte		ashlsi3_11-ashlsi3_table
1041aad54a9SPaul Mundt	.byte		ashlsi3_12-ashlsi3_table
1051aad54a9SPaul Mundt	.byte		ashlsi3_13-ashlsi3_table
1061aad54a9SPaul Mundt	.byte		ashlsi3_14-ashlsi3_table
1071aad54a9SPaul Mundt	.byte		ashlsi3_15-ashlsi3_table
1081aad54a9SPaul Mundt	.byte		ashlsi3_16-ashlsi3_table
1091aad54a9SPaul Mundt	.byte		ashlsi3_17-ashlsi3_table
1101aad54a9SPaul Mundt	.byte		ashlsi3_18-ashlsi3_table
1111aad54a9SPaul Mundt	.byte		ashlsi3_19-ashlsi3_table
1121aad54a9SPaul Mundt	.byte		ashlsi3_20-ashlsi3_table
1131aad54a9SPaul Mundt	.byte		ashlsi3_21-ashlsi3_table
1141aad54a9SPaul Mundt	.byte		ashlsi3_22-ashlsi3_table
1151aad54a9SPaul Mundt	.byte		ashlsi3_23-ashlsi3_table
1161aad54a9SPaul Mundt	.byte		ashlsi3_24-ashlsi3_table
1171aad54a9SPaul Mundt	.byte		ashlsi3_25-ashlsi3_table
1181aad54a9SPaul Mundt	.byte		ashlsi3_26-ashlsi3_table
1191aad54a9SPaul Mundt	.byte		ashlsi3_27-ashlsi3_table
1201aad54a9SPaul Mundt	.byte		ashlsi3_28-ashlsi3_table
1211aad54a9SPaul Mundt	.byte		ashlsi3_29-ashlsi3_table
1221aad54a9SPaul Mundt	.byte		ashlsi3_30-ashlsi3_table
1231aad54a9SPaul Mundt	.byte		ashlsi3_31-ashlsi3_table
1241aad54a9SPaul Mundt
1251aad54a9SPaul Mundtashlsi3_6:
1261aad54a9SPaul Mundt	shll2	r0
1271aad54a9SPaul Mundtashlsi3_4:
1281aad54a9SPaul Mundt	shll2	r0
1291aad54a9SPaul Mundtashlsi3_2:
1301aad54a9SPaul Mundt	rts
1311aad54a9SPaul Mundt	shll2	r0
1321aad54a9SPaul Mundt
1331aad54a9SPaul Mundtashlsi3_7:
1341aad54a9SPaul Mundt	shll2	r0
1351aad54a9SPaul Mundtashlsi3_5:
1361aad54a9SPaul Mundt	shll2	r0
1371aad54a9SPaul Mundtashlsi3_3:
1381aad54a9SPaul Mundt	shll2	r0
1391aad54a9SPaul Mundtashlsi3_1:
1401aad54a9SPaul Mundt	rts
1411aad54a9SPaul Mundt	shll	r0
1421aad54a9SPaul Mundt
1431aad54a9SPaul Mundtashlsi3_14:
1441aad54a9SPaul Mundt	shll2	r0
1451aad54a9SPaul Mundtashlsi3_12:
1461aad54a9SPaul Mundt	shll2	r0
1471aad54a9SPaul Mundtashlsi3_10:
1481aad54a9SPaul Mundt	shll2	r0
1491aad54a9SPaul Mundtashlsi3_8:
1501aad54a9SPaul Mundt	rts
1511aad54a9SPaul Mundt	shll8	r0
1521aad54a9SPaul Mundt
1531aad54a9SPaul Mundtashlsi3_15:
1541aad54a9SPaul Mundt	shll2	r0
1551aad54a9SPaul Mundtashlsi3_13:
1561aad54a9SPaul Mundt	shll2	r0
1571aad54a9SPaul Mundtashlsi3_11:
1581aad54a9SPaul Mundt	shll2	r0
1591aad54a9SPaul Mundtashlsi3_9:
1601aad54a9SPaul Mundt	shll8	r0
1611aad54a9SPaul Mundt	rts
1621aad54a9SPaul Mundt	shll	r0
1631aad54a9SPaul Mundt
1641aad54a9SPaul Mundtashlsi3_22:
1651aad54a9SPaul Mundt	shll2	r0
1661aad54a9SPaul Mundtashlsi3_20:
1671aad54a9SPaul Mundt	shll2	r0
1681aad54a9SPaul Mundtashlsi3_18:
1691aad54a9SPaul Mundt	shll2	r0
1701aad54a9SPaul Mundtashlsi3_16:
1711aad54a9SPaul Mundt	rts
1721aad54a9SPaul Mundt	shll16	r0
1731aad54a9SPaul Mundt
1741aad54a9SPaul Mundtashlsi3_23:
1751aad54a9SPaul Mundt	shll2	r0
1761aad54a9SPaul Mundtashlsi3_21:
1771aad54a9SPaul Mundt	shll2	r0
1781aad54a9SPaul Mundtashlsi3_19:
1791aad54a9SPaul Mundt	shll2	r0
1801aad54a9SPaul Mundtashlsi3_17:
1811aad54a9SPaul Mundt	shll16	r0
1821aad54a9SPaul Mundt	rts
1831aad54a9SPaul Mundt	shll	r0
1841aad54a9SPaul Mundt
1851aad54a9SPaul Mundtashlsi3_30:
1861aad54a9SPaul Mundt	shll2	r0
1871aad54a9SPaul Mundtashlsi3_28:
1881aad54a9SPaul Mundt	shll2	r0
1891aad54a9SPaul Mundtashlsi3_26:
1901aad54a9SPaul Mundt	shll2	r0
1911aad54a9SPaul Mundtashlsi3_24:
1921aad54a9SPaul Mundt	shll16	r0
1931aad54a9SPaul Mundt	rts
1941aad54a9SPaul Mundt	shll8	r0
1951aad54a9SPaul Mundt
1961aad54a9SPaul Mundtashlsi3_31:
1971aad54a9SPaul Mundt	shll2	r0
1981aad54a9SPaul Mundtashlsi3_29:
1991aad54a9SPaul Mundt	shll2	r0
2001aad54a9SPaul Mundtashlsi3_27:
2011aad54a9SPaul Mundt	shll2	r0
2021aad54a9SPaul Mundtashlsi3_25:
2031aad54a9SPaul Mundt	shll16	r0
2041aad54a9SPaul Mundt	shll8	r0
2051aad54a9SPaul Mundt	rts
2061aad54a9SPaul Mundt	shll	r0
2071aad54a9SPaul Mundt
2081aad54a9SPaul Mundtashlsi3_0:
2091aad54a9SPaul Mundt	rts
2101aad54a9SPaul Mundt	nop
211