166633Sdfr/* $FreeBSD$ */
266633Sdfr/*	$NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $	*/
366633Sdfr
4139815Simp/*-
566633Sdfr * Copyright (c) 1996 Carnegie-Mellon University.
666633Sdfr * All rights reserved.
766633Sdfr *
866633Sdfr * Author: Chris G. Demetriou
966633Sdfr *
1066633Sdfr * Permission to use, copy, modify and distribute this software and
1166633Sdfr * its documentation is hereby granted, provided that both the copyright
1266633Sdfr * notice and this permission notice appear in all copies of the
1366633Sdfr * software, derivative works or modified versions, and any portions
1466633Sdfr * thereof, and that both notices appear in supporting documentation.
1566633Sdfr *
1666633Sdfr * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
1766633Sdfr * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
1866633Sdfr * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
1966633Sdfr *
2066633Sdfr * Carnegie Mellon requests users of this software to return to
2166633Sdfr *
2266633Sdfr *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
2366633Sdfr *  School of Computer Science
2466633Sdfr *  Carnegie Mellon University
2566633Sdfr *  Pittsburgh PA 15213-3890
2666633Sdfr *
2766633Sdfr * any improvements or extensions that they make and grant Carnegie the
2866633Sdfr * rights to redistribute these changes.
2966633Sdfr */
3066633Sdfr
3166633Sdfr#include <machine/asm.h>
3266633Sdfr
3391394Stmm#ifndef NAME
3491394Stmm#error NAME not defined
3566633Sdfr#endif
3666633Sdfr
3766633Sdfr/*
3866633Sdfr * Byte-swap a 2-byte quantity.  (Convert 0x0123 to 0x2301.)
3966633Sdfr *
4066633Sdfr * Argument is an unsigned 2-byte integer (u_int16_t).
4166633Sdfr */
4284579SdfrENTRY(NAME, 1)
4384579Sdfr	mux1	r16=in0,@rev
4484579Sdfr	;;
4584579Sdfr	extr.u	r8=r16,48,16
4666633Sdfr	br.ret.sptk.few rp
4766633SdfrEND(NAME)
48