xref: /original-bsd/lib/libc/vax/string/bcopy.s (revision c3e32dec)
1/*
2 * Copyright (c) 1983, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8#if defined(LIBC_SCCS) && !defined(lint)
9	.asciz "@(#)bcopy.s	8.1 (Berkeley) 06/04/93"
10#endif /* LIBC_SCCS and not lint */
11
12/* bcopy(from, to, size) */
13
14#include "DEFS.h"
15
16ENTRY(bcopy, R6)
17	movl	4(ap),r1
18	movl	8(ap),r3
19	movl	12(ap),r6
20	cmpl	r1,r3
21	bgtr	2f		# normal forward case
22	blss	3f		# overlapping, must do backwards
23	ret			# equal, nothing to do
241:
25	subl2	r0,r6
26	movc3	r0,(r1),(r3)
272:
28	movzwl	$65535,r0
29	cmpl	r6,r0
30	jgtr	1b
31	movc3	r6,(r1),(r3)
32	ret
333:
34	addl2	r6,r1
35	addl2	r6,r3
36	movzwl	$65535,r0
37	jbr	5f
384:
39	subl2	r0,r6
40	subl2	r0,r1
41	subl2	r0,r3
42	movc3	r0,(r1),(r3)
43	movzwl	$65535,r0
44	subl2	r0,r1
45	subl2	r0,r3
465:
47	cmpl	r6,r0
48	jgtr	4b
49	subl2	r6,r1
50	subl2	r6,r3
51	movc3	r6,(r1),(r3)
52	ret
53