Phil Edworthy | 8e5ab4b | 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 | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
Phil Edworthy | 8e5ab4b | 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 | ! GLOBAL(ashlsi3) |
| 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 __ashlsi3 |
| 37 | .align 2 |
| 38 | __ashlsi3: |
| 39 | mov #31,r0 |
| 40 | and r0,r5 |
| 41 | mova __ashlsi3_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 | __ashlsi3_table: |
| 53 | .byte __ashlsi3_0-__ashlsi3_table |
| 54 | .byte __ashlsi3_1-__ashlsi3_table |
| 55 | .byte __ashlsi3_2-__ashlsi3_table |
| 56 | .byte __ashlsi3_3-__ashlsi3_table |
| 57 | .byte __ashlsi3_4-__ashlsi3_table |
| 58 | .byte __ashlsi3_5-__ashlsi3_table |
| 59 | .byte __ashlsi3_6-__ashlsi3_table |
| 60 | .byte __ashlsi3_7-__ashlsi3_table |
| 61 | .byte __ashlsi3_8-__ashlsi3_table |
| 62 | .byte __ashlsi3_9-__ashlsi3_table |
| 63 | .byte __ashlsi3_10-__ashlsi3_table |
| 64 | .byte __ashlsi3_11-__ashlsi3_table |
| 65 | .byte __ashlsi3_12-__ashlsi3_table |
| 66 | .byte __ashlsi3_13-__ashlsi3_table |
| 67 | .byte __ashlsi3_14-__ashlsi3_table |
| 68 | .byte __ashlsi3_15-__ashlsi3_table |
| 69 | .byte __ashlsi3_16-__ashlsi3_table |
| 70 | .byte __ashlsi3_17-__ashlsi3_table |
| 71 | .byte __ashlsi3_18-__ashlsi3_table |
| 72 | .byte __ashlsi3_19-__ashlsi3_table |
| 73 | .byte __ashlsi3_20-__ashlsi3_table |
| 74 | .byte __ashlsi3_21-__ashlsi3_table |
| 75 | .byte __ashlsi3_22-__ashlsi3_table |
| 76 | .byte __ashlsi3_23-__ashlsi3_table |
| 77 | .byte __ashlsi3_24-__ashlsi3_table |
| 78 | .byte __ashlsi3_25-__ashlsi3_table |
| 79 | .byte __ashlsi3_26-__ashlsi3_table |
| 80 | .byte __ashlsi3_27-__ashlsi3_table |
| 81 | .byte __ashlsi3_28-__ashlsi3_table |
| 82 | .byte __ashlsi3_29-__ashlsi3_table |
| 83 | .byte __ashlsi3_30-__ashlsi3_table |
| 84 | .byte __ashlsi3_31-__ashlsi3_table |
| 85 | |
| 86 | __ashlsi3_6: |
| 87 | shll2 r0 |
| 88 | __ashlsi3_4: |
| 89 | shll2 r0 |
| 90 | __ashlsi3_2: |
| 91 | rts |
| 92 | shll2 r0 |
| 93 | |
| 94 | __ashlsi3_7: |
| 95 | shll2 r0 |
| 96 | __ashlsi3_5: |
| 97 | shll2 r0 |
| 98 | __ashlsi3_3: |
| 99 | shll2 r0 |
| 100 | __ashlsi3_1: |
| 101 | rts |
| 102 | shll r0 |
| 103 | |
| 104 | __ashlsi3_14: |
| 105 | shll2 r0 |
| 106 | __ashlsi3_12: |
| 107 | shll2 r0 |
| 108 | __ashlsi3_10: |
| 109 | shll2 r0 |
| 110 | __ashlsi3_8: |
| 111 | rts |
| 112 | shll8 r0 |
| 113 | |
| 114 | __ashlsi3_15: |
| 115 | shll2 r0 |
| 116 | __ashlsi3_13: |
| 117 | shll2 r0 |
| 118 | __ashlsi3_11: |
| 119 | shll2 r0 |
| 120 | __ashlsi3_9: |
| 121 | shll8 r0 |
| 122 | rts |
| 123 | shll r0 |
| 124 | |
| 125 | __ashlsi3_22: |
| 126 | shll2 r0 |
| 127 | __ashlsi3_20: |
| 128 | shll2 r0 |
| 129 | __ashlsi3_18: |
| 130 | shll2 r0 |
| 131 | __ashlsi3_16: |
| 132 | rts |
| 133 | shll16 r0 |
| 134 | |
| 135 | __ashlsi3_23: |
| 136 | shll2 r0 |
| 137 | __ashlsi3_21: |
| 138 | shll2 r0 |
| 139 | __ashlsi3_19: |
| 140 | shll2 r0 |
| 141 | __ashlsi3_17: |
| 142 | shll16 r0 |
| 143 | rts |
| 144 | shll r0 |
| 145 | |
| 146 | __ashlsi3_30: |
| 147 | shll2 r0 |
| 148 | __ashlsi3_28: |
| 149 | shll2 r0 |
| 150 | __ashlsi3_26: |
| 151 | shll2 r0 |
| 152 | __ashlsi3_24: |
| 153 | shll16 r0 |
| 154 | rts |
| 155 | shll8 r0 |
| 156 | |
| 157 | __ashlsi3_31: |
| 158 | shll2 r0 |
| 159 | __ashlsi3_29: |
| 160 | shll2 r0 |
| 161 | __ashlsi3_27: |
| 162 | shll2 r0 |
| 163 | __ashlsi3_25: |
| 164 | shll16 r0 |
| 165 | shll8 r0 |
| 166 | rts |
| 167 | shll r0 |
| 168 | |
| 169 | __ashlsi3_0: |
| 170 | rts |
| 171 | nop |