Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Kim Phillips | 017f161 | 2013-11-06 05:15:24 +0100 | [diff] [blame] | 2 | #include <linux/linkage.h> |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 3 | #include <asm/assembler.h> |
Kim Phillips | 017f161 | 2013-11-06 05:15:24 +0100 | [diff] [blame] | 4 | |
| 5 | #if __LINUX_ARM_ARCH__ >= 6 |
| 6 | ENTRY(__bswapsi2) |
| 7 | rev r0, r0 |
| 8 | bx lr |
| 9 | ENDPROC(__bswapsi2) |
| 10 | |
| 11 | ENTRY(__bswapdi2) |
| 12 | rev r3, r0 |
| 13 | rev r0, r1 |
| 14 | mov r1, r3 |
| 15 | bx lr |
| 16 | ENDPROC(__bswapdi2) |
| 17 | #else |
| 18 | ENTRY(__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 King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 23 | ret lr |
Kim Phillips | 017f161 | 2013-11-06 05:15:24 +0100 | [diff] [blame] | 24 | ENDPROC(__bswapsi2) |
| 25 | |
| 26 | ENTRY(__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 King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 36 | ret lr |
Kim Phillips | 017f161 | 2013-11-06 05:15:24 +0100 | [diff] [blame] | 37 | ENDPROC(__bswapdi2) |
| 38 | #endif |