Home | History | Annotate | Download | only in arm
      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 
     12 //
     13 // extern uint32_t __bswapsi2(uint32_t);
     14 //
     15 // Reverse all the bytes in a 32-bit integer.
     16 //
     17 .align 2
     18 DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
     19 #if __ARM_ARCH_5TEJ__ || __ARM_ARCH_4T__
     20     // before armv6 does not have "rev" instruction
     21  	eor	r1, r0, r0, ror #16
     22  	bic	r1, r1, #0xff0000
     23  	mov	r1, r1, lsr #8
     24  	eor	r0, r1, r0, ror #8
     25 #else
     26     rev r0, r0
     27 #endif
     28     bx  lr
     29