bswap64.S revision 1.5.26.2 1 1.5.26.1 martin /* $NetBSD: bswap64.S,v 1.5.26.2 2020/04/21 19:37:44 martin 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.2 matt movl 4(%sp),%d1
33 1.2 matt movl 8(%sp),%d0
34 1.4 matt #ifdef __mcfisac__
35 1.4 matt byterev %d0
36 1.4 matt byterev %d1
37 1.4 matt #elif defined(__mcoldfire__)
38 1.4 matt movl %d3,-(%sp)
39 1.4 matt movl %d2,-(%sp)
40 1.4 matt movl #0x00ff00ff, %d3
41 1.4 matt movl %d0,%d2
42 1.4 matt andl %d3,%d2
43 1.4 matt lsll #8,%d2
44 1.4 matt lsrl #8,%d0
45 1.4 matt andl %d3,%d0
46 1.4 matt orl %d2,%d0
47 1.4 matt movl %d1,%d2
48 1.4 matt andl %d3,%d2
49 1.4 matt lsll #8,%d2
50 1.4 matt lsrl #8,%d1
51 1.4 matt andl %d3,%d1
52 1.4 matt orl %d2,%d1
53 1.4 matt movl (%sp)+,%d2
54 1.4 matt movl (%sp)+,%d3
55 1.4 matt #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.4 matt #endif
63 1.1 christos rts
64 1.3 matt END(bswap64)
65