xref: /csrg-svn/lib/libc/vax/string/bcopy.s (revision 34480)
1/*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific written prior permission. This software
10 * is provided ``as is'' without express or implied warranty.
11 */
12
13#if defined(SYSLIBC_SCCS) && !defined(lint)
14_sccsid:.asciz	"@(#)bcopy.s	5.4 (Berkeley) 05/25/88"
15#endif /* SYSLIBC_SCCS and not lint */
16
17/* bcopy(from, to, size) */
18
19#include "DEFS.h"
20
21ENTRY(bcopy, R6)
22	movl	4(ap),r1
23	movl	8(ap),r3
24	movl	12(ap),r6
25	cmpl	r1,r3
26	bgtr	2f		# normal forward case
27	blss	3f		# overlapping, must do backwards
28	ret			# equal, nothing to do
291:
30	subl2	r0,r6
31	movc3	r0,(r1),(r3)
322:
33	movzwl	$65535,r0
34	cmpl	r6,r0
35	jgtr	1b
36	movc3	r6,(r1),(r3)
37	ret
383:
39	addl2	r6,r1
40	addl2	r6,r3
41	movzwl	$65535,r0
42	jbr	5f
434:
44	subl2	r0,r6
45	subl2	r0,r1
46	subl2	r0,r3
47	movc3	r0,(r1),(r3)
48	movzwl	$65535,r0
49	subl2	r0,r1
50	subl2	r0,r3
515:
52	cmpl	r6,r0
53	jgtr	4b
54	subl2	r6,r1
55	subl2	r6,r3
56	movc3	r6,(r1),(r3)
57	ret
58