Phil Edworthy | 6be2a53 | 2011-10-24 10:24:12 +0100 | [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 | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
Phil Edworthy | 6be2a53 | 2011-10-24 10:24:12 +0100 | [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 | ! __ashrsi3 |
| 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 | |
| 37 | .global __ashrsi3 |
Wolfgang Denk | b60c557 | 2011-12-19 12:03:40 +0100 | [diff] [blame] | 38 | |
Phil Edworthy | 6be2a53 | 2011-10-24 10:24:12 +0100 | [diff] [blame] | 39 | .align 2 |
| 40 | __ashrsi3: |
| 41 | mov #31,r0 |
| 42 | and r0,r5 |
| 43 | mova ashrsi3_table,r0 |
| 44 | mov.b @(r0,r5),r5 |
| 45 | #ifdef __sh1__ |
| 46 | add r5,r0 |
| 47 | jmp @r0 |
| 48 | #else |
| 49 | braf r5 |
| 50 | #endif |
| 51 | mov r4,r0 |
| 52 | |
| 53 | .align 2 |
| 54 | ashrsi3_table: |
| 55 | .byte ashrsi3_0-ashrsi3_table |
| 56 | .byte ashrsi3_1-ashrsi3_table |
| 57 | .byte ashrsi3_2-ashrsi3_table |
| 58 | .byte ashrsi3_3-ashrsi3_table |
| 59 | .byte ashrsi3_4-ashrsi3_table |
| 60 | .byte ashrsi3_5-ashrsi3_table |
| 61 | .byte ashrsi3_6-ashrsi3_table |
| 62 | .byte ashrsi3_7-ashrsi3_table |
| 63 | .byte ashrsi3_8-ashrsi3_table |
| 64 | .byte ashrsi3_9-ashrsi3_table |
| 65 | .byte ashrsi3_10-ashrsi3_table |
| 66 | .byte ashrsi3_11-ashrsi3_table |
| 67 | .byte ashrsi3_12-ashrsi3_table |
| 68 | .byte ashrsi3_13-ashrsi3_table |
| 69 | .byte ashrsi3_14-ashrsi3_table |
| 70 | .byte ashrsi3_15-ashrsi3_table |
| 71 | .byte ashrsi3_16-ashrsi3_table |
| 72 | .byte ashrsi3_17-ashrsi3_table |
| 73 | .byte ashrsi3_18-ashrsi3_table |
| 74 | .byte ashrsi3_19-ashrsi3_table |
| 75 | .byte ashrsi3_20-ashrsi3_table |
| 76 | .byte ashrsi3_21-ashrsi3_table |
| 77 | .byte ashrsi3_22-ashrsi3_table |
| 78 | .byte ashrsi3_23-ashrsi3_table |
| 79 | .byte ashrsi3_24-ashrsi3_table |
| 80 | .byte ashrsi3_25-ashrsi3_table |
| 81 | .byte ashrsi3_26-ashrsi3_table |
| 82 | .byte ashrsi3_27-ashrsi3_table |
| 83 | .byte ashrsi3_28-ashrsi3_table |
| 84 | .byte ashrsi3_29-ashrsi3_table |
| 85 | .byte ashrsi3_30-ashrsi3_table |
| 86 | .byte ashrsi3_31-ashrsi3_table |
| 87 | |
| 88 | ashrsi3_31: |
| 89 | rotcl r0 |
| 90 | rts |
| 91 | subc r0,r0 |
| 92 | |
| 93 | ashrsi3_30: |
| 94 | shar r0 |
| 95 | ashrsi3_29: |
| 96 | shar r0 |
| 97 | ashrsi3_28: |
| 98 | shar r0 |
| 99 | ashrsi3_27: |
| 100 | shar r0 |
| 101 | ashrsi3_26: |
| 102 | shar r0 |
| 103 | ashrsi3_25: |
| 104 | shar r0 |
| 105 | ashrsi3_24: |
| 106 | shlr16 r0 |
| 107 | shlr8 r0 |
| 108 | rts |
| 109 | exts.b r0,r0 |
| 110 | |
| 111 | ashrsi3_23: |
| 112 | shar r0 |
| 113 | ashrsi3_22: |
| 114 | shar r0 |
| 115 | ashrsi3_21: |
| 116 | shar r0 |
| 117 | ashrsi3_20: |
| 118 | shar r0 |
| 119 | ashrsi3_19: |
| 120 | shar r0 |
| 121 | ashrsi3_18: |
| 122 | shar r0 |
| 123 | ashrsi3_17: |
| 124 | shar r0 |
| 125 | ashrsi3_16: |
| 126 | shlr16 r0 |
| 127 | rts |
| 128 | exts.w r0,r0 |
| 129 | |
| 130 | ashrsi3_15: |
| 131 | shar r0 |
| 132 | ashrsi3_14: |
| 133 | shar r0 |
| 134 | ashrsi3_13: |
| 135 | shar r0 |
| 136 | ashrsi3_12: |
| 137 | shar r0 |
| 138 | ashrsi3_11: |
| 139 | shar r0 |
| 140 | ashrsi3_10: |
| 141 | shar r0 |
| 142 | ashrsi3_9: |
| 143 | shar r0 |
| 144 | ashrsi3_8: |
| 145 | shar r0 |
| 146 | ashrsi3_7: |
| 147 | shar r0 |
| 148 | ashrsi3_6: |
| 149 | shar r0 |
| 150 | ashrsi3_5: |
| 151 | shar r0 |
| 152 | ashrsi3_4: |
| 153 | shar r0 |
| 154 | ashrsi3_3: |
| 155 | shar r0 |
| 156 | ashrsi3_2: |
| 157 | shar r0 |
| 158 | ashrsi3_1: |
| 159 | rts |
| 160 | shar r0 |
| 161 | |
| 162 | ashrsi3_0: |
| 163 | rts |
| 164 | nop |