xref: /openbmc/linux/arch/arm/lib/bswapsdi2.S (revision 1edd0337)
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/linkage.h>
3#include <asm/assembler.h>
4
5#if __LINUX_ARM_ARCH__ >= 6
6ENTRY(__bswapsi2)
7	rev r0, r0
8	bx lr
9ENDPROC(__bswapsi2)
10
11ENTRY(__bswapdi2)
12	rev r3, r0
13	rev r0, r1
14	mov r1, r3
15	bx lr
16ENDPROC(__bswapdi2)
17#else
18ENTRY(__bswapsi2)
19	eor r3, r0, r0, ror #16
20	mov r3, r3, lsr #8
21	bic r3, r3, #0xff00
22	eor r0, r3, r0, ror #8
23	ret lr
24ENDPROC(__bswapsi2)
25
26ENTRY(__bswapdi2)
27	mov ip, r1
28	eor r3, ip, ip, ror #16
29	eor r1, r0, r0, ror #16
30	mov r1, r1, lsr #8
31	mov r3, r3, lsr #8
32	bic r3, r3, #0xff00
33	bic r1, r1, #0xff00
34	eor r1, r1, r0, ror #8
35	eor r0, r3, ip, ror #8
36	ret lr
37ENDPROC(__bswapdi2)
38#endif
39