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 | ! __ashlsi3 |
| 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 __ashlsi3 |
| 58 | |
| 59 | .align 2 |
| 60 | __ashlsi3: |
| 61 | mov #31,r0 |
| 62 | and r0,r5 |
| 63 | mova ashlsi3_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 | ashlsi3_table: |
| 75 | .byte ashlsi3_0-ashlsi3_table |
| 76 | .byte ashlsi3_1-ashlsi3_table |
| 77 | .byte ashlsi3_2-ashlsi3_table |
| 78 | .byte ashlsi3_3-ashlsi3_table |
| 79 | .byte ashlsi3_4-ashlsi3_table |
| 80 | .byte ashlsi3_5-ashlsi3_table |
| 81 | .byte ashlsi3_6-ashlsi3_table |
| 82 | .byte ashlsi3_7-ashlsi3_table |
| 83 | .byte ashlsi3_8-ashlsi3_table |
| 84 | .byte ashlsi3_9-ashlsi3_table |
| 85 | .byte ashlsi3_10-ashlsi3_table |
| 86 | .byte ashlsi3_11-ashlsi3_table |
| 87 | .byte ashlsi3_12-ashlsi3_table |
| 88 | .byte ashlsi3_13-ashlsi3_table |
| 89 | .byte ashlsi3_14-ashlsi3_table |
| 90 | .byte ashlsi3_15-ashlsi3_table |
| 91 | .byte ashlsi3_16-ashlsi3_table |
| 92 | .byte ashlsi3_17-ashlsi3_table |
| 93 | .byte ashlsi3_18-ashlsi3_table |
| 94 | .byte ashlsi3_19-ashlsi3_table |
| 95 | .byte ashlsi3_20-ashlsi3_table |
| 96 | .byte ashlsi3_21-ashlsi3_table |
| 97 | .byte ashlsi3_22-ashlsi3_table |
| 98 | .byte ashlsi3_23-ashlsi3_table |
| 99 | .byte ashlsi3_24-ashlsi3_table |
| 100 | .byte ashlsi3_25-ashlsi3_table |
| 101 | .byte ashlsi3_26-ashlsi3_table |
| 102 | .byte ashlsi3_27-ashlsi3_table |
| 103 | .byte ashlsi3_28-ashlsi3_table |
| 104 | .byte ashlsi3_29-ashlsi3_table |
| 105 | .byte ashlsi3_30-ashlsi3_table |
| 106 | .byte ashlsi3_31-ashlsi3_table |
| 107 | |
| 108 | ashlsi3_6: |
| 109 | shll2 r0 |
| 110 | ashlsi3_4: |
| 111 | shll2 r0 |
| 112 | ashlsi3_2: |
| 113 | rts |
| 114 | shll2 r0 |
| 115 | |
| 116 | ashlsi3_7: |
| 117 | shll2 r0 |
| 118 | ashlsi3_5: |
| 119 | shll2 r0 |
| 120 | ashlsi3_3: |
| 121 | shll2 r0 |
| 122 | ashlsi3_1: |
| 123 | rts |
| 124 | shll r0 |
| 125 | |
| 126 | ashlsi3_14: |
| 127 | shll2 r0 |
| 128 | ashlsi3_12: |
| 129 | shll2 r0 |
| 130 | ashlsi3_10: |
| 131 | shll2 r0 |
| 132 | ashlsi3_8: |
| 133 | rts |
| 134 | shll8 r0 |
| 135 | |
| 136 | ashlsi3_15: |
| 137 | shll2 r0 |
| 138 | ashlsi3_13: |
| 139 | shll2 r0 |
| 140 | ashlsi3_11: |
| 141 | shll2 r0 |
| 142 | ashlsi3_9: |
| 143 | shll8 r0 |
| 144 | rts |
| 145 | shll r0 |
| 146 | |
| 147 | ashlsi3_22: |
| 148 | shll2 r0 |
| 149 | ashlsi3_20: |
| 150 | shll2 r0 |
| 151 | ashlsi3_18: |
| 152 | shll2 r0 |
| 153 | ashlsi3_16: |
| 154 | rts |
| 155 | shll16 r0 |
| 156 | |
| 157 | ashlsi3_23: |
| 158 | shll2 r0 |
| 159 | ashlsi3_21: |
| 160 | shll2 r0 |
| 161 | ashlsi3_19: |
| 162 | shll2 r0 |
| 163 | ashlsi3_17: |
| 164 | shll16 r0 |
| 165 | rts |
| 166 | shll r0 |
| 167 | |
| 168 | ashlsi3_30: |
| 169 | shll2 r0 |
| 170 | ashlsi3_28: |
| 171 | shll2 r0 |
| 172 | ashlsi3_26: |
| 173 | shll2 r0 |
| 174 | ashlsi3_24: |
| 175 | shll16 r0 |
| 176 | rts |
| 177 | shll8 r0 |
| 178 | |
| 179 | ashlsi3_31: |
| 180 | shll2 r0 |
| 181 | ashlsi3_29: |
| 182 | shll2 r0 |
| 183 | ashlsi3_27: |
| 184 | shll2 r0 |
| 185 | ashlsi3_25: |
| 186 | shll16 r0 |
| 187 | shll8 r0 |
| 188 | rts |
| 189 | shll r0 |
| 190 | |
| 191 | ashlsi3_0: |
| 192 | rts |
| 193 | nop |