[llvm-commits] [compiler-rt] r107576 - in /compiler-rt/trunk/lib/arm: bswapdi2.S bswapsi2.S
Stephen Canon
scanon at apple.com
Sat Jul 3 14:47:51 PDT 2010
Author: scanon
Date: Sat Jul 3 16:47:50 2010
New Revision: 107576
URL: http://llvm.org/viewvc/llvm-project?rev=107576&view=rev
Log:
Further cleanup of ARM bswap implementations, thanks to John Tytgat
Modified:
compiler-rt/trunk/lib/arm/bswapdi2.S
compiler-rt/trunk/lib/arm/bswapsi2.S
Modified: compiler-rt/trunk/lib/arm/bswapdi2.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/bswapdi2.S?rev=107576&r1=107575&r2=107576&view=diff
==============================================================================
--- compiler-rt/trunk/lib/arm/bswapdi2.S (original)
+++ compiler-rt/trunk/lib/arm/bswapdi2.S Sat Jul 3 16:47:50 2010
@@ -14,25 +14,23 @@
//
// Reverse all the bytes in a 64-bit integer.
//
- .align 2
+.align 2
DEFINE_COMPILERRT_FUNCTION(__bswapdi2)
#if __ARM_ARCH_5TEJ__ || __ARM_ARCH_4T__
- mov r12, #0xff00
-
- and r3, r12, r0, lsr #8
- and r2, r12, r0
- orr r3, r3, r0, lsr #24
- orr r3, r3, r0, lsl #24
- orr r2, r3, r2, lsl #8 // r2 = rev(r0)
-
- and r3, r12, r1, lsr #8
- and r0, r12, r1
- orr r3, r3, r1, lsr #24
- orr r3, r3, r1, lsl #24
- orr r0, r3, r0, lsl #8 // r0 = rev(r1)
+ // before armv6 does not have "rev" instruction
+ // r2 = rev(r0)
+ eor r2, r0, r0, ror #16
+ bic r2, r2, #0xff0000
+ mov r2, r2, lsr #8
+ eor r2, r2, r0, ror #8
+ // r0 = rev(r1)
+ eor r0, r1, r1, ror #16
+ bic r0, r0, #0xff0000
+ mov r0, r0, lsr #8
+ eor r0, r0, r1, ror #8
#else
- rev r2, r0 // r2 = rev(r0)
- rev r0, r1 // r0 = rev(r1)
+ rev r2, r0 // r2 = rev(r0)
+ rev r0, r1 // r0 = rev(r1)
#endif
- mov r1, r2 // r1 = r2 = rev(r0)
+ mov r1, r2 // r1 = r2 = rev(r0)
bx lr
Modified: compiler-rt/trunk/lib/arm/bswapsi2.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/bswapsi2.S?rev=107576&r1=107575&r2=107576&view=diff
==============================================================================
--- compiler-rt/trunk/lib/arm/bswapsi2.S (original)
+++ compiler-rt/trunk/lib/arm/bswapsi2.S Sat Jul 3 16:47:50 2010
@@ -14,17 +14,15 @@
//
// Reverse all the bytes in a 32-bit integer.
//
- .align 2
+.align 2
DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
#if __ARM_ARCH_5TEJ__ || __ARM_ARCH_4T__
- // before armv6 does not have "rev" instruction
- mov r1, #0xff00
- and r2, r1, r0, lsr #8
- and r1, r1, r0
- orr r2, r2, r0, lsr #24
- orr r2, r2, r0, lsl #24
- orr r0, r2, r1, lsl #8
+ // before armv6 does not have "rev" instruction
+ eor r1, r0, r0, ror #16
+ bic r1, r1, #0xff0000
+ mov r1, r1, lsr #8
+ eor r0, r1, r0, ror #8
#else
- rev r0, r0 // reverse bytes in parameter and put into result register
+ rev r0, r0
#endif
- bx lr
+ bx lr
More information about the llvm-commits
mailing list