swab.S revision 1.9
1/*	$NetBSD: swab.S,v 1.9 2013/07/16 21:46:42 matt Exp $	*/
2
3#include <machine/asm.h>
4
5ENTRY(swab)
6	movl	4(%sp),%a0		| source
7	movl	8(%sp),%a1		| destination
8	movl	12(%sp),%d0		| count
9	lsrl	#1,%d0			| count is in bytes; we need words
10	jeq	swdone
11
12swloop:
13	movw	(%a0)+,%d1
14	rorw	#8,%d1
15	movw	%d1,(%a1)+
16	subql	#1,%d0
17	jne	swloop
18
19swdone:
20	rts
21END(swab)
22