| Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 1 | /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, | 
 | 2 |    2004, 2005, 2006 | 
 | 3 |    Free Software Foundation, Inc. | 
 | 4 |  | 
 | 5 | This file is free software; you can redistribute it and/or modify it | 
 | 6 | under the terms of the GNU General Public License as published by the | 
 | 7 | Free Software Foundation; either version 2, or (at your option) any | 
 | 8 | later version. | 
 | 9 |  | 
 | 10 | In addition to the permissions in the GNU General Public License, the | 
 | 11 | Free Software Foundation gives you unlimited permission to link the | 
 | 12 | compiled version of this file into combinations with other programs, | 
 | 13 | and to distribute those combinations without any restriction coming | 
 | 14 | from the use of this file.  (The General Public License restrictions | 
 | 15 | do apply in other respects; for example, they cover modification of | 
 | 16 | the file, and distribution when not linked into a combine | 
 | 17 | executable.) | 
 | 18 |  | 
 | 19 | This file is distributed in the hope that it will be useful, but | 
 | 20 | WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
 | 22 | General Public License for more details. | 
 | 23 |  | 
 | 24 | You should have received a copy of the GNU General Public License | 
 | 25 | along with this program; see the file COPYING.  If not, write to | 
 | 26 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, | 
 | 27 | Boston, MA 02110-1301, USA.  */ | 
 | 28 |  | 
 | 29 | !! libgcc routines for the Renesas / SuperH SH CPUs. | 
 | 30 | !! Contributed by Steve Chamberlain. | 
 | 31 | !! sac@cygnus.com | 
 | 32 |  | 
 | 33 | !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines | 
 | 34 | !! recoded in assembly by Toshiyasu Morita | 
 | 35 | !! tm@netcom.com | 
 | 36 |  | 
 | 37 | /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and | 
 | 38 |    ELF local label prefixes by J"orn Rennecke | 
 | 39 |    amylaar@cygnus.com  */ | 
 | 40 |  | 
 | 41 | ! | 
 | 42 | ! __ashrsi3 | 
 | 43 | ! | 
 | 44 | ! Entry: | 
 | 45 | ! | 
 | 46 | ! r4: Value to shift | 
 | 47 | ! r5: Shifts | 
 | 48 | ! | 
 | 49 | ! Exit: | 
 | 50 | ! | 
 | 51 | ! r0: Result | 
 | 52 | ! | 
 | 53 | ! Destroys: | 
 | 54 | ! | 
 | 55 | ! (none) | 
 | 56 | ! | 
 | 57 |  | 
 | 58 | 	.global	__ashrsi3 | 
 | 59 | 	 | 
 | 60 | 	.align	2 | 
 | 61 | __ashrsi3: | 
 | 62 | 	mov	#31,r0 | 
 | 63 | 	and	r0,r5 | 
 | 64 | 	mova	ashrsi3_table,r0 | 
 | 65 | 	mov.b	@(r0,r5),r5 | 
 | 66 | #ifdef __sh1__ | 
 | 67 | 	add	r5,r0 | 
 | 68 | 	jmp	@r0 | 
 | 69 | #else | 
 | 70 | 	braf	r5 | 
 | 71 | #endif | 
 | 72 | 	mov	r4,r0 | 
 | 73 |  | 
 | 74 | 	.align	2 | 
 | 75 | ashrsi3_table: | 
 | 76 | 	.byte		ashrsi3_0-ashrsi3_table | 
 | 77 | 	.byte		ashrsi3_1-ashrsi3_table | 
 | 78 | 	.byte		ashrsi3_2-ashrsi3_table | 
 | 79 | 	.byte		ashrsi3_3-ashrsi3_table | 
 | 80 | 	.byte		ashrsi3_4-ashrsi3_table | 
 | 81 | 	.byte		ashrsi3_5-ashrsi3_table | 
 | 82 | 	.byte		ashrsi3_6-ashrsi3_table | 
 | 83 | 	.byte		ashrsi3_7-ashrsi3_table | 
 | 84 | 	.byte		ashrsi3_8-ashrsi3_table | 
 | 85 | 	.byte		ashrsi3_9-ashrsi3_table | 
 | 86 | 	.byte		ashrsi3_10-ashrsi3_table | 
 | 87 | 	.byte		ashrsi3_11-ashrsi3_table | 
 | 88 | 	.byte		ashrsi3_12-ashrsi3_table | 
 | 89 | 	.byte		ashrsi3_13-ashrsi3_table | 
 | 90 | 	.byte		ashrsi3_14-ashrsi3_table | 
 | 91 | 	.byte		ashrsi3_15-ashrsi3_table | 
 | 92 | 	.byte		ashrsi3_16-ashrsi3_table | 
 | 93 | 	.byte		ashrsi3_17-ashrsi3_table | 
 | 94 | 	.byte		ashrsi3_18-ashrsi3_table | 
 | 95 | 	.byte		ashrsi3_19-ashrsi3_table | 
 | 96 | 	.byte		ashrsi3_20-ashrsi3_table | 
 | 97 | 	.byte		ashrsi3_21-ashrsi3_table | 
 | 98 | 	.byte		ashrsi3_22-ashrsi3_table | 
 | 99 | 	.byte		ashrsi3_23-ashrsi3_table | 
 | 100 | 	.byte		ashrsi3_24-ashrsi3_table | 
 | 101 | 	.byte		ashrsi3_25-ashrsi3_table | 
 | 102 | 	.byte		ashrsi3_26-ashrsi3_table | 
 | 103 | 	.byte		ashrsi3_27-ashrsi3_table | 
 | 104 | 	.byte		ashrsi3_28-ashrsi3_table | 
 | 105 | 	.byte		ashrsi3_29-ashrsi3_table | 
 | 106 | 	.byte		ashrsi3_30-ashrsi3_table | 
 | 107 | 	.byte		ashrsi3_31-ashrsi3_table | 
 | 108 |  | 
 | 109 | ashrsi3_31: | 
 | 110 | 	rotcl	r0 | 
 | 111 | 	rts | 
 | 112 | 	subc	r0,r0 | 
 | 113 |  | 
 | 114 | ashrsi3_30: | 
 | 115 | 	shar	r0 | 
 | 116 | ashrsi3_29: | 
 | 117 | 	shar	r0 | 
 | 118 | ashrsi3_28: | 
 | 119 | 	shar	r0 | 
 | 120 | ashrsi3_27: | 
 | 121 | 	shar	r0 | 
 | 122 | ashrsi3_26: | 
 | 123 | 	shar	r0 | 
 | 124 | ashrsi3_25: | 
 | 125 | 	shar	r0 | 
 | 126 | ashrsi3_24: | 
 | 127 | 	shlr16	r0 | 
 | 128 | 	shlr8	r0 | 
 | 129 | 	rts | 
 | 130 | 	exts.b	r0,r0 | 
 | 131 |  | 
 | 132 | ashrsi3_23: | 
 | 133 | 	shar	r0 | 
 | 134 | ashrsi3_22: | 
 | 135 | 	shar	r0 | 
 | 136 | ashrsi3_21: | 
 | 137 | 	shar	r0 | 
 | 138 | ashrsi3_20: | 
 | 139 | 	shar	r0 | 
 | 140 | ashrsi3_19: | 
 | 141 | 	shar	r0 | 
 | 142 | ashrsi3_18: | 
 | 143 | 	shar	r0 | 
 | 144 | ashrsi3_17: | 
 | 145 | 	shar	r0 | 
 | 146 | ashrsi3_16: | 
 | 147 | 	shlr16	r0 | 
 | 148 | 	rts | 
 | 149 | 	exts.w	r0,r0 | 
 | 150 |  | 
 | 151 | ashrsi3_15: | 
 | 152 | 	shar	r0 | 
 | 153 | ashrsi3_14: | 
 | 154 | 	shar	r0 | 
 | 155 | ashrsi3_13: | 
 | 156 | 	shar	r0 | 
 | 157 | ashrsi3_12: | 
 | 158 | 	shar	r0 | 
 | 159 | ashrsi3_11: | 
 | 160 | 	shar	r0 | 
 | 161 | ashrsi3_10: | 
 | 162 | 	shar	r0 | 
 | 163 | ashrsi3_9: | 
 | 164 | 	shar	r0 | 
 | 165 | ashrsi3_8: | 
 | 166 | 	shar	r0 | 
 | 167 | ashrsi3_7: | 
 | 168 | 	shar	r0 | 
 | 169 | ashrsi3_6: | 
 | 170 | 	shar	r0 | 
 | 171 | ashrsi3_5: | 
 | 172 | 	shar	r0 | 
 | 173 | ashrsi3_4: | 
 | 174 | 	shar	r0 | 
 | 175 | ashrsi3_3: | 
 | 176 | 	shar	r0 | 
 | 177 | ashrsi3_2: | 
 | 178 | 	shar	r0 | 
 | 179 | ashrsi3_1: | 
 | 180 | 	rts | 
 | 181 | 	shar	r0 | 
 | 182 |  | 
 | 183 | ashrsi3_0: | 
 | 184 | 	rts | 
 | 185 | 	nop |