1 1.2 cherry /* $NetBSD: byte_swap_2.S,v 1.2 2006/04/07 14:27:33 cherry Exp $ */ 2 1.1 cherry 3 1.1 cherry /*- 4 1.1 cherry * Copyright (c) 1996 Carnegie-Mellon University. 5 1.1 cherry * All rights reserved. 6 1.1 cherry * 7 1.1 cherry * Author: Chris G. Demetriou 8 1.1 cherry * 9 1.1 cherry * Permission to use, copy, modify and distribute this software and 10 1.1 cherry * its documentation is hereby granted, provided that both the copyright 11 1.1 cherry * notice and this permission notice appear in all copies of the 12 1.1 cherry * software, derivative works or modified versions, and any portions 13 1.1 cherry * thereof, and that both notices appear in supporting documentation. 14 1.1 cherry * 15 1.1 cherry * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 16 1.1 cherry * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 17 1.1 cherry * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 18 1.1 cherry * 19 1.1 cherry * Carnegie Mellon requests users of this software to return to 20 1.1 cherry * 21 1.1 cherry * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU 22 1.1 cherry * School of Computer Science 23 1.1 cherry * Carnegie Mellon University 24 1.1 cherry * Pittsburgh PA 15213-3890 25 1.1 cherry * 26 1.1 cherry * any improvements or extensions that they make and grant Carnegie the 27 1.1 cherry * rights to redistribute these changes. 28 1.1 cherry */ 29 1.1 cherry 30 1.1 cherry #include <machine/asm.h> 31 1.1 cherry 32 1.1 cherry #ifndef NAME 33 1.1 cherry #error NAME not defined 34 1.1 cherry #endif 35 1.1 cherry 36 1.1 cherry /* 37 1.1 cherry * Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.) 38 1.1 cherry * 39 1.1 cherry * Argument is an unsigned 2-byte integer (u_int16_t). 40 1.1 cherry */ 41 1.1 cherry ENTRY(NAME, 1) 42 1.1 cherry mux1 r16=in0,@rev 43 1.1 cherry ;; 44 1.1 cherry extr.u r8=r16,48,16 45 1.1 cherry br.ret.sptk.few rp 46 1.1 cherry END(NAME) 47