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 | ! __lshrsi3 |
| 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 | .global __lshrsi3 |
| 58 | |
| 59 | .align 2 |
| 60 | __lshrsi3: |
| 61 | mov #31,r0 |
| 62 | and r0,r5 |
| 63 | mova lshrsi3_table,r0 |
| 64 | mov.b @(r0,r5),r5 |
| 65 | #ifdef __sh1__ |
| 66 | add r5,r0 |
| 67 | jmp @r0 |
| 68 | #else |
| 69 | braf r5 |
| 70 | #endif |
| 71 | mov r4,r0 |
| 72 | |
| 73 | .align 2 |
| 74 | lshrsi3_table: |
| 75 | .byte lshrsi3_0-lshrsi3_table |
| 76 | .byte lshrsi3_1-lshrsi3_table |
| 77 | .byte lshrsi3_2-lshrsi3_table |
| 78 | .byte lshrsi3_3-lshrsi3_table |
| 79 | .byte lshrsi3_4-lshrsi3_table |
| 80 | .byte lshrsi3_5-lshrsi3_table |
| 81 | .byte lshrsi3_6-lshrsi3_table |
| 82 | .byte lshrsi3_7-lshrsi3_table |
| 83 | .byte lshrsi3_8-lshrsi3_table |
| 84 | .byte lshrsi3_9-lshrsi3_table |
| 85 | .byte lshrsi3_10-lshrsi3_table |
| 86 | .byte lshrsi3_11-lshrsi3_table |
| 87 | .byte lshrsi3_12-lshrsi3_table |
| 88 | .byte lshrsi3_13-lshrsi3_table |
| 89 | .byte lshrsi3_14-lshrsi3_table |
| 90 | .byte lshrsi3_15-lshrsi3_table |
| 91 | .byte lshrsi3_16-lshrsi3_table |
| 92 | .byte lshrsi3_17-lshrsi3_table |
| 93 | .byte lshrsi3_18-lshrsi3_table |
| 94 | .byte lshrsi3_19-lshrsi3_table |
| 95 | .byte lshrsi3_20-lshrsi3_table |
| 96 | .byte lshrsi3_21-lshrsi3_table |
| 97 | .byte lshrsi3_22-lshrsi3_table |
| 98 | .byte lshrsi3_23-lshrsi3_table |
| 99 | .byte lshrsi3_24-lshrsi3_table |
| 100 | .byte lshrsi3_25-lshrsi3_table |
| 101 | .byte lshrsi3_26-lshrsi3_table |
| 102 | .byte lshrsi3_27-lshrsi3_table |
| 103 | .byte lshrsi3_28-lshrsi3_table |
| 104 | .byte lshrsi3_29-lshrsi3_table |
| 105 | .byte lshrsi3_30-lshrsi3_table |
| 106 | .byte lshrsi3_31-lshrsi3_table |
| 107 | |
| 108 | lshrsi3_6: |
| 109 | shlr2 r0 |
| 110 | lshrsi3_4: |
| 111 | shlr2 r0 |
| 112 | lshrsi3_2: |
| 113 | rts |
| 114 | shlr2 r0 |
| 115 | |
| 116 | lshrsi3_7: |
| 117 | shlr2 r0 |
| 118 | lshrsi3_5: |
| 119 | shlr2 r0 |
| 120 | lshrsi3_3: |
| 121 | shlr2 r0 |
| 122 | lshrsi3_1: |
| 123 | rts |
| 124 | shlr r0 |
| 125 | |
| 126 | lshrsi3_14: |
| 127 | shlr2 r0 |
| 128 | lshrsi3_12: |
| 129 | shlr2 r0 |
| 130 | lshrsi3_10: |
| 131 | shlr2 r0 |
| 132 | lshrsi3_8: |
| 133 | rts |
| 134 | shlr8 r0 |
| 135 | |
| 136 | lshrsi3_15: |
| 137 | shlr2 r0 |
| 138 | lshrsi3_13: |
| 139 | shlr2 r0 |
| 140 | lshrsi3_11: |
| 141 | shlr2 r0 |
| 142 | lshrsi3_9: |
| 143 | shlr8 r0 |
| 144 | rts |
| 145 | shlr r0 |
| 146 | |
| 147 | lshrsi3_22: |
| 148 | shlr2 r0 |
| 149 | lshrsi3_20: |
| 150 | shlr2 r0 |
| 151 | lshrsi3_18: |
| 152 | shlr2 r0 |
| 153 | lshrsi3_16: |
| 154 | rts |
| 155 | shlr16 r0 |
| 156 | |
| 157 | lshrsi3_23: |
| 158 | shlr2 r0 |
| 159 | lshrsi3_21: |
| 160 | shlr2 r0 |
| 161 | lshrsi3_19: |
| 162 | shlr2 r0 |
| 163 | lshrsi3_17: |
| 164 | shlr16 r0 |
| 165 | rts |
| 166 | shlr r0 |
| 167 | |
| 168 | lshrsi3_30: |
| 169 | shlr2 r0 |
| 170 | lshrsi3_28: |
| 171 | shlr2 r0 |
| 172 | lshrsi3_26: |
| 173 | shlr2 r0 |
| 174 | lshrsi3_24: |
| 175 | shlr16 r0 |
| 176 | rts |
| 177 | shlr8 r0 |
| 178 | |
| 179 | lshrsi3_31: |
| 180 | shlr2 r0 |
| 181 | lshrsi3_29: |
| 182 | shlr2 r0 |
| 183 | lshrsi3_27: |
| 184 | shlr2 r0 |
| 185 | lshrsi3_25: |
| 186 | shlr16 r0 |
| 187 | shlr8 r0 |
| 188 | rts |
| 189 | shlr r0 |
| 190 | |
| 191 | lshrsi3_0: |
| 192 | rts |
| 193 | nop |