xref: /original-bsd/lib/libc/vax/string/bcopy.s (revision 81f6297c)
1/*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.  The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8	.asciz	"@(#)bcopy.s	5.2 (Berkeley) 06/05/85"
9#endif not lint
10
11/* bcopy(from, to, size) */
12
13#include "DEFS.h"
14
15ENTRY(bcopy, R6)
16	movl	4(ap),r1
17	movl	8(ap),r3
18	movl	12(ap),r6
19	cmpl	r1,r3
20	bgtr	2f		# normal forward case
21	blss	3f		# overlapping, must do backwards
22	ret			# equal, nothing to do
231:
24	subl2	r0,r6
25	movc3	r0,(r1),(r3)
262:
27	movzwl	$65535,r0
28	cmpl	r6,r0
29	jgtr	1b
30	movc3	r6,(r1),(r3)
31	ret
323:
33	addl2	r6,r1
34	addl2	r6,r3
35	movzwl	$65535,r0
36	jbr	5f
374:
38	subl2	r0,r6
39	subl2	r0,r1
40	subl2	r0,r3
41	movc3	r0,(r1),(r3)
42	movzwl	$65535,r0
43	subl2	r0,r1
44	subl2	r0,r3
455:
46	cmpl	r6,r0
47	jgtr	4b
48	subl2	r6,r1
49	subl2	r6,r3
50	movc3	r6,(r1),(r3)
51	ret
52