xref: /netbsd/lib/libc/arch/m68k/string/swab.S (revision bf9ec67e)
1/*	$NetBSD: swab.S,v 1.7 1999/10/25 23:48:16 thorpej Exp $	*/
2
3#include <machine/asm.h>
4
5ENTRY(swab)
6	movl	%sp@(4),%a0		| source
7	movl	%sp@(8),%a1		| destination
8	movl	%sp@(12),%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
21