xref: /netbsd-src/lib/libc/arch/vax/gen/byte_swap_4.S (revision 787e823fd1325737172861d30c613c7e6e7d2f3d)
1dc306354Sbouyer/*
2dc306354Sbouyer * Copyright (c) 1983, 1993
3dc306354Sbouyer *	The Regents of the University of California.  All rights reserved.
4dc306354Sbouyer *
5dc306354Sbouyer * Redistribution and use in source and binary forms, with or without
6dc306354Sbouyer * modification, are permitted provided that the following conditions
7dc306354Sbouyer * are met:
8dc306354Sbouyer * 1. Redistributions of source code must retain the above copyright
9dc306354Sbouyer *    notice, this list of conditions and the following disclaimer.
10dc306354Sbouyer * 2. Redistributions in binary form must reproduce the above copyright
11dc306354Sbouyer *    notice, this list of conditions and the following disclaimer in the
12dc306354Sbouyer *    documentation and/or other materials provided with the distribution.
13eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
14dc306354Sbouyer *    may be used to endorse or promote products derived from this software
15dc306354Sbouyer *    without specific prior written permission.
16dc306354Sbouyer *
17dc306354Sbouyer * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18dc306354Sbouyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19dc306354Sbouyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20dc306354Sbouyer * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21dc306354Sbouyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22dc306354Sbouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23dc306354Sbouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24dc306354Sbouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25dc306354Sbouyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26dc306354Sbouyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27dc306354Sbouyer * SUCH DAMAGE.
28dc306354Sbouyer */
29dc306354Sbouyer
30*787e823fSmatt#include "DEFS.h"
31*787e823fSmatt
32dc306354Sbouyer#if defined(LIBC_SCCS) && !defined(lint)
33dc306354Sbouyer	/* .asciz "@(#)htonl.s	8.1 (Berkeley) 6/4/93" */
34*787e823fSmattRCSID("$NetBSD: byte_swap_4.S,v 1.5 2011/01/25 02:38:15 matt Exp $")
35dc306354Sbouyer#endif /* LIBC_SCCS and not lint */
36dc306354Sbouyer
3722df858eSraggeALTENTRY(ntohl)
3822df858eSraggeALTENTRY(htonl)
39dc306354SbouyerENTRY(__bswap32, 0)
400ce5ca14Smatt	rotl	$-8,4(%ap),%r0
410ce5ca14Smatt	insv	%r0,$16,$8,%r0
420ce5ca14Smatt	movb	7(%ap),%r0
43dc306354Sbouyer	ret
44*787e823fSmattEND(__bswap32)
45