Kuninori Morimoto | 4494ce4 | 2018-12-28 00:32:28 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0 |
| 2 | |
| 3 | Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 4 | 2004, 2005, 2006 |
| 5 | Free Software Foundation, Inc. |
Kuninori Morimoto | 4494ce4 | 2018-12-28 00:32:28 -0800 | [diff] [blame] | 6 | */ |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 7 | |
| 8 | !! libgcc routines for the Renesas / SuperH SH CPUs. |
| 9 | !! Contributed by Steve Chamberlain. |
| 10 | !! sac@cygnus.com |
| 11 | |
| 12 | !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines |
| 13 | !! recoded in assembly by Toshiyasu Morita |
| 14 | !! tm@netcom.com |
| 15 | |
| 16 | /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and |
| 17 | ELF local label prefixes by J"orn Rennecke |
| 18 | amylaar@cygnus.com */ |
| 19 | |
| 20 | ! |
| 21 | ! __lshrsi3 |
| 22 | ! |
| 23 | ! Entry: |
| 24 | ! |
| 25 | ! r4: Value to shift |
| 26 | ! r5: Shifts |
| 27 | ! |
| 28 | ! Exit: |
| 29 | ! |
| 30 | ! r0: Result |
| 31 | ! |
| 32 | ! Destroys: |
| 33 | ! |
| 34 | ! (none) |
| 35 | ! |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 36 | ! __lshrsi3_r0 |
| 37 | ! |
| 38 | ! Entry: |
| 39 | ! |
| 40 | ! r0: Value to shift |
| 41 | ! r5: Shifts |
| 42 | ! |
| 43 | ! Exit: |
| 44 | ! |
| 45 | ! r0: Result |
| 46 | ! |
| 47 | ! Destroys: |
| 48 | ! |
| 49 | ! (none) |
| 50 | ! |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 51 | .global __lshrsi3 |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 52 | .global __lshrsi3_r0 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 53 | |
| 54 | .align 2 |
| 55 | __lshrsi3: |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 56 | mov r5,r0 |
| 57 | .align 2 |
| 58 | __lshrsi3_r0: |
| 59 | and #31,r0 |
| 60 | mov.l r4,@-r15 |
| 61 | mov r0,r4 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 62 | mova lshrsi3_table,r0 |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 63 | mov.b @(r0,r4),r4 |
| 64 | add r4,r0 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 65 | jmp @r0 |
Yoshinori Sato | 940d411 | 2015-06-20 14:02:19 +0900 | [diff] [blame] | 66 | mov.l @r15+,r0 |
Paul Mundt | 1aad54a | 2008-11-18 17:33:48 +0900 | [diff] [blame] | 67 | |
| 68 | .align 2 |
| 69 | lshrsi3_table: |
| 70 | .byte lshrsi3_0-lshrsi3_table |
| 71 | .byte lshrsi3_1-lshrsi3_table |
| 72 | .byte lshrsi3_2-lshrsi3_table |
| 73 | .byte lshrsi3_3-lshrsi3_table |
| 74 | .byte lshrsi3_4-lshrsi3_table |
| 75 | .byte lshrsi3_5-lshrsi3_table |
| 76 | .byte lshrsi3_6-lshrsi3_table |
| 77 | .byte lshrsi3_7-lshrsi3_table |
| 78 | .byte lshrsi3_8-lshrsi3_table |
| 79 | .byte lshrsi3_9-lshrsi3_table |
| 80 | .byte lshrsi3_10-lshrsi3_table |
| 81 | .byte lshrsi3_11-lshrsi3_table |
| 82 | .byte lshrsi3_12-lshrsi3_table |
| 83 | .byte lshrsi3_13-lshrsi3_table |
| 84 | .byte lshrsi3_14-lshrsi3_table |
| 85 | .byte lshrsi3_15-lshrsi3_table |
| 86 | .byte lshrsi3_16-lshrsi3_table |
| 87 | .byte lshrsi3_17-lshrsi3_table |
| 88 | .byte lshrsi3_18-lshrsi3_table |
| 89 | .byte lshrsi3_19-lshrsi3_table |
| 90 | .byte lshrsi3_20-lshrsi3_table |
| 91 | .byte lshrsi3_21-lshrsi3_table |
| 92 | .byte lshrsi3_22-lshrsi3_table |
| 93 | .byte lshrsi3_23-lshrsi3_table |
| 94 | .byte lshrsi3_24-lshrsi3_table |
| 95 | .byte lshrsi3_25-lshrsi3_table |
| 96 | .byte lshrsi3_26-lshrsi3_table |
| 97 | .byte lshrsi3_27-lshrsi3_table |
| 98 | .byte lshrsi3_28-lshrsi3_table |
| 99 | .byte lshrsi3_29-lshrsi3_table |
| 100 | .byte lshrsi3_30-lshrsi3_table |
| 101 | .byte lshrsi3_31-lshrsi3_table |
| 102 | |
| 103 | lshrsi3_6: |
| 104 | shlr2 r0 |
| 105 | lshrsi3_4: |
| 106 | shlr2 r0 |
| 107 | lshrsi3_2: |
| 108 | rts |
| 109 | shlr2 r0 |
| 110 | |
| 111 | lshrsi3_7: |
| 112 | shlr2 r0 |
| 113 | lshrsi3_5: |
| 114 | shlr2 r0 |
| 115 | lshrsi3_3: |
| 116 | shlr2 r0 |
| 117 | lshrsi3_1: |
| 118 | rts |
| 119 | shlr r0 |
| 120 | |
| 121 | lshrsi3_14: |
| 122 | shlr2 r0 |
| 123 | lshrsi3_12: |
| 124 | shlr2 r0 |
| 125 | lshrsi3_10: |
| 126 | shlr2 r0 |
| 127 | lshrsi3_8: |
| 128 | rts |
| 129 | shlr8 r0 |
| 130 | |
| 131 | lshrsi3_15: |
| 132 | shlr2 r0 |
| 133 | lshrsi3_13: |
| 134 | shlr2 r0 |
| 135 | lshrsi3_11: |
| 136 | shlr2 r0 |
| 137 | lshrsi3_9: |
| 138 | shlr8 r0 |
| 139 | rts |
| 140 | shlr r0 |
| 141 | |
| 142 | lshrsi3_22: |
| 143 | shlr2 r0 |
| 144 | lshrsi3_20: |
| 145 | shlr2 r0 |
| 146 | lshrsi3_18: |
| 147 | shlr2 r0 |
| 148 | lshrsi3_16: |
| 149 | rts |
| 150 | shlr16 r0 |
| 151 | |
| 152 | lshrsi3_23: |
| 153 | shlr2 r0 |
| 154 | lshrsi3_21: |
| 155 | shlr2 r0 |
| 156 | lshrsi3_19: |
| 157 | shlr2 r0 |
| 158 | lshrsi3_17: |
| 159 | shlr16 r0 |
| 160 | rts |
| 161 | shlr r0 |
| 162 | |
| 163 | lshrsi3_30: |
| 164 | shlr2 r0 |
| 165 | lshrsi3_28: |
| 166 | shlr2 r0 |
| 167 | lshrsi3_26: |
| 168 | shlr2 r0 |
| 169 | lshrsi3_24: |
| 170 | shlr16 r0 |
| 171 | rts |
| 172 | shlr8 r0 |
| 173 | |
| 174 | lshrsi3_31: |
| 175 | shlr2 r0 |
| 176 | lshrsi3_29: |
| 177 | shlr2 r0 |
| 178 | lshrsi3_27: |
| 179 | shlr2 r0 |
| 180 | lshrsi3_25: |
| 181 | shlr16 r0 |
| 182 | shlr8 r0 |
| 183 | rts |
| 184 | shlr r0 |
| 185 | |
| 186 | lshrsi3_0: |
| 187 | rts |
| 188 | nop |