]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | //===------- bswapsi2 - Implement bswapsi2 --------------------------------===// |
2 | // | |
3 | // The LLVM Compiler Infrastructure | |
4 | // | |
5 | // This file is dual licensed under the MIT and the University of Illinois Open | |
6 | // Source Licenses. See LICENSE.TXT for details. | |
7 | // | |
8 | //===----------------------------------------------------------------------===// | |
9 | ||
10 | #include "../assembly.h" | |
11 | ||
92a42be0 SL |
12 | .syntax unified |
13 | .text | |
2c00a5a8 | 14 | DEFINE_CODE_STATE |
92a42be0 | 15 | |
1a4d82fc JJ |
16 | // |
17 | // extern uint32_t __bswapsi2(uint32_t); | |
18 | // | |
19 | // Reverse all the bytes in a 32-bit integer. | |
20 | // | |
92a42be0 | 21 | .p2align 2 |
1a4d82fc JJ |
22 | DEFINE_COMPILERRT_FUNCTION(__bswapsi2) |
23 | #if __ARM_ARCH < 6 | |
24 | // before armv6 does not have "rev" instruction | |
25 | eor r1, r0, r0, ror #16 | |
26 | bic r1, r1, #0xff0000 | |
27 | mov r1, r1, lsr #8 | |
28 | eor r0, r1, r0, ror #8 | |
29 | #else | |
30 | rev r0, r0 | |
31 | #endif | |
32 | JMP(lr) | |
33 | END_COMPILERRT_FUNCTION(__bswapsi2) | |
3157f602 XL |
34 | |
35 | NO_EXEC_STACK_DIRECTIVE | |
36 |