1 //===------- bswapsi2 - Implement bswapsi2 --------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "../assembly.h"
14 #if __ARM_ARCH_ISA_THUMB == 2
19 // extern uint32_t __bswapsi2(uint32_t);
21 // Reverse all the bytes in a 32-bit integer.
24 #if __ARM_ARCH_ISA_THUMB == 2
25 DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapsi2)
27 DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
30 // before armv6 does not have "rev" instruction
31 eor r1, r0, r0, ror #16
34 eor r0, r1, r0, ror #8
39 END_COMPILERRT_FUNCTION(__bswapsi2)
41 NO_EXEC_STACK_DIRECTIVE