1 # _ashlsi3.S for Lattice Mico32 2 # Contributed by Jon Beniston <jon@beniston.com> and Richard Henderson. 3 # 4 # Copyright (C) 2009-2024 Free Software Foundation, Inc. 5 # 6 # This file is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License as published by the 8 # Free Software Foundation; either version 3, or (at your option) any 9 # later version. 10 # 11 # This file is distributed in the hope that it will be useful, but 12 # WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 # General Public License for more details. 15 # 16 # Under Section 7 of GPL version 3, you are granted additional 17 # permissions described in the GCC Runtime Library Exception, version 18 # 3.1, as published by the Free Software Foundation. 19 # 20 # You should have received a copy of the GNU General Public License and 21 # a copy of the GCC Runtime Library Exception along with this program; 22 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 # <http://www.gnu.org/licenses/>. 24 # 25 26 /* Arithmetic left shift. */ 27 28 .text 29 30 .global __ashlsi3 31 .type __ashlsi3,@function 32 33 .align 4 34 __ashlsi3: 35 /* Only use 5 LSBs, as that's all the h/w shifter uses. */ 36 andi r2, r2, 0x1f 37 /* Get address of offset into unrolled shift loop to jump to. */ 38 #ifdef __PIC__ 39 lw r3, (gp+got(__ashlsi3_0)) 40 #else 41 mvhi r3, hi(__ashlsi3_0) 42 ori r3, r3, lo(__ashlsi3_0) 43 #endif 44 add r2, r2, r2 45 add r2, r2, r2 46 sub r3, r3, r2 47 b r3 48 49 __ashlsi3_31: 50 add r1, r1, r1 51 __ashlsi3_30: 52 add r1, r1, r1 53 __ashlsi3_29: 54 add r1, r1, r1 55 __ashlsi3_28: 56 add r1, r1, r1 57 __ashlsi3_27: 58 add r1, r1, r1 59 __ashlsi3_26: 60 add r1, r1, r1 61 __ashlsi3_25: 62 add r1, r1, r1 63 __ashlsi3_24: 64 add r1, r1, r1 65 __ashlsi3_23: 66 add r1, r1, r1 67 __ashlsi3_22: 68 add r1, r1, r1 69 __ashlsi3_21: 70 add r1, r1, r1 71 __ashlsi3_20: 72 add r1, r1, r1 73 __ashlsi3_19: 74 add r1, r1, r1 75 __ashlsi3_18: 76 add r1, r1, r1 77 __ashlsi3_17: 78 add r1, r1, r1 79 __ashlsi3_16: 80 add r1, r1, r1 81 __ashlsi3_15: 82 add r1, r1, r1 83 __ashlsi3_14: 84 add r1, r1, r1 85 __ashlsi3_13: 86 add r1, r1, r1 87 __ashlsi3_12: 88 add r1, r1, r1 89 __ashlsi3_11: 90 add r1, r1, r1 91 __ashlsi3_10: 92 add r1, r1, r1 93 __ashlsi3_9: 94 add r1, r1, r1 95 __ashlsi3_8: 96 add r1, r1, r1 97 __ashlsi3_7: 98 add r1, r1, r1 99 __ashlsi3_6: 100 add r1, r1, r1 101 __ashlsi3_5: 102 add r1, r1, r1 103 __ashlsi3_4: 104 add r1, r1, r1 105 __ashlsi3_3: 106 add r1, r1, r1 107 __ashlsi3_2: 108 add r1, r1, r1 109 __ashlsi3_1: 110 add r1, r1, r1 111 __ashlsi3_0: 112 ret 113 114