blob: 591ba077e874de5f5fef18da11d0a5643d8c7ff1 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Kim Phillips017f1612013-11-06 05:15:24 +01002#include <linux/linkage.h>
Russell King6ebbf2c2014-06-30 16:29:12 +01003#include <asm/assembler.h>
Kim Phillips017f1612013-11-06 05:15:24 +01004
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
Russell King6ebbf2c2014-06-30 16:29:12 +010023 ret lr
Kim Phillips017f1612013-11-06 05:15:24 +010024ENDPROC(__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
Russell King6ebbf2c2014-06-30 16:29:12 +010036 ret lr
Kim Phillips017f1612013-11-06 05:15:24 +010037ENDPROC(__bswapdi2)
38#endif