1*0a6a1f1dSLionel Sambuc/* $NetBSD: bswap64.S,v 1.5 2014/03/18 18:20:35 riastradh Exp $ */ 2b6cbf720SGianluca Guida 3b6cbf720SGianluca Guida/* 4b6cbf720SGianluca Guida * Copyright (C) 1996 Scott Reynolds. All rights reserved. 5b6cbf720SGianluca Guida * 6b6cbf720SGianluca Guida * Redistribution and use in source and binary forms, with or without 7b6cbf720SGianluca Guida * modification, are permitted provided that the following conditions 8b6cbf720SGianluca Guida * are met: 9b6cbf720SGianluca Guida * 1. Redistributions of source code must retain the above copyright 10b6cbf720SGianluca Guida * notice, this list of conditions and the following disclaimer. 11b6cbf720SGianluca Guida * 2. Redistributions in binary form must reproduce the above copyright 12b6cbf720SGianluca Guida * notice, this list of conditions and the following disclaimer in the 13b6cbf720SGianluca Guida * documentation and/or other materials provided with the distribution. 14b6cbf720SGianluca Guida * 3. The name of the author may not be used to endorse or promote products 15b6cbf720SGianluca Guida * derived from this software without specific prior written permission 16b6cbf720SGianluca Guida * 17b6cbf720SGianluca Guida * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18b6cbf720SGianluca Guida * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19b6cbf720SGianluca Guida * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20b6cbf720SGianluca Guida * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21b6cbf720SGianluca Guida * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22b6cbf720SGianluca Guida * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23b6cbf720SGianluca Guida * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24b6cbf720SGianluca Guida * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25b6cbf720SGianluca Guida * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26b6cbf720SGianluca Guida * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27b6cbf720SGianluca Guida */ 28b6cbf720SGianluca Guida 29b6cbf720SGianluca Guida#include <machine/asm.h> 30b6cbf720SGianluca Guida 31b6cbf720SGianluca GuidaENTRY(bswap64) 3284d9c625SLionel Sambuc movl 4(%sp),%d1 3384d9c625SLionel Sambuc movl 8(%sp),%d0 3484d9c625SLionel Sambuc#ifdef __mcfisac__ 3584d9c625SLionel Sambuc byterev %d0 3684d9c625SLionel Sambuc byterev %d1 3784d9c625SLionel Sambuc#elif defined(__mcoldfire__) 3884d9c625SLionel Sambuc movl %d3,-(%sp) 3984d9c625SLionel Sambuc movl %d2,-(%sp) 4084d9c625SLionel Sambuc movl #0x00ff00ff, %d3 4184d9c625SLionel Sambuc movl %d0,%d2 4284d9c625SLionel Sambuc andl %d3,%d2 4384d9c625SLionel Sambuc lsll #8,%d2 4484d9c625SLionel Sambuc lsrl #8,%d0 4584d9c625SLionel Sambuc andl %d3,%d0 4684d9c625SLionel Sambuc orl %d2,%d0 4784d9c625SLionel Sambuc movl %d1,%d2 4884d9c625SLionel Sambuc andl %d3,%d2 4984d9c625SLionel Sambuc lsll #8,%d2 5084d9c625SLionel Sambuc lsrl #8,%d1 5184d9c625SLionel Sambuc andl %d3,%d1 5284d9c625SLionel Sambuc orl %d2,%d1 5384d9c625SLionel Sambuc movl (%sp)+,%d2 5484d9c625SLionel Sambuc movl (%sp)+,%d3 5584d9c625SLionel Sambuc#else 56b6cbf720SGianluca Guida rolw #8,%d1 57b6cbf720SGianluca Guida rolw #8,%d0 58b6cbf720SGianluca Guida swap %d1 59b6cbf720SGianluca Guida swap %d0 60b6cbf720SGianluca Guida rolw #8,%d0 61b6cbf720SGianluca Guida rolw #8,%d1 6284d9c625SLionel Sambuc#endif 63b6cbf720SGianluca Guida rts 6484d9c625SLionel SambucEND(bswap64) 65