Phil Edworthy | 8e5ab4b | 2011-06-02 22:15:27 +0000 | [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 | ! GLOBAL(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 | .align 2 |
| 59 | __ashlsi3: |
| 60 | mov #31,r0 |
| 61 | and r0,r5 |
| 62 | mova __ashlsi3_table,r0 |
| 63 | mov.b @(r0,r5),r5 |
| 64 | #ifdef __sh1__ |
| 65 | add r5,r0 |
| 66 | jmp @r0 |
| 67 | #else |
| 68 | braf r5 |
| 69 | #endif |
| 70 | mov r4,r0 |
| 71 | |
| 72 | .align 2 |
| 73 | __ashlsi3_table: |
| 74 | .byte __ashlsi3_0-__ashlsi3_table |
| 75 | .byte __ashlsi3_1-__ashlsi3_table |
| 76 | .byte __ashlsi3_2-__ashlsi3_table |
| 77 | .byte __ashlsi3_3-__ashlsi3_table |
| 78 | .byte __ashlsi3_4-__ashlsi3_table |
| 79 | .byte __ashlsi3_5-__ashlsi3_table |
| 80 | .byte __ashlsi3_6-__ashlsi3_table |
| 81 | .byte __ashlsi3_7-__ashlsi3_table |
| 82 | .byte __ashlsi3_8-__ashlsi3_table |
| 83 | .byte __ashlsi3_9-__ashlsi3_table |
| 84 | .byte __ashlsi3_10-__ashlsi3_table |
| 85 | .byte __ashlsi3_11-__ashlsi3_table |
| 86 | .byte __ashlsi3_12-__ashlsi3_table |
| 87 | .byte __ashlsi3_13-__ashlsi3_table |
| 88 | .byte __ashlsi3_14-__ashlsi3_table |
| 89 | .byte __ashlsi3_15-__ashlsi3_table |
| 90 | .byte __ashlsi3_16-__ashlsi3_table |
| 91 | .byte __ashlsi3_17-__ashlsi3_table |
| 92 | .byte __ashlsi3_18-__ashlsi3_table |
| 93 | .byte __ashlsi3_19-__ashlsi3_table |
| 94 | .byte __ashlsi3_20-__ashlsi3_table |
| 95 | .byte __ashlsi3_21-__ashlsi3_table |
| 96 | .byte __ashlsi3_22-__ashlsi3_table |
| 97 | .byte __ashlsi3_23-__ashlsi3_table |
| 98 | .byte __ashlsi3_24-__ashlsi3_table |
| 99 | .byte __ashlsi3_25-__ashlsi3_table |
| 100 | .byte __ashlsi3_26-__ashlsi3_table |
| 101 | .byte __ashlsi3_27-__ashlsi3_table |
| 102 | .byte __ashlsi3_28-__ashlsi3_table |
| 103 | .byte __ashlsi3_29-__ashlsi3_table |
| 104 | .byte __ashlsi3_30-__ashlsi3_table |
| 105 | .byte __ashlsi3_31-__ashlsi3_table |
| 106 | |
| 107 | __ashlsi3_6: |
| 108 | shll2 r0 |
| 109 | __ashlsi3_4: |
| 110 | shll2 r0 |
| 111 | __ashlsi3_2: |
| 112 | rts |
| 113 | shll2 r0 |
| 114 | |
| 115 | __ashlsi3_7: |
| 116 | shll2 r0 |
| 117 | __ashlsi3_5: |
| 118 | shll2 r0 |
| 119 | __ashlsi3_3: |
| 120 | shll2 r0 |
| 121 | __ashlsi3_1: |
| 122 | rts |
| 123 | shll r0 |
| 124 | |
| 125 | __ashlsi3_14: |
| 126 | shll2 r0 |
| 127 | __ashlsi3_12: |
| 128 | shll2 r0 |
| 129 | __ashlsi3_10: |
| 130 | shll2 r0 |
| 131 | __ashlsi3_8: |
| 132 | rts |
| 133 | shll8 r0 |
| 134 | |
| 135 | __ashlsi3_15: |
| 136 | shll2 r0 |
| 137 | __ashlsi3_13: |
| 138 | shll2 r0 |
| 139 | __ashlsi3_11: |
| 140 | shll2 r0 |
| 141 | __ashlsi3_9: |
| 142 | shll8 r0 |
| 143 | rts |
| 144 | shll r0 |
| 145 | |
| 146 | __ashlsi3_22: |
| 147 | shll2 r0 |
| 148 | __ashlsi3_20: |
| 149 | shll2 r0 |
| 150 | __ashlsi3_18: |
| 151 | shll2 r0 |
| 152 | __ashlsi3_16: |
| 153 | rts |
| 154 | shll16 r0 |
| 155 | |
| 156 | __ashlsi3_23: |
| 157 | shll2 r0 |
| 158 | __ashlsi3_21: |
| 159 | shll2 r0 |
| 160 | __ashlsi3_19: |
| 161 | shll2 r0 |
| 162 | __ashlsi3_17: |
| 163 | shll16 r0 |
| 164 | rts |
| 165 | shll r0 |
| 166 | |
| 167 | __ashlsi3_30: |
| 168 | shll2 r0 |
| 169 | __ashlsi3_28: |
| 170 | shll2 r0 |
| 171 | __ashlsi3_26: |
| 172 | shll2 r0 |
| 173 | __ashlsi3_24: |
| 174 | shll16 r0 |
| 175 | rts |
| 176 | shll8 r0 |
| 177 | |
| 178 | __ashlsi3_31: |
| 179 | shll2 r0 |
| 180 | __ashlsi3_29: |
| 181 | shll2 r0 |
| 182 | __ashlsi3_27: |
| 183 | shll2 r0 |
| 184 | __ashlsi3_25: |
| 185 | shll16 r0 |
| 186 | shll8 r0 |
| 187 | rts |
| 188 | shll r0 |
| 189 | |
| 190 | __ashlsi3_0: |
| 191 | rts |
| 192 | nop |