1 //===------- bswapsi2 - Implement bswapsi2 --------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "../assembly.h"
16 // extern uint32_t __bswapsi2(uint32_t);
18 // Reverse all the bytes in a 32-bit integer.
21 DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
23 // before armv6 does not have "rev" instruction
24 eor r1, r0, r0, ror #16
27 eor r0, r1, r0, ror #8
32 END_COMPILERRT_FUNCTION(__bswapsi2)
34 NO_EXEC_STACK_DIRECTIVE