1/*	$NetBSD: movstr.S,v 1.8 2006/05/22 21:34:08 uwe Exp $	*/
2
3/*-
4 * Copyright (C) 1999 Tsubai Masanari.  All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 *    derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <machine/asm.h>
30
31
32#ifdef __ELF__
33	.hidden __movstr, __movmem
34#endif
35
36
37NENTRY(__movstr)
38	mov	#16, r0
39	cmp/gt	r0, r6
40	bf	loop2
41
42	.align	2
43loop1:
44	mov.l	@r5+, r0
45	mov.l	r0, @r4
46	mov.l	@r5+, r0
47	mov.l	r0, @(4, r4)
48	mov.l	@r5+, r0
49	mov.l	r0, @(8, r4)
50	mov.l	@r5+, r0
51	mov.l	r0, @(12, r4)
52	mov.l	@r5+, r0
53	mov.l	r0, @(16, r4)
54	mov.l	@r5+, r0
55	mov.l	r0, @(20, r4)
56	mov.l	@r5+, r0
57	mov.l	r0, @(24, r4)
58	mov.l	@r5+, r0
59	mov.l	r0, @(28, r4)
60	mov.l	@r5+, r0
61	mov.l	r0, @(32, r4)
62	mov.l	@r5+, r0
63	mov.l	r0, @(36, r4)
64	mov.l	@r5+, r0
65	mov.l	r0, @(40, r4)
66	mov.l	@r5+, r0
67	mov.l	r0, @(44, r4)
68	mov.l	@r5+, r0
69	mov.l	r0, @(48, r4)
70	mov.l	@r5+, r0
71	mov.l	r0, @(52, r4)
72	mov.l	@r5+, r0
73	mov.l	r0, @(56, r4)
74	mov.l	@r5+, r0
75	mov.l	r0, @(60, r4)
76	add	#-16, r6
77	add	#64, r4
78
79	mov	#16, r0
80	cmp/gt	r0, r6
81	bt	loop1
82
83loop2:
84	add	#-32, r6
85	.align	2
861:
87	mov.l	@r5+, r0
88	mov.l	r0, @r4
89	add	#4, r4
90	add	#1, r6
91	tst	r6, r6
92	bf	1b
93
94	rts
95	 nop
96
97
98/* gcc4 uses movmem, older versions use movstr */
99STRONG_ALIAS(__movmem, __movstr)
100