Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Phil Edworthy | cb4046c | 2011-10-24 10:24:12 +0100 | [diff] [blame] | 2 | /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
| 3 | 2004, 2005, 2006 |
| 4 | Free Software Foundation, Inc. |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | */ |
Phil Edworthy | cb4046c | 2011-10-24 10:24:12 +0100 | [diff] [blame] | 6 | |
| 7 | !! libgcc routines for the Renesas / SuperH SH CPUs. |
| 8 | !! Contributed by Steve Chamberlain. |
| 9 | !! sac@cygnus.com |
| 10 | |
| 11 | !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines |
| 12 | !! recoded in assembly by Toshiyasu Morita |
| 13 | !! tm@netcom.com |
| 14 | |
| 15 | /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and |
| 16 | ELF local label prefixes by J"orn Rennecke |
| 17 | amylaar@cygnus.com */ |
| 18 | |
| 19 | ! |
| 20 | ! __ashrsi3 |
| 21 | ! |
| 22 | ! Entry: |
| 23 | ! |
| 24 | ! r4: Value to shift |
| 25 | ! r5: Shifts |
| 26 | ! |
| 27 | ! Exit: |
| 28 | ! |
| 29 | ! r0: Result |
| 30 | ! |
| 31 | ! Destroys: |
| 32 | ! |
| 33 | ! (none) |
| 34 | ! |
| 35 | |
| 36 | .global __ashrsi3 |
Wolfgang Denk | 6b62b9a | 2011-12-19 12:03:40 +0100 | [diff] [blame] | 37 | |
Phil Edworthy | cb4046c | 2011-10-24 10:24:12 +0100 | [diff] [blame] | 38 | .align 2 |
| 39 | __ashrsi3: |
| 40 | mov #31,r0 |
| 41 | and r0,r5 |
| 42 | mova ashrsi3_table,r0 |
| 43 | mov.b @(r0,r5),r5 |
| 44 | #ifdef __sh1__ |
| 45 | add r5,r0 |
| 46 | jmp @r0 |
| 47 | #else |
| 48 | braf r5 |
| 49 | #endif |
| 50 | mov r4,r0 |
| 51 | |
| 52 | .align 2 |
| 53 | ashrsi3_table: |
| 54 | .byte ashrsi3_0-ashrsi3_table |
| 55 | .byte ashrsi3_1-ashrsi3_table |
| 56 | .byte ashrsi3_2-ashrsi3_table |
| 57 | .byte ashrsi3_3-ashrsi3_table |
| 58 | .byte ashrsi3_4-ashrsi3_table |
| 59 | .byte ashrsi3_5-ashrsi3_table |
| 60 | .byte ashrsi3_6-ashrsi3_table |
| 61 | .byte ashrsi3_7-ashrsi3_table |
| 62 | .byte ashrsi3_8-ashrsi3_table |
| 63 | .byte ashrsi3_9-ashrsi3_table |
| 64 | .byte ashrsi3_10-ashrsi3_table |
| 65 | .byte ashrsi3_11-ashrsi3_table |
| 66 | .byte ashrsi3_12-ashrsi3_table |
| 67 | .byte ashrsi3_13-ashrsi3_table |
| 68 | .byte ashrsi3_14-ashrsi3_table |
| 69 | .byte ashrsi3_15-ashrsi3_table |
| 70 | .byte ashrsi3_16-ashrsi3_table |
| 71 | .byte ashrsi3_17-ashrsi3_table |
| 72 | .byte ashrsi3_18-ashrsi3_table |
| 73 | .byte ashrsi3_19-ashrsi3_table |
| 74 | .byte ashrsi3_20-ashrsi3_table |
| 75 | .byte ashrsi3_21-ashrsi3_table |
| 76 | .byte ashrsi3_22-ashrsi3_table |
| 77 | .byte ashrsi3_23-ashrsi3_table |
| 78 | .byte ashrsi3_24-ashrsi3_table |
| 79 | .byte ashrsi3_25-ashrsi3_table |
| 80 | .byte ashrsi3_26-ashrsi3_table |
| 81 | .byte ashrsi3_27-ashrsi3_table |
| 82 | .byte ashrsi3_28-ashrsi3_table |
| 83 | .byte ashrsi3_29-ashrsi3_table |
| 84 | .byte ashrsi3_30-ashrsi3_table |
| 85 | .byte ashrsi3_31-ashrsi3_table |
| 86 | |
| 87 | ashrsi3_31: |
| 88 | rotcl r0 |
| 89 | rts |
| 90 | subc r0,r0 |
| 91 | |
| 92 | ashrsi3_30: |
| 93 | shar r0 |
| 94 | ashrsi3_29: |
| 95 | shar r0 |
| 96 | ashrsi3_28: |
| 97 | shar r0 |
| 98 | ashrsi3_27: |
| 99 | shar r0 |
| 100 | ashrsi3_26: |
| 101 | shar r0 |
| 102 | ashrsi3_25: |
| 103 | shar r0 |
| 104 | ashrsi3_24: |
| 105 | shlr16 r0 |
| 106 | shlr8 r0 |
| 107 | rts |
| 108 | exts.b r0,r0 |
| 109 | |
| 110 | ashrsi3_23: |
| 111 | shar r0 |
| 112 | ashrsi3_22: |
| 113 | shar r0 |
| 114 | ashrsi3_21: |
| 115 | shar r0 |
| 116 | ashrsi3_20: |
| 117 | shar r0 |
| 118 | ashrsi3_19: |
| 119 | shar r0 |
| 120 | ashrsi3_18: |
| 121 | shar r0 |
| 122 | ashrsi3_17: |
| 123 | shar r0 |
| 124 | ashrsi3_16: |
| 125 | shlr16 r0 |
| 126 | rts |
| 127 | exts.w r0,r0 |
| 128 | |
| 129 | ashrsi3_15: |
| 130 | shar r0 |
| 131 | ashrsi3_14: |
| 132 | shar r0 |
| 133 | ashrsi3_13: |
| 134 | shar r0 |
| 135 | ashrsi3_12: |
| 136 | shar r0 |
| 137 | ashrsi3_11: |
| 138 | shar r0 |
| 139 | ashrsi3_10: |
| 140 | shar r0 |
| 141 | ashrsi3_9: |
| 142 | shar r0 |
| 143 | ashrsi3_8: |
| 144 | shar r0 |
| 145 | ashrsi3_7: |
| 146 | shar r0 |
| 147 | ashrsi3_6: |
| 148 | shar r0 |
| 149 | ashrsi3_5: |
| 150 | shar r0 |
| 151 | ashrsi3_4: |
| 152 | shar r0 |
| 153 | ashrsi3_3: |
| 154 | shar r0 |
| 155 | ashrsi3_2: |
| 156 | shar r0 |
| 157 | ashrsi3_1: |
| 158 | rts |
| 159 | shar r0 |
| 160 | |
| 161 | ashrsi3_0: |
| 162 | rts |
| 163 | nop |