Home | History | Annotate | Line # | Download | only in gen
bswap64.S revision 1.1.56.1
      1  1.1.56.1       tls /*	$NetBSD: bswap64.S,v 1.1.56.1 2014/08/19 23:45:13 tls Exp $	*/
      2       1.1  christos 
      3       1.1  christos /*
      4       1.1  christos  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
      5       1.1  christos  *
      6       1.1  christos  * Redistribution and use in source and binary forms, with or without
      7       1.1  christos  * modification, are permitted provided that the following conditions
      8       1.1  christos  * are met:
      9       1.1  christos  * 1. Redistributions of source code must retain the above copyright
     10       1.1  christos  *    notice, this list of conditions and the following disclaimer.
     11       1.1  christos  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.1  christos  *    notice, this list of conditions and the following disclaimer in the
     13       1.1  christos  *    documentation and/or other materials provided with the distribution.
     14       1.1  christos  * 3. The name of the author may not be used to endorse or promote products
     15       1.1  christos  *    derived from this software without specific prior written permission
     16       1.1  christos  *
     17       1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18       1.1  christos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19       1.1  christos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20       1.1  christos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21       1.1  christos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22       1.1  christos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23       1.1  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24       1.1  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25       1.1  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26       1.1  christos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27       1.1  christos  */
     28       1.1  christos 
     29       1.1  christos #include <machine/asm.h>
     30       1.1  christos 
     31       1.1  christos ENTRY(bswap64)
     32  1.1.56.1       tls 	movl	4(%sp),%d1
     33  1.1.56.1       tls 	movl	8(%sp),%d0
     34  1.1.56.1       tls #ifdef __mcfisac__
     35  1.1.56.1       tls 	byterev	%d0
     36  1.1.56.1       tls 	byterev	%d1
     37  1.1.56.1       tls #elif defined(__mcoldfire__)
     38  1.1.56.1       tls 	movl	%d3,-(%sp)
     39  1.1.56.1       tls 	movl	%d2,-(%sp)
     40  1.1.56.1       tls 	movl	#0x00ff00ff, %d3
     41  1.1.56.1       tls 	movl	%d0,%d2
     42  1.1.56.1       tls 	andl	%d3,%d2
     43  1.1.56.1       tls 	lsll	#8,%d2
     44  1.1.56.1       tls 	lsrl	#8,%d0
     45  1.1.56.1       tls 	andl	%d3,%d0
     46  1.1.56.1       tls 	orl	%d2,%d0
     47  1.1.56.1       tls 	movl	%d1,%d2
     48  1.1.56.1       tls 	andl	%d3,%d2
     49  1.1.56.1       tls 	lsll	#8,%d2
     50  1.1.56.1       tls 	lsrl	#8,%d1
     51  1.1.56.1       tls 	andl	%d3,%d1
     52  1.1.56.1       tls 	orl	%d2,%d1
     53  1.1.56.1       tls 	movl	(%sp)+,%d2
     54  1.1.56.1       tls 	movl	(%sp)+,%d3
     55  1.1.56.1       tls #else
     56       1.1  christos 	rolw	#8,%d1
     57       1.1  christos 	rolw	#8,%d0
     58       1.1  christos 	swap	%d1
     59       1.1  christos 	swap	%d0
     60       1.1  christos 	rolw	#8,%d0
     61       1.1  christos 	rolw	#8,%d1
     62  1.1.56.1       tls #endif
     63       1.1  christos 	rts
     64  1.1.56.1       tls END(bswap64)
     65