Home | History | Annotate | Download | only in lib
      1 /* SPDX-License-Identifier: GPL-2.0+ */
      2 /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
      3    2004, 2005, 2006
      4    Free Software Foundation, Inc.
      5  */
      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 (at) cygnus.com  */
     18 
     19 !
     20 ! GLOBAL(ashlsi3)
     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 	.global	__ashlsi3
     36 	.align	2
     37 __ashlsi3:
     38 	mov	#31,r0
     39 	and	r0,r5
     40 	mova	__ashlsi3_table,r0
     41 	mov.b	@(r0,r5),r5
     42 #ifdef __sh1__
     43 	add	r5,r0
     44 	jmp	@r0
     45 #else
     46 	braf	r5
     47 #endif
     48 	mov	r4,r0
     49 
     50 	.align	2
     51 __ashlsi3_table:
     52 	.byte		__ashlsi3_0-__ashlsi3_table
     53 	.byte		__ashlsi3_1-__ashlsi3_table
     54 	.byte		__ashlsi3_2-__ashlsi3_table
     55 	.byte		__ashlsi3_3-__ashlsi3_table
     56 	.byte		__ashlsi3_4-__ashlsi3_table
     57 	.byte		__ashlsi3_5-__ashlsi3_table
     58 	.byte		__ashlsi3_6-__ashlsi3_table
     59 	.byte		__ashlsi3_7-__ashlsi3_table
     60 	.byte		__ashlsi3_8-__ashlsi3_table
     61 	.byte		__ashlsi3_9-__ashlsi3_table
     62 	.byte		__ashlsi3_10-__ashlsi3_table
     63 	.byte		__ashlsi3_11-__ashlsi3_table
     64 	.byte		__ashlsi3_12-__ashlsi3_table
     65 	.byte		__ashlsi3_13-__ashlsi3_table
     66 	.byte		__ashlsi3_14-__ashlsi3_table
     67 	.byte		__ashlsi3_15-__ashlsi3_table
     68 	.byte		__ashlsi3_16-__ashlsi3_table
     69 	.byte		__ashlsi3_17-__ashlsi3_table
     70 	.byte		__ashlsi3_18-__ashlsi3_table
     71 	.byte		__ashlsi3_19-__ashlsi3_table
     72 	.byte		__ashlsi3_20-__ashlsi3_table
     73 	.byte		__ashlsi3_21-__ashlsi3_table
     74 	.byte		__ashlsi3_22-__ashlsi3_table
     75 	.byte		__ashlsi3_23-__ashlsi3_table
     76 	.byte		__ashlsi3_24-__ashlsi3_table
     77 	.byte		__ashlsi3_25-__ashlsi3_table
     78 	.byte		__ashlsi3_26-__ashlsi3_table
     79 	.byte		__ashlsi3_27-__ashlsi3_table
     80 	.byte		__ashlsi3_28-__ashlsi3_table
     81 	.byte		__ashlsi3_29-__ashlsi3_table
     82 	.byte		__ashlsi3_30-__ashlsi3_table
     83 	.byte		__ashlsi3_31-__ashlsi3_table
     84 
     85 __ashlsi3_6:
     86 	shll2	r0
     87 __ashlsi3_4:
     88 	shll2	r0
     89 __ashlsi3_2:
     90 	rts
     91 	shll2	r0
     92 
     93 __ashlsi3_7:
     94 	shll2	r0
     95 __ashlsi3_5:
     96 	shll2	r0
     97 __ashlsi3_3:
     98 	shll2	r0
     99 __ashlsi3_1:
    100 	rts
    101 	shll	r0
    102 
    103 __ashlsi3_14:
    104 	shll2	r0
    105 __ashlsi3_12:
    106 	shll2	r0
    107 __ashlsi3_10:
    108 	shll2	r0
    109 __ashlsi3_8:
    110 	rts
    111 	shll8	r0
    112 
    113 __ashlsi3_15:
    114 	shll2	r0
    115 __ashlsi3_13:
    116 	shll2	r0
    117 __ashlsi3_11:
    118 	shll2	r0
    119 __ashlsi3_9:
    120 	shll8	r0
    121 	rts
    122 	shll	r0
    123 
    124 __ashlsi3_22:
    125 	shll2	r0
    126 __ashlsi3_20:
    127 	shll2	r0
    128 __ashlsi3_18:
    129 	shll2	r0
    130 __ashlsi3_16:
    131 	rts
    132 	shll16	r0
    133 
    134 __ashlsi3_23:
    135 	shll2	r0
    136 __ashlsi3_21:
    137 	shll2	r0
    138 __ashlsi3_19:
    139 	shll2	r0
    140 __ashlsi3_17:
    141 	shll16	r0
    142 	rts
    143 	shll	r0
    144 
    145 __ashlsi3_30:
    146 	shll2	r0
    147 __ashlsi3_28:
    148 	shll2	r0
    149 __ashlsi3_26:
    150 	shll2	r0
    151 __ashlsi3_24:
    152 	shll16	r0
    153 	rts
    154 	shll8	r0
    155 
    156 __ashlsi3_31:
    157 	shll2	r0
    158 __ashlsi3_29:
    159 	shll2	r0
    160 __ashlsi3_27:
    161 	shll2	r0
    162 __ashlsi3_25:
    163 	shll16	r0
    164 	shll8	r0
    165 	rts
    166 	shll	r0
    167 
    168 __ashlsi3_0:
    169 	rts
    170 	nop
    171