]>
Commit | Line | Data |
---|---|---|
ae6b8730 RH |
1 | /* Copy SIZE bytes from SRC to DEST. |
2 | For SPARC v7. | |
3 | Copyright (C) 1996, 1999 Free Software Foundation, Inc. | |
4 | This file is part of the GNU C Library. | |
5 | Contributed by David S. Miller <davem@caip.rutgers.edu>, | |
6 | Eddie C. Dost <ecd@skynet.be> and | |
7 | Jakub Jelinek <jj@ultra.linux.cz>. | |
8 | ||
9 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
10 | modify it under the terms of the GNU Lesser General Public |
11 | License as published by the Free Software Foundation; either | |
12 | version 2.1 of the License, or (at your option) any later version. | |
ae6b8730 RH |
13 | |
14 | The GNU C Library is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 17 | Lesser General Public License for more details. |
ae6b8730 | 18 | |
41bdb6e2 AJ |
19 | You should have received a copy of the GNU Lesser General Public |
20 | License along with the GNU C Library; if not, write to the Free | |
21 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
22 | 02111-1307 USA. */ | |
ae6b8730 RH |
23 | |
24 | #include <sysdep.h> | |
25 | ||
26 | /* Both these macros have to start with exactly the same insn */ | |
27 | #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \ | |
28 | ldd [%src + offset + 0x00], %t0; \ | |
29 | ldd [%src + offset + 0x08], %t2; \ | |
30 | ldd [%src + offset + 0x10], %t4; \ | |
31 | ldd [%src + offset + 0x18], %t6; \ | |
32 | st %t0, [%dst + offset + 0x00]; \ | |
33 | st %t1, [%dst + offset + 0x04]; \ | |
34 | st %t2, [%dst + offset + 0x08]; \ | |
35 | st %t3, [%dst + offset + 0x0c]; \ | |
36 | st %t4, [%dst + offset + 0x10]; \ | |
37 | st %t5, [%dst + offset + 0x14]; \ | |
38 | st %t6, [%dst + offset + 0x18]; \ | |
39 | st %t7, [%dst + offset + 0x1c]; | |
40 | ||
41 | #define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \ | |
42 | ldd [%src + offset + 0x00], %t0; \ | |
43 | ldd [%src + offset + 0x08], %t2; \ | |
44 | ldd [%src + offset + 0x10], %t4; \ | |
45 | ldd [%src + offset + 0x18], %t6; \ | |
46 | std %t0, [%dst + offset + 0x00]; \ | |
47 | std %t2, [%dst + offset + 0x08]; \ | |
48 | std %t4, [%dst + offset + 0x10]; \ | |
49 | std %t6, [%dst + offset + 0x18]; | |
50 | ||
51 | #define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \ | |
52 | ldd [%src - offset - 0x10], %t0; \ | |
53 | ldd [%src - offset - 0x08], %t2; \ | |
54 | st %t0, [%dst - offset - 0x10]; \ | |
55 | st %t1, [%dst - offset - 0x0c]; \ | |
56 | st %t2, [%dst - offset - 0x08]; \ | |
57 | st %t3, [%dst - offset - 0x04]; | |
58 | ||
59 | #define MOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \ | |
60 | ldd [%src - offset - 0x10], %t0; \ | |
61 | ldd [%src - offset - 0x08], %t2; \ | |
62 | std %t0, [%dst - offset - 0x10]; \ | |
63 | std %t2, [%dst - offset - 0x08]; | |
64 | ||
65 | #define MOVE_SHORTCHUNK(src, dst, offset, t0, t1) \ | |
66 | ldub [%src - offset - 0x02], %t0; \ | |
67 | ldub [%src - offset - 0x01], %t1; \ | |
68 | stb %t0, [%dst - offset - 0x02]; \ | |
69 | stb %t1, [%dst - offset - 0x01]; | |
70 | ||
71 | /* Both these macros have to start with exactly the same insn */ | |
72 | #define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \ | |
73 | ldd [%src - offset - 0x20], %t0; \ | |
74 | ldd [%src - offset - 0x18], %t2; \ | |
75 | ldd [%src - offset - 0x10], %t4; \ | |
76 | ldd [%src - offset - 0x08], %t6; \ | |
77 | st %t0, [%dst - offset - 0x20]; \ | |
78 | st %t1, [%dst - offset - 0x1c]; \ | |
79 | st %t2, [%dst - offset - 0x18]; \ | |
80 | st %t3, [%dst - offset - 0x14]; \ | |
81 | st %t4, [%dst - offset - 0x10]; \ | |
82 | st %t5, [%dst - offset - 0x0c]; \ | |
83 | st %t6, [%dst - offset - 0x08]; \ | |
84 | st %t7, [%dst - offset - 0x04]; | |
85 | ||
86 | #define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \ | |
87 | ldd [%src - offset - 0x20], %t0; \ | |
88 | ldd [%src - offset - 0x18], %t2; \ | |
89 | ldd [%src - offset - 0x10], %t4; \ | |
90 | ldd [%src - offset - 0x08], %t6; \ | |
91 | std %t0, [%dst - offset - 0x20]; \ | |
92 | std %t2, [%dst - offset - 0x18]; \ | |
93 | std %t4, [%dst - offset - 0x10]; \ | |
94 | std %t6, [%dst - offset - 0x08]; | |
95 | ||
96 | #define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \ | |
97 | ldd [%src + offset + 0x00], %t0; \ | |
98 | ldd [%src + offset + 0x08], %t2; \ | |
99 | st %t0, [%dst + offset + 0x00]; \ | |
100 | st %t1, [%dst + offset + 0x04]; \ | |
101 | st %t2, [%dst + offset + 0x08]; \ | |
102 | st %t3, [%dst + offset + 0x0c]; | |
103 | ||
104 | #define RMOVE_SHORTCHUNK(src, dst, offset, t0, t1) \ | |
105 | ldub [%src + offset + 0x00], %t0; \ | |
106 | ldub [%src + offset + 0x01], %t1; \ | |
107 | stb %t0, [%dst + offset + 0x00]; \ | |
108 | stb %t1, [%dst + offset + 0x01]; | |
109 | ||
110 | #define SMOVE_CHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, prev, shil, shir, offset2) \ | |
111 | ldd [%src + offset + 0x00], %t0; \ | |
112 | ldd [%src + offset + 0x08], %t2; \ | |
113 | srl %t0, shir, %t5; \ | |
114 | srl %t1, shir, %t6; \ | |
115 | sll %t0, shil, %t0; \ | |
116 | or %t5, %prev, %t5; \ | |
117 | sll %t1, shil, %prev; \ | |
118 | or %t6, %t0, %t0; \ | |
119 | srl %t2, shir, %t1; \ | |
120 | srl %t3, shir, %t6; \ | |
121 | sll %t2, shil, %t2; \ | |
122 | or %t1, %prev, %t1; \ | |
123 | std %t4, [%dst + offset + offset2 - 0x04]; \ | |
124 | std %t0, [%dst + offset + offset2 + 0x04]; \ | |
125 | sll %t3, shil, %prev; \ | |
126 | or %t6, %t2, %t4; | |
127 | ||
128 | #define SMOVE_ALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, prev, shil, shir, offset2) \ | |
129 | ldd [%src + offset + 0x00], %t0; \ | |
130 | ldd [%src + offset + 0x08], %t2; \ | |
131 | srl %t0, shir, %t4; \ | |
132 | srl %t1, shir, %t5; \ | |
133 | sll %t0, shil, %t6; \ | |
134 | or %t4, %prev, %t0; \ | |
135 | sll %t1, shil, %prev; \ | |
136 | or %t5, %t6, %t1; \ | |
137 | srl %t2, shir, %t4; \ | |
138 | srl %t3, shir, %t5; \ | |
139 | sll %t2, shil, %t6; \ | |
140 | or %t4, %prev, %t2; \ | |
141 | sll %t3, shil, %prev; \ | |
142 | or %t5, %t6, %t3; \ | |
143 | std %t0, [%dst + offset + offset2 + 0x00]; \ | |
144 | std %t2, [%dst + offset + offset2 + 0x08]; | |
145 | ||
146 | .text | |
147 | .align 4 | |
148 | ||
149 | 70: andcc %o1, 1, %g0 | |
150 | be 4f | |
151 | andcc %o1, 2, %g0 | |
152 | ||
153 | ldub [%o1 - 1], %g2 | |
154 | sub %o1, 1, %o1 | |
155 | stb %g2, [%o0 - 1] | |
156 | sub %o2, 1, %o2 | |
157 | be 3f | |
158 | sub %o0, 1, %o0 | |
159 | 4: lduh [%o1 - 2], %g2 | |
160 | sub %o1, 2, %o1 | |
161 | sth %g2, [%o0 - 2] | |
162 | sub %o2, 2, %o2 | |
163 | b 3f | |
164 | sub %o0, 2, %o0 | |
165 | ||
ae6b8730 RH |
166 | ENTRY(bcopy) |
167 | mov %o0, %o3 | |
168 | mov %o1, %o0 | |
169 | mov %o3, %o1 | |
ae6b8730 RH |
170 | END(bcopy) |
171 | ENTRY(memmove) | |
172 | cmp %o0, %o1 | |
173 | st %o0, [%sp + 64] | |
174 | bleu 9f | |
175 | sub %o0, %o1, %o4 | |
176 | ||
177 | add %o1, %o2, %o3 | |
178 | cmp %o3, %o0 | |
179 | bleu 0f | |
180 | andcc %o4, 3, %o5 | |
181 | ||
182 | add %o1, %o2, %o1 | |
183 | add %o0, %o2, %o0 | |
184 | bne 77f | |
185 | cmp %o2, 15 | |
186 | bleu 91f | |
187 | andcc %o1, 3, %g0 | |
188 | bne 70b | |
189 | 3: andcc %o1, 4, %g0 | |
190 | ||
191 | be 2f | |
192 | mov %o2, %g1 | |
193 | ||
194 | ld [%o1 - 4], %o4 | |
195 | sub %g1, 4, %g1 | |
196 | st %o4, [%o0 - 4] | |
197 | sub %o1, 4, %o1 | |
198 | sub %o0, 4, %o0 | |
199 | 2: andcc %g1, 0xffffff80, %g7 | |
200 | be 3f | |
201 | andcc %o0, 4, %g0 | |
202 | ||
203 | be 74f + 4 | |
204 | 5: RMOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5) | |
205 | RMOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5) | |
206 | RMOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5) | |
207 | RMOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5) | |
208 | subcc %g7, 128, %g7 | |
209 | sub %o1, 128, %o1 | |
210 | bne 5b | |
211 | sub %o0, 128, %o0 | |
212 | ||
213 | 3: andcc %g1, 0x70, %g7 | |
214 | be 72f | |
215 | andcc %g1, 8, %g0 | |
216 | ||
217 | srl %g7, 1, %o4 | |
218 | mov %o7, %g2 | |
219 | add %g7, %o4, %o4 | |
220 | 101: call 100f | |
221 | sub %o1, %g7, %o1 | |
222 | mov %g2, %o7 | |
223 | jmpl %o5 + (72f - 101b), %g0 | |
224 | sub %o0, %g7, %o0 | |
225 | ||
226 | 71: RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5) | |
227 | RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5) | |
228 | RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5) | |
229 | RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5) | |
230 | RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5) | |
231 | RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5) | |
232 | RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5) | |
233 | 72: be 73f | |
234 | andcc %g1, 4, %g0 | |
235 | ||
236 | ldd [%o1 - 0x08], %g2 | |
237 | sub %o0, 8, %o0 | |
238 | sub %o1, 8, %o1 | |
239 | st %g2, [%o0] | |
240 | st %g3, [%o0 + 0x04] | |
241 | 73: be 1f | |
242 | andcc %g1, 2, %g0 | |
243 | ||
244 | ld [%o1 - 4], %g2 | |
245 | sub %o1, 4, %o1 | |
246 | st %g2, [%o0 - 4] | |
247 | sub %o0, 4, %o0 | |
248 | 1: be 1f | |
249 | andcc %g1, 1, %g0 | |
250 | ||
251 | lduh [%o1 - 2], %g2 | |
252 | sub %o1, 2, %o1 | |
253 | sth %g2, [%o0 - 2] | |
254 | sub %o0, 2, %o0 | |
255 | 1: be 1f | |
256 | nop | |
257 | ||
258 | ldub [%o1 - 1], %g2 | |
259 | stb %g2, [%o0 - 1] | |
260 | 1: retl | |
261 | ld [%sp + 64], %o0 | |
262 | ||
263 | 74: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5) | |
264 | RMOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5) | |
265 | RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5) | |
266 | RMOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5) | |
267 | subcc %g7, 128, %g7 | |
268 | sub %o1, 128, %o1 | |
269 | bne 74b | |
270 | sub %o0, 128, %o0 | |
271 | ||
272 | andcc %g1, 0x70, %g7 | |
273 | be 72b | |
274 | andcc %g1, 8, %g0 | |
275 | ||
276 | srl %g7, 1, %o4 | |
277 | mov %o7, %g2 | |
278 | add %g7, %o4, %o4 | |
279 | 102: call 100f | |
280 | sub %o1, %g7, %o1 | |
281 | mov %g2, %o7 | |
282 | jmpl %o5 + (72b - 102b), %g0 | |
283 | sub %o0, %g7, %o0 | |
284 | ||
285 | 75: and %o2, 0xe, %o3 | |
286 | mov %o7, %g2 | |
287 | sll %o3, 3, %o4 | |
288 | sub %o0, %o3, %o0 | |
289 | 103: call 100f | |
290 | sub %o1, %o3, %o1 | |
291 | mov %g2, %o7 | |
292 | jmpl %o5 + (76f - 103b), %g0 | |
293 | andcc %o2, 1, %g0 | |
294 | ||
295 | RMOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3) | |
296 | RMOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3) | |
297 | RMOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3) | |
298 | RMOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3) | |
299 | RMOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3) | |
300 | RMOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3) | |
301 | RMOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3) | |
302 | ||
303 | 76: be 1f | |
304 | nop | |
305 | ldub [%o1 - 1], %g2 | |
306 | stb %g2, [%o0 - 1] | |
307 | 1: retl | |
308 | ld [%sp + 64], %o0 | |
309 | ||
310 | 91: bne 75b | |
311 | andcc %o2, 8, %g0 | |
312 | ||
313 | be 1f | |
314 | andcc %o2, 4, %g0 | |
315 | ||
316 | ld [%o1 - 0x08], %g2 | |
317 | ld [%o1 - 0x04], %g3 | |
318 | sub %o1, 8, %o1 | |
319 | st %g2, [%o0 - 0x08] | |
320 | st %g3, [%o0 - 0x04] | |
321 | sub %o0, 8, %o0 | |
322 | 1: b 73b | |
323 | mov %o2, %g1 | |
324 | ||
325 | 77: cmp %o2, 15 | |
326 | bleu 75b | |
327 | andcc %o0, 3, %g0 | |
328 | be 64f | |
329 | andcc %o0, 1, %g0 | |
330 | be 63f | |
331 | andcc %o0, 2, %g0 | |
332 | ldub [%o1 - 1], %g5 | |
333 | sub %o1, 1, %o1 | |
334 | stb %g5, [%o0 - 1] | |
335 | sub %o0, 1, %o0 | |
336 | be 64f | |
337 | sub %o2, 1, %o2 | |
338 | ||
339 | 63: ldub [%o1 - 1], %g5 | |
340 | sub %o1, 2, %o1 | |
341 | stb %g5, [%o0 - 1] | |
342 | sub %o0, 2, %o0 | |
343 | ldub [%o1], %g5 | |
344 | sub %o2, 2, %o2 | |
345 | stb %g5, [%o0] | |
346 | 64: and %o1, 3, %g2 | |
347 | and %o1, -4, %o1 | |
348 | and %o2, 0xc, %g3 | |
349 | add %o1, 4, %o1 | |
350 | cmp %g3, 4 | |
351 | sll %g2, 3, %g4 | |
352 | mov 32, %g2 | |
353 | be 4f | |
354 | sub %g2, %g4, %g7 | |
355 | ||
356 | blu 3f | |
357 | cmp %g3, 8 | |
358 | ||
359 | be 2f | |
360 | srl %o2, 2, %g3 | |
361 | ||
362 | ld [%o1 - 4], %o3 | |
363 | add %o0, -8, %o0 | |
364 | ld [%o1 - 8], %o4 | |
365 | add %o1, -16, %o1 | |
366 | b 7f | |
367 | add %g3, 1, %g3 | |
368 | 2: ld [%o1 - 4], %o4 | |
369 | add %o0, -4, %o0 | |
370 | ld [%o1 - 8], %g1 | |
371 | add %o1, -12, %o1 | |
372 | b 8f | |
373 | add %g3, 2, %g3 | |
374 | 3: ld [%o1 - 4], %o5 | |
375 | add %o0, -12, %o0 | |
376 | ld [%o1 - 8], %o3 | |
377 | add %o1, -20, %o1 | |
378 | b 6f | |
379 | srl %o2, 2, %g3 | |
380 | 4: ld [%o1 - 4], %g1 | |
381 | srl %o2, 2, %g3 | |
382 | ld [%o1 - 8], %o5 | |
383 | add %o1, -24, %o1 | |
384 | add %o0, -16, %o0 | |
385 | add %g3, -1, %g3 | |
386 | ||
387 | ld [%o1 + 12], %o3 | |
388 | 5: sll %o5, %g4, %g2 | |
389 | srl %g1, %g7, %g5 | |
390 | or %g2, %g5, %g2 | |
391 | st %g2, [%o0 + 12] | |
392 | 6: ld [%o1 + 8], %o4 | |
393 | sll %o3, %g4, %g2 | |
394 | srl %o5, %g7, %g5 | |
395 | or %g2, %g5, %g2 | |
396 | st %g2, [%o0 + 8] | |
397 | 7: ld [%o1 + 4], %g1 | |
398 | sll %o4, %g4, %g2 | |
399 | srl %o3, %g7, %g5 | |
400 | or %g2, %g5, %g2 | |
401 | st %g2, [%o0 + 4] | |
402 | 8: ld [%o1], %o5 | |
403 | sll %g1, %g4, %g2 | |
404 | srl %o4, %g7, %g5 | |
405 | addcc %g3, -4, %g3 | |
406 | or %g2, %g5, %g2 | |
407 | add %o1, -16, %o1 | |
408 | st %g2, [%o0] | |
409 | add %o0, -16, %o0 | |
410 | bne,a 5b | |
411 | ld [%o1 + 12], %o3 | |
412 | sll %o5, %g4, %g2 | |
413 | srl %g1, %g7, %g5 | |
414 | srl %g4, 3, %g3 | |
415 | or %g2, %g5, %g2 | |
416 | add %o1, %g3, %o1 | |
417 | andcc %o2, 2, %g0 | |
418 | st %g2, [%o0 + 12] | |
419 | be 1f | |
420 | andcc %o2, 1, %g0 | |
421 | ||
422 | ldub [%o1 + 15], %g5 | |
423 | add %o1, -2, %o1 | |
424 | stb %g5, [%o0 + 11] | |
425 | add %o0, -2, %o0 | |
426 | ldub [%o1 + 16], %g5 | |
427 | stb %g5, [%o0 + 12] | |
428 | 1: be 1f | |
429 | nop | |
430 | ldub [%o1 + 15], %g5 | |
431 | stb %g5, [%o0 + 11] | |
432 | 1: retl | |
433 | ld [%sp + 64], %o0 | |
434 | ||
435 | 78: andcc %o1, 1, %g0 | |
436 | be 4f | |
437 | andcc %o1, 2, %g0 | |
438 | ||
439 | ldub [%o1], %g2 | |
440 | add %o1, 1, %o1 | |
441 | stb %g2, [%o0] | |
442 | sub %o2, 1, %o2 | |
443 | bne 3f | |
444 | add %o0, 1, %o0 | |
445 | 4: lduh [%o1], %g2 | |
446 | add %o1, 2, %o1 | |
447 | sth %g2, [%o0] | |
448 | sub %o2, 2, %o2 | |
449 | b 3f | |
450 | add %o0, 2, %o0 | |
451 | END(memmove) | |
452 | ||
453 | ENTRY(memcpy) /* %o0=dst %o1=src %o2=len */ | |
454 | sub %o0, %o1, %o4 | |
455 | st %o0, [%sp + 64] | |
456 | 9: andcc %o4, 3, %o5 | |
457 | 0: bne 86f | |
458 | cmp %o2, 15 | |
459 | ||
460 | bleu 90f | |
461 | andcc %o1, 3, %g0 | |
462 | ||
463 | bne 78b | |
464 | 3: andcc %o1, 4, %g0 | |
465 | ||
466 | be 2f | |
467 | mov %o2, %g1 | |
468 | ||
469 | ld [%o1], %o4 | |
470 | sub %g1, 4, %g1 | |
471 | st %o4, [%o0] | |
472 | add %o1, 4, %o1 | |
473 | add %o0, 4, %o0 | |
474 | 2: andcc %g1, 0xffffff80, %g7 | |
475 | be 3f | |
476 | andcc %o0, 4, %g0 | |
477 | ||
478 | be 82f + 4 | |
479 | 5: MOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5) | |
480 | MOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5) | |
481 | MOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5) | |
482 | MOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5) | |
483 | subcc %g7, 128, %g7 | |
484 | add %o1, 128, %o1 | |
485 | bne 5b | |
486 | add %o0, 128, %o0 | |
487 | 3: andcc %g1, 0x70, %g7 | |
488 | be 80f | |
489 | andcc %g1, 8, %g0 | |
490 | ||
491 | srl %g7, 1, %o4 | |
492 | mov %o7, %g2 | |
493 | add %g7, %o4, %o4 | |
494 | add %o1, %g7, %o1 | |
495 | 104: call 100f | |
496 | add %o0, %g7, %o0 | |
497 | jmpl %o5 + (80f - 104b), %g0 | |
498 | mov %g2, %o7 | |
499 | ||
500 | 79: MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5) | |
501 | MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5) | |
502 | MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5) | |
503 | MOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5) | |
504 | MOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5) | |
505 | MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5) | |
506 | MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5) | |
507 | ||
508 | 80: be 81f | |
509 | andcc %g1, 4, %g0 | |
510 | ||
511 | ldd [%o1], %g2 | |
512 | add %o0, 8, %o0 | |
513 | st %g2, [%o0 - 0x08] | |
514 | add %o1, 8, %o1 | |
515 | st %g3, [%o0 - 0x04] | |
516 | ||
517 | 81: be 1f | |
518 | andcc %g1, 2, %g0 | |
519 | ||
520 | ld [%o1], %g2 | |
521 | add %o1, 4, %o1 | |
522 | st %g2, [%o0] | |
523 | add %o0, 4, %o0 | |
524 | 1: be 1f | |
525 | andcc %g1, 1, %g0 | |
526 | ||
527 | lduh [%o1], %g2 | |
528 | add %o1, 2, %o1 | |
529 | sth %g2, [%o0] | |
530 | add %o0, 2, %o0 | |
531 | 1: be 1f | |
532 | nop | |
533 | ||
534 | ldub [%o1], %g2 | |
535 | stb %g2, [%o0] | |
536 | 1: retl | |
537 | ld [%sp + 64], %o0 | |
538 | ||
539 | 82: /* ldd_std */ | |
540 | MOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5) | |
541 | MOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5) | |
542 | MOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5) | |
543 | MOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5) | |
544 | subcc %g7, 128, %g7 | |
545 | add %o1, 128, %o1 | |
546 | bne 82b | |
547 | add %o0, 128, %o0 | |
548 | ||
549 | andcc %g1, 0x70, %g7 | |
550 | be 84f | |
551 | andcc %g1, 8, %g0 | |
552 | ||
553 | mov %o7, %g2 | |
554 | 111: call 110f | |
555 | add %o1, %g7, %o1 | |
556 | mov %g2, %o7 | |
557 | jmpl %o5 + (84f - 111b), %g0 | |
558 | add %o0, %g7, %o0 | |
559 | ||
560 | 83: MOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3, g4, g5) | |
561 | MOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3, g4, g5) | |
562 | MOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3, g4, g5) | |
563 | MOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5) | |
564 | MOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5) | |
565 | MOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5) | |
566 | MOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5) | |
567 | ||
568 | 84: be 85f | |
569 | andcc %g1, 4, %g0 | |
570 | ||
571 | ldd [%o1], %g2 | |
572 | add %o0, 8, %o0 | |
573 | std %g2, [%o0 - 0x08] | |
574 | add %o1, 8, %o1 | |
575 | 85: be 1f | |
576 | andcc %g1, 2, %g0 | |
577 | ||
578 | ld [%o1], %g2 | |
579 | add %o1, 4, %o1 | |
580 | st %g2, [%o0] | |
581 | add %o0, 4, %o0 | |
582 | 1: be 1f | |
583 | andcc %g1, 1, %g0 | |
584 | ||
585 | lduh [%o1], %g2 | |
586 | add %o1, 2, %o1 | |
587 | sth %g2, [%o0] | |
588 | add %o0, 2, %o0 | |
589 | 1: be 1f | |
590 | nop | |
591 | ||
592 | ldub [%o1], %g2 | |
593 | stb %g2, [%o0] | |
594 | 1: retl | |
595 | ld [%sp + 64], %o0 | |
596 | ||
597 | 86: cmp %o2, 6 | |
598 | bleu 88f | |
599 | ||
600 | cmp %o2, 256 | |
601 | bcc 87f | |
602 | ||
603 | andcc %o0, 3, %g0 | |
604 | be 61f | |
605 | andcc %o0, 1, %g0 | |
606 | be 60f | |
607 | andcc %o0, 2, %g0 | |
608 | ||
609 | ldub [%o1], %g5 | |
610 | add %o1, 1, %o1 | |
611 | stb %g5, [%o0] | |
612 | sub %o2, 1, %o2 | |
613 | bne 61f | |
614 | add %o0, 1, %o0 | |
615 | 60: ldub [%o1], %g3 | |
616 | add %o1, 2, %o1 | |
617 | stb %g3, [%o0] | |
618 | sub %o2, 2, %o2 | |
619 | ldub [%o1 - 1], %g3 | |
620 | add %o0, 2, %o0 | |
621 | stb %g3, [%o0 - 1] | |
622 | 61: and %o1, 3, %g2 | |
623 | and %o2, 0xc, %g3 | |
624 | and %o1, -4, %o1 | |
625 | cmp %g3, 4 | |
626 | sll %g2, 3, %g4 | |
627 | mov 32, %g2 | |
628 | be 4f | |
629 | sub %g2, %g4, %g7 | |
630 | ||
631 | blu 3f | |
632 | cmp %g3, 0x8 | |
633 | ||
634 | be 2f | |
635 | srl %o2, 2, %g3 | |
636 | ||
637 | ld [%o1], %o3 | |
638 | add %o0, -8, %o0 | |
639 | ld [%o1 + 4], %o4 | |
640 | b 8f | |
641 | add %g3, 1, %g3 | |
642 | 2: ld [%o1], %o4 | |
643 | add %o0, -12, %o0 | |
644 | ld [%o1 + 4], %o5 | |
645 | add %g3, 2, %g3 | |
646 | b 9f | |
647 | add %o1, -4, %o1 | |
648 | 3: ld [%o1], %g1 | |
649 | add %o0, -4, %o0 | |
650 | ld [%o1 + 4], %o3 | |
651 | srl %o2, 2, %g3 | |
652 | b 7f | |
653 | add %o1, 4, %o1 | |
654 | 4: ld [%o1], %o5 | |
655 | cmp %o2, 7 | |
656 | ld [%o1 + 4], %g1 | |
657 | srl %o2, 2, %g3 | |
658 | bleu 10f | |
659 | add %o1, 8, %o1 | |
660 | ||
661 | ld [%o1], %o3 | |
662 | add %g3, -1, %g3 | |
663 | 5: sll %o5, %g4, %g2 | |
664 | srl %g1, %g7, %g5 | |
665 | or %g2, %g5, %g2 | |
666 | st %g2, [%o0] | |
667 | 7: ld [%o1 + 4], %o4 | |
668 | sll %g1, %g4, %g2 | |
669 | srl %o3, %g7, %g5 | |
670 | or %g2, %g5, %g2 | |
671 | st %g2, [%o0 + 4] | |
672 | 8: ld [%o1 + 8], %o5 | |
673 | sll %o3, %g4, %g2 | |
674 | srl %o4, %g7, %g5 | |
675 | or %g2, %g5, %g2 | |
676 | st %g2, [%o0 + 8] | |
677 | 9: ld [%o1 + 12], %g1 | |
678 | sll %o4, %g4, %g2 | |
679 | srl %o5, %g7, %g5 | |
680 | addcc %g3, -4, %g3 | |
681 | or %g2, %g5, %g2 | |
682 | add %o1, 16, %o1 | |
683 | st %g2, [%o0 + 12] | |
684 | add %o0, 16, %o0 | |
685 | bne,a 5b | |
686 | ld [%o1], %o3 | |
687 | 10: sll %o5, %g4, %g2 | |
688 | srl %g1, %g7, %g5 | |
689 | srl %g7, 3, %g3 | |
690 | or %g2, %g5, %g2 | |
691 | sub %o1, %g3, %o1 | |
692 | andcc %o2, 2, %g0 | |
693 | st %g2, [%o0] | |
694 | be 1f | |
695 | andcc %o2, 1, %g0 | |
696 | ||
697 | ldub [%o1], %g2 | |
698 | add %o1, 2, %o1 | |
699 | stb %g2, [%o0 + 4] | |
700 | add %o0, 2, %o0 | |
701 | ldub [%o1 - 1], %g2 | |
702 | stb %g2, [%o0 + 3] | |
703 | 1: be 1f | |
704 | nop | |
705 | ldub [%o1], %g2 | |
706 | stb %g2, [%o0 + 4] | |
707 | 1: retl | |
708 | ld [%sp + 64], %o0 | |
709 | ||
710 | 87: andcc %o1, 3, %g0 | |
711 | be 3f | |
712 | andcc %o1, 1, %g0 | |
713 | ||
714 | be 4f | |
715 | andcc %o1, 2, %g0 | |
716 | ||
717 | ldub [%o1], %g2 | |
718 | add %o1, 1, %o1 | |
719 | stb %g2, [%o0] | |
720 | sub %o2, 1, %o2 | |
721 | bne 3f | |
722 | add %o0, 1, %o0 | |
723 | 4: lduh [%o1], %g2 | |
724 | add %o1, 2, %o1 | |
725 | srl %g2, 8, %g3 | |
726 | sub %o2, 2, %o2 | |
727 | stb %g3, [%o0] | |
728 | add %o0, 2, %o0 | |
729 | stb %g2, [%o0 - 1] | |
730 | 3: andcc %o1, 4, %g0 | |
731 | ||
732 | bne 2f | |
733 | cmp %o5, 1 | |
734 | ||
735 | ld [%o1], %o4 | |
736 | srl %o4, 24, %g2 | |
737 | stb %g2, [%o0] | |
738 | srl %o4, 16, %g3 | |
739 | stb %g3, [%o0 + 1] | |
740 | srl %o4, 8, %g2 | |
741 | stb %g2, [%o0 + 2] | |
742 | sub %o2, 4, %o2 | |
743 | stb %o4, [%o0 + 3] | |
744 | add %o1, 4, %o1 | |
745 | add %o0, 4, %o0 | |
746 | 2: be 33f | |
747 | cmp %o5, 2 | |
748 | be 32f | |
749 | sub %o2, 4, %o2 | |
750 | 31: ld [%o1], %g2 | |
751 | add %o1, 4, %o1 | |
752 | srl %g2, 24, %g3 | |
753 | and %o0, 7, %g5 | |
754 | stb %g3, [%o0] | |
755 | cmp %g5, 7 | |
756 | sll %g2, 8, %g1 | |
757 | add %o0, 4, %o0 | |
758 | be 41f | |
759 | and %o2, 0xffffffc0, %o3 | |
760 | ld [%o0 - 7], %o4 | |
761 | 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
762 | SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
763 | SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
764 | SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
765 | subcc %o3, 64, %o3 | |
766 | add %o1, 64, %o1 | |
767 | bne 4b | |
768 | add %o0, 64, %o0 | |
769 | ||
770 | andcc %o2, 0x30, %o3 | |
771 | be,a 1f | |
772 | srl %g1, 16, %g2 | |
773 | 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
774 | subcc %o3, 16, %o3 | |
775 | add %o1, 16, %o1 | |
776 | bne 4b | |
777 | add %o0, 16, %o0 | |
778 | ||
779 | srl %g1, 16, %g2 | |
780 | 1: st %o4, [%o0 - 7] | |
781 | sth %g2, [%o0 - 3] | |
782 | srl %g1, 8, %g4 | |
783 | b 88f | |
784 | stb %g4, [%o0 - 1] | |
785 | 32: ld [%o1], %g2 | |
786 | add %o1, 4, %o1 | |
787 | srl %g2, 16, %g3 | |
788 | and %o0, 7, %g5 | |
789 | sth %g3, [%o0] | |
790 | cmp %g5, 6 | |
791 | sll %g2, 16, %g1 | |
792 | add %o0, 4, %o0 | |
793 | be 42f | |
794 | and %o2, 0xffffffc0, %o3 | |
795 | ld [%o0 - 6], %o4 | |
796 | 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
797 | SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
798 | SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
799 | SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
800 | subcc %o3, 64, %o3 | |
801 | add %o1, 64, %o1 | |
802 | bne 4b | |
803 | add %o0, 64, %o0 | |
804 | ||
805 | andcc %o2, 0x30, %o3 | |
806 | be,a 1f | |
807 | srl %g1, 16, %g2 | |
808 | 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
809 | subcc %o3, 16, %o3 | |
810 | add %o1, 16, %o1 | |
811 | bne 4b | |
812 | add %o0, 16, %o0 | |
813 | ||
814 | srl %g1, 16, %g2 | |
815 | 1: st %o4, [%o0 - 6] | |
816 | b 88f | |
817 | sth %g2, [%o0 - 2] | |
818 | 33: ld [%o1], %g2 | |
819 | sub %o2, 4, %o2 | |
820 | srl %g2, 24, %g3 | |
821 | and %o0, 7, %g5 | |
822 | stb %g3, [%o0] | |
823 | cmp %g5, 5 | |
824 | srl %g2, 8, %g4 | |
825 | sll %g2, 24, %g1 | |
826 | sth %g4, [%o0 + 1] | |
827 | add %o1, 4, %o1 | |
828 | be 43f | |
829 | and %o2, 0xffffffc0, %o3 | |
830 | ||
831 | ld [%o0 - 1], %o4 | |
832 | add %o0, 4, %o0 | |
833 | 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1) | |
834 | SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1) | |
835 | SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1) | |
836 | SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1) | |
837 | subcc %o3, 64, %o3 | |
838 | add %o1, 64, %o1 | |
839 | bne 4b | |
840 | add %o0, 64, %o0 | |
841 | ||
842 | andcc %o2, 0x30, %o3 | |
843 | be,a 1f | |
844 | srl %g1, 24, %g2 | |
845 | 4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, -1) | |
846 | subcc %o3, 16, %o3 | |
847 | add %o1, 16, %o1 | |
848 | bne 4b | |
849 | add %o0, 16, %o0 | |
850 | ||
851 | srl %g1, 24, %g2 | |
852 | 1: st %o4, [%o0 - 5] | |
853 | b 88f | |
854 | stb %g2, [%o0 - 1] | |
855 | 41: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
856 | SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
857 | SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
858 | SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
859 | subcc %o3, 64, %o3 | |
860 | add %o1, 64, %o1 | |
861 | bne 41b | |
862 | add %o0, 64, %o0 | |
863 | ||
864 | andcc %o2, 0x30, %o3 | |
865 | be,a 1f | |
866 | srl %g1, 16, %g2 | |
867 | 4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 8, 24, -3) | |
868 | subcc %o3, 16, %o3 | |
869 | add %o1, 16, %o1 | |
870 | bne 4b | |
871 | add %o0, 16, %o0 | |
872 | ||
873 | srl %g1, 16, %g2 | |
874 | 1: sth %g2, [%o0 - 3] | |
875 | srl %g1, 8, %g4 | |
876 | b 88f | |
877 | stb %g4, [%o0 - 1] | |
878 | 43: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3) | |
879 | SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3) | |
880 | SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3) | |
881 | SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3) | |
882 | subcc %o3, 64, %o3 | |
883 | add %o1, 64, %o1 | |
884 | bne 43b | |
885 | add %o0, 64, %o0 | |
886 | ||
887 | andcc %o2, 0x30, %o3 | |
888 | be,a 1f | |
889 | srl %g1, 24, %g2 | |
890 | 4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 24, 8, 3) | |
891 | subcc %o3, 16, %o3 | |
892 | add %o1, 16, %o1 | |
893 | bne 4b | |
894 | add %o0, 16, %o0 | |
895 | ||
896 | srl %g1, 24, %g2 | |
897 | 1: stb %g2, [%o0 + 3] | |
898 | b 88f | |
899 | add %o0, 4, %o0 | |
900 | 42: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
901 | SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
902 | SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
903 | SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
904 | subcc %o3, 64, %o3 | |
905 | add %o1, 64, %o1 | |
906 | bne 42b | |
907 | add %o0, 64, %o0 | |
908 | ||
909 | andcc %o2, 0x30, %o3 | |
910 | be,a 1f | |
911 | srl %g1, 16, %g2 | |
912 | 4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g7, g1, 16, 16, -2) | |
913 | subcc %o3, 16, %o3 | |
914 | add %o1, 16, %o1 | |
915 | bne 4b | |
916 | add %o0, 16, %o0 | |
917 | ||
918 | srl %g1, 16, %g2 | |
919 | 1: sth %g2, [%o0 - 2] | |
920 | ||
921 | /* Fall through */ | |
922 | ||
923 | 88: and %o2, 0xe, %o3 | |
924 | mov %o7, %g2 | |
925 | sll %o3, 3, %o4 | |
926 | add %o0, %o3, %o0 | |
927 | 106: call 100f | |
928 | add %o1, %o3, %o1 | |
929 | mov %g2, %o7 | |
930 | jmpl %o5 + (89f - 106b), %g0 | |
931 | andcc %o2, 1, %g0 | |
932 | ||
933 | MOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3) | |
934 | MOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3) | |
935 | MOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3) | |
936 | MOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3) | |
937 | MOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3) | |
938 | MOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3) | |
939 | MOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3) | |
940 | ||
941 | 89: be 1f | |
942 | nop | |
943 | ||
944 | ldub [%o1], %g2 | |
945 | stb %g2, [%o0] | |
946 | 1: retl | |
947 | ld [%sp + 64], %o0 | |
948 | ||
949 | 90: bne 88b | |
950 | andcc %o2, 8, %g0 | |
951 | ||
952 | be 1f | |
953 | andcc %o2, 4, %g0 | |
954 | ||
955 | ld [%o1 + 0x00], %g2 | |
956 | ld [%o1 + 0x04], %g3 | |
957 | add %o1, 8, %o1 | |
958 | st %g2, [%o0 + 0x00] | |
959 | st %g3, [%o0 + 0x04] | |
960 | add %o0, 8, %o0 | |
961 | 1: b 81b | |
962 | mov %o2, %g1 | |
963 | ||
964 | 100: retl | |
965 | sub %o7, %o4, %o5 | |
966 | 110: retl | |
967 | sub %o7, %g7, %o5 | |
968 | END(memcpy) |