Phil Edworthy | eeb84df | 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 | |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
Phil Edworthy | eeb84df | 2011-06-02 22:15:27 +0000 | [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 | ! |
| 36 | .global __lshrsi3 |
| 37 | .align 2 |
| 38 | __lshrsi3: |
| 39 | mov #31,r0 |
| 40 | and r0,r5 |
| 41 | mova __lshrsi3_table,r0 |
| 42 | mov.b @(r0,r5),r5 |
| 43 | #ifdef __sh1__ |
| 44 | add r5,r0 |
| 45 | jmp @r0 |
| 46 | #else |
| 47 | braf r5 |
| 48 | #endif |
| 49 | mov r4,r0 |
| 50 | |
| 51 | .align 2 |
| 52 | __lshrsi3_table: |
| 53 | .byte __lshrsi3_0-__lshrsi3_table |
| 54 | .byte __lshrsi3_1-__lshrsi3_table |
| 55 | .byte __lshrsi3_2-__lshrsi3_table |
| 56 | .byte __lshrsi3_3-__lshrsi3_table |
| 57 | .byte __lshrsi3_4-__lshrsi3_table |
| 58 | .byte __lshrsi3_5-__lshrsi3_table |
| 59 | .byte __lshrsi3_6-__lshrsi3_table |
| 60 | .byte __lshrsi3_7-__lshrsi3_table |
| 61 | .byte __lshrsi3_8-__lshrsi3_table |
| 62 | .byte __lshrsi3_9-__lshrsi3_table |
| 63 | .byte __lshrsi3_10-__lshrsi3_table |
| 64 | .byte __lshrsi3_11-__lshrsi3_table |
| 65 | .byte __lshrsi3_12-__lshrsi3_table |
| 66 | .byte __lshrsi3_13-__lshrsi3_table |
| 67 | .byte __lshrsi3_14-__lshrsi3_table |
| 68 | .byte __lshrsi3_15-__lshrsi3_table |
| 69 | .byte __lshrsi3_16-__lshrsi3_table |
| 70 | .byte __lshrsi3_17-__lshrsi3_table |
| 71 | .byte __lshrsi3_18-__lshrsi3_table |
| 72 | .byte __lshrsi3_19-__lshrsi3_table |
| 73 | .byte __lshrsi3_20-__lshrsi3_table |
| 74 | .byte __lshrsi3_21-__lshrsi3_table |
| 75 | .byte __lshrsi3_22-__lshrsi3_table |
| 76 | .byte __lshrsi3_23-__lshrsi3_table |
| 77 | .byte __lshrsi3_24-__lshrsi3_table |
| 78 | .byte __lshrsi3_25-__lshrsi3_table |
| 79 | .byte __lshrsi3_26-__lshrsi3_table |
| 80 | .byte __lshrsi3_27-__lshrsi3_table |
| 81 | .byte __lshrsi3_28-__lshrsi3_table |
| 82 | .byte __lshrsi3_29-__lshrsi3_table |
| 83 | .byte __lshrsi3_30-__lshrsi3_table |
| 84 | .byte __lshrsi3_31-__lshrsi3_table |
| 85 | |
| 86 | __lshrsi3_6: |
| 87 | shlr2 r0 |
| 88 | __lshrsi3_4: |
| 89 | shlr2 r0 |
| 90 | __lshrsi3_2: |
| 91 | rts |
| 92 | shlr2 r0 |
| 93 | |
| 94 | __lshrsi3_7: |
| 95 | shlr2 r0 |
| 96 | __lshrsi3_5: |
| 97 | shlr2 r0 |
| 98 | __lshrsi3_3: |
| 99 | shlr2 r0 |
| 100 | __lshrsi3_1: |
| 101 | rts |
| 102 | shlr r0 |
| 103 | |
| 104 | __lshrsi3_14: |
| 105 | shlr2 r0 |
| 106 | __lshrsi3_12: |
| 107 | shlr2 r0 |
| 108 | __lshrsi3_10: |
| 109 | shlr2 r0 |
| 110 | __lshrsi3_8: |
| 111 | rts |
| 112 | shlr8 r0 |
| 113 | |
| 114 | __lshrsi3_15: |
| 115 | shlr2 r0 |
| 116 | __lshrsi3_13: |
| 117 | shlr2 r0 |
| 118 | __lshrsi3_11: |
| 119 | shlr2 r0 |
| 120 | __lshrsi3_9: |
| 121 | shlr8 r0 |
| 122 | rts |
| 123 | shlr r0 |
| 124 | |
| 125 | __lshrsi3_22: |
| 126 | shlr2 r0 |
| 127 | __lshrsi3_20: |
| 128 | shlr2 r0 |
| 129 | __lshrsi3_18: |
| 130 | shlr2 r0 |
| 131 | __lshrsi3_16: |
| 132 | rts |
| 133 | shlr16 r0 |
| 134 | |
| 135 | __lshrsi3_23: |
| 136 | shlr2 r0 |
| 137 | __lshrsi3_21: |
| 138 | shlr2 r0 |
| 139 | __lshrsi3_19: |
| 140 | shlr2 r0 |
| 141 | __lshrsi3_17: |
| 142 | shlr16 r0 |
| 143 | rts |
| 144 | shlr r0 |
| 145 | |
| 146 | __lshrsi3_30: |
| 147 | shlr2 r0 |
| 148 | __lshrsi3_28: |
| 149 | shlr2 r0 |
| 150 | __lshrsi3_26: |
| 151 | shlr2 r0 |
| 152 | __lshrsi3_24: |
| 153 | shlr16 r0 |
| 154 | rts |
| 155 | shlr8 r0 |
| 156 | |
| 157 | __lshrsi3_31: |
| 158 | shlr2 r0 |
| 159 | __lshrsi3_29: |
| 160 | shlr2 r0 |
| 161 | __lshrsi3_27: |
| 162 | shlr2 r0 |
| 163 | __lshrsi3_25: |
| 164 | shlr16 r0 |
| 165 | shlr8 r0 |
| 166 | rts |
| 167 | shlr r0 |
| 168 | |
| 169 | __lshrsi3_0: |
| 170 | rts |
| 171 | nop |