Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / arch / sh / lib / movmem.S
1 /* SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
2
3    Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4    2004, 2005, 2006
5    Free Software Foundation, Inc.
6 */
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         .text
21         .balign 4
22         .global __movmem
23         .global __movstr
24         .set __movstr, __movmem 
25         /* This would be a lot simpler if r6 contained the byte count
26            minus 64, and we wouldn't be called here for a byte count of 64.  */
27 __movmem:
28         sts.l   pr,@-r15
29         shll2   r6
30         bsr     __movmemSI52+2
31         mov.l   @(48,r5),r0
32         .balign 4
33 movmem_loop: /* Reached with rts */
34         mov.l   @(60,r5),r0
35         add     #-64,r6
36         mov.l   r0,@(60,r4)
37         tst     r6,r6
38         mov.l   @(56,r5),r0
39         bt      movmem_done
40         mov.l   r0,@(56,r4)
41         cmp/pl  r6
42         mov.l   @(52,r5),r0
43         add     #64,r5
44         mov.l   r0,@(52,r4)
45         add     #64,r4
46         bt      __movmemSI52
47 ! done all the large groups, do the remainder
48 ! jump to movmem+
49         mova    __movmemSI4+4,r0
50         add     r6,r0
51         jmp     @r0
52 movmem_done: ! share slot insn, works out aligned.
53         lds.l   @r15+,pr
54         mov.l   r0,@(56,r4)
55         mov.l   @(52,r5),r0
56         rts
57         mov.l   r0,@(52,r4)
58         .balign 4
59
60         .global __movmemSI64
61         .global __movstrSI64
62         .set    __movstrSI64, __movmemSI64
63 __movmemSI64:
64         mov.l   @(60,r5),r0
65         mov.l   r0,@(60,r4)
66         .global __movmemSI60
67         .global __movstrSI60
68         .set    __movstrSI60, __movmemSI60
69 __movmemSI60:
70         mov.l   @(56,r5),r0
71         mov.l   r0,@(56,r4)
72         .global __movmemSI56
73         .global __movstrSI56
74         .set    __movstrSI56, __movmemSI56
75 __movmemSI56:
76         mov.l   @(52,r5),r0
77         mov.l   r0,@(52,r4)
78         .global __movmemSI52
79         .global __movstrSI52
80         .set    __movstrSI52, __movmemSI52
81 __movmemSI52:
82         mov.l   @(48,r5),r0
83         mov.l   r0,@(48,r4)
84         .global __movmemSI48
85         .global __movstrSI48
86         .set    __movstrSI48, __movmemSI48
87 __movmemSI48:
88         mov.l   @(44,r5),r0
89         mov.l   r0,@(44,r4)
90         .global __movmemSI44
91         .global __movstrSI44
92         .set    __movstrSI44, __movmemSI44
93 __movmemSI44:
94         mov.l   @(40,r5),r0
95         mov.l   r0,@(40,r4)
96         .global __movmemSI40
97         .global __movstrSI40
98         .set    __movstrSI40, __movmemSI40
99 __movmemSI40:
100         mov.l   @(36,r5),r0
101         mov.l   r0,@(36,r4)
102         .global __movmemSI36
103         .global __movstrSI36
104         .set    __movstrSI36, __movmemSI36
105 __movmemSI36:
106         mov.l   @(32,r5),r0
107         mov.l   r0,@(32,r4)
108         .global __movmemSI32
109         .global __movstrSI32
110         .set    __movstrSI32, __movmemSI32
111 __movmemSI32:
112         mov.l   @(28,r5),r0
113         mov.l   r0,@(28,r4)
114         .global __movmemSI28
115         .global __movstrSI28
116         .set    __movstrSI28, __movmemSI28
117 __movmemSI28:
118         mov.l   @(24,r5),r0
119         mov.l   r0,@(24,r4)
120         .global __movmemSI24
121         .global __movstrSI24
122         .set    __movstrSI24, __movmemSI24
123 __movmemSI24:
124         mov.l   @(20,r5),r0
125         mov.l   r0,@(20,r4)
126         .global __movmemSI20
127         .global __movstrSI20
128         .set    __movstrSI20, __movmemSI20
129 __movmemSI20:
130         mov.l   @(16,r5),r0
131         mov.l   r0,@(16,r4)
132         .global __movmemSI16
133         .global __movstrSI16
134         .set    __movstrSI16, __movmemSI16
135 __movmemSI16:
136         mov.l   @(12,r5),r0
137         mov.l   r0,@(12,r4)
138         .global __movmemSI12
139         .global __movstrSI12
140         .set    __movstrSI12, __movmemSI12
141 __movmemSI12:
142         mov.l   @(8,r5),r0
143         mov.l   r0,@(8,r4)
144         .global __movmemSI8
145         .global __movstrSI8
146         .set    __movstrSI8, __movmemSI8
147 __movmemSI8:
148         mov.l   @(4,r5),r0
149         mov.l   r0,@(4,r4)
150         .global __movmemSI4
151         .global __movstrSI4
152         .set    __movstrSI4, __movmemSI4
153 __movmemSI4:
154         mov.l   @(0,r5),r0
155         rts
156         mov.l   r0,@(0,r4)
157
158         .global __movmem_i4_even
159         .global __movstr_i4_even
160         .set    __movstr_i4_even, __movmem_i4_even
161
162         .global __movmem_i4_odd
163         .global __movstr_i4_odd
164         .set    __movstr_i4_odd, __movmem_i4_odd
165
166         .global __movmemSI12_i4
167         .global __movstrSI12_i4
168         .set    __movstrSI12_i4, __movmemSI12_i4
169
170         .p2align        5
171 L_movmem_2mod4_end:
172         mov.l   r0,@(16,r4)
173         rts
174         mov.l   r1,@(20,r4)
175
176         .p2align        2
177
178 __movmem_i4_even:
179         mov.l   @r5+,r0
180         bra     L_movmem_start_even
181         mov.l   @r5+,r1
182
183 __movmem_i4_odd:
184         mov.l   @r5+,r1
185         add     #-4,r4
186         mov.l   @r5+,r2
187         mov.l   @r5+,r3
188         mov.l   r1,@(4,r4)
189         mov.l   r2,@(8,r4)
190
191 L_movmem_loop:
192         mov.l   r3,@(12,r4)
193         dt      r6
194         mov.l   @r5+,r0
195         bt/s    L_movmem_2mod4_end
196         mov.l   @r5+,r1
197         add     #16,r4
198 L_movmem_start_even:
199         mov.l   @r5+,r2
200         mov.l   @r5+,r3
201         mov.l   r0,@r4
202         dt      r6
203         mov.l   r1,@(4,r4)
204         bf/s    L_movmem_loop
205         mov.l   r2,@(8,r4)
206         rts
207         mov.l   r3,@(12,r4)
208
209         .p2align        4
210 __movmemSI12_i4:
211         mov.l   @r5,r0
212         mov.l   @(4,r5),r1
213         mov.l   @(8,r5),r2
214         mov.l   r0,@r4
215         mov.l   r1,@(4,r4)
216         rts
217         mov.l   r2,@(8,r4)