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 | ! |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 57 | ! __lshrsi3_r0 |
| 58 | ! |
| 59 | ! Entry: |
| 60 | ! |
| 61 | ! r0: Value to shift |
| 62 | ! r5: Shifts |
| 63 | ! |
| 64 | ! Exit: |
| 65 | ! |
| 66 | ! r0: Result |
| 67 | ! |
| 68 | ! Destroys: |
| 69 | ! |
| 70 | ! (none) |
| 71 | ! |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 72 | .global __lshrsi3 |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 73 | .global __lshrsi3_r0 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 74 | |
| 75 | .align 2 |
| 76 | __lshrsi3: |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 77 | mov r5,r0 |
| 78 | .align 2 |
| 79 | __lshrsi3_r0: |
| 80 | and #31,r0 |
| 81 | mov.l r4,@-r15 |
| 82 | mov r0,r4 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 83 | mova lshrsi3_table,r0 |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 84 | mov.b @(r0,r4),r4 |
| 85 | add r4,r0 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 86 | jmp @r0 |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 87 | mov.l @r15+,r0 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 88 | |
| 89 | .align 2 |
| 90 | lshrsi3_table: |
| 91 | .byte lshrsi3_0-lshrsi3_table |
| 92 | .byte lshrsi3_1-lshrsi3_table |
| 93 | .byte lshrsi3_2-lshrsi3_table |
| 94 | .byte lshrsi3_3-lshrsi3_table |
| 95 | .byte lshrsi3_4-lshrsi3_table |
| 96 | .byte lshrsi3_5-lshrsi3_table |
| 97 | .byte lshrsi3_6-lshrsi3_table |
| 98 | .byte lshrsi3_7-lshrsi3_table |
| 99 | .byte lshrsi3_8-lshrsi3_table |
| 100 | .byte lshrsi3_9-lshrsi3_table |
| 101 | .byte lshrsi3_10-lshrsi3_table |
| 102 | .byte lshrsi3_11-lshrsi3_table |
| 103 | .byte lshrsi3_12-lshrsi3_table |
| 104 | .byte lshrsi3_13-lshrsi3_table |
| 105 | .byte lshrsi3_14-lshrsi3_table |
| 106 | .byte lshrsi3_15-lshrsi3_table |
| 107 | .byte lshrsi3_16-lshrsi3_table |
| 108 | .byte lshrsi3_17-lshrsi3_table |
| 109 | .byte lshrsi3_18-lshrsi3_table |
| 110 | .byte lshrsi3_19-lshrsi3_table |
| 111 | .byte lshrsi3_20-lshrsi3_table |
| 112 | .byte lshrsi3_21-lshrsi3_table |
| 113 | .byte lshrsi3_22-lshrsi3_table |
| 114 | .byte lshrsi3_23-lshrsi3_table |
| 115 | .byte lshrsi3_24-lshrsi3_table |
| 116 | .byte lshrsi3_25-lshrsi3_table |
| 117 | .byte lshrsi3_26-lshrsi3_table |
| 118 | .byte lshrsi3_27-lshrsi3_table |
| 119 | .byte lshrsi3_28-lshrsi3_table |
| 120 | .byte lshrsi3_29-lshrsi3_table |
| 121 | .byte lshrsi3_30-lshrsi3_table |
| 122 | .byte lshrsi3_31-lshrsi3_table |
| 123 | |
| 124 | lshrsi3_6: |
| 125 | shlr2 r0 |
| 126 | lshrsi3_4: |
| 127 | shlr2 r0 |
| 128 | lshrsi3_2: |
| 129 | rts |
| 130 | shlr2 r0 |
| 131 | |
| 132 | lshrsi3_7: |
| 133 | shlr2 r0 |
| 134 | lshrsi3_5: |
| 135 | shlr2 r0 |
| 136 | lshrsi3_3: |
| 137 | shlr2 r0 |
| 138 | lshrsi3_1: |
| 139 | rts |
| 140 | shlr r0 |
| 141 | |
| 142 | lshrsi3_14: |
| 143 | shlr2 r0 |
| 144 | lshrsi3_12: |
| 145 | shlr2 r0 |
| 146 | lshrsi3_10: |
| 147 | shlr2 r0 |
| 148 | lshrsi3_8: |
| 149 | rts |
| 150 | shlr8 r0 |
| 151 | |
| 152 | lshrsi3_15: |
| 153 | shlr2 r0 |
| 154 | lshrsi3_13: |
| 155 | shlr2 r0 |
| 156 | lshrsi3_11: |
| 157 | shlr2 r0 |
| 158 | lshrsi3_9: |
| 159 | shlr8 r0 |
| 160 | rts |
| 161 | shlr r0 |
| 162 | |
| 163 | lshrsi3_22: |
| 164 | shlr2 r0 |
| 165 | lshrsi3_20: |
| 166 | shlr2 r0 |
| 167 | lshrsi3_18: |
| 168 | shlr2 r0 |
| 169 | lshrsi3_16: |
| 170 | rts |
| 171 | shlr16 r0 |
| 172 | |
| 173 | lshrsi3_23: |
| 174 | shlr2 r0 |
| 175 | lshrsi3_21: |
| 176 | shlr2 r0 |
| 177 | lshrsi3_19: |
| 178 | shlr2 r0 |
| 179 | lshrsi3_17: |
| 180 | shlr16 r0 |
| 181 | rts |
| 182 | shlr r0 |
| 183 | |
| 184 | lshrsi3_30: |
| 185 | shlr2 r0 |
| 186 | lshrsi3_28: |
| 187 | shlr2 r0 |
| 188 | lshrsi3_26: |
| 189 | shlr2 r0 |
| 190 | lshrsi3_24: |
| 191 | shlr16 r0 |
| 192 | rts |
| 193 | shlr8 r0 |
| 194 | |
| 195 | lshrsi3_31: |
| 196 | shlr2 r0 |
| 197 | lshrsi3_29: |
| 198 | shlr2 r0 |
| 199 | lshrsi3_27: |
| 200 | shlr2 r0 |
| 201 | lshrsi3_25: |
| 202 | shlr16 r0 |
| 203 | shlr8 r0 |
| 204 | rts |
| 205 | shlr r0 |
| 206 | |
| 207 | lshrsi3_0: |
| 208 | rts |
| 209 | nop |