summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-10 20:53:53 +0000
committerChris Lattner <sabre@nondot.org>2006-07-10 20:53:53 +0000
commit5895a13755cd61c1aead93d68402389dfa8f7b8a (patch)
tree3cf6fe5c028454d296c38470bab4463053874476 /test
parent6423d4c64adc7db73206bbfd957256236bfaf2b4 (diff)
downloadllvm-5895a13755cd61c1aead93d68402389dfa8f7b8a.tar.gz
llvm-5895a13755cd61c1aead93d68402389dfa8f7b8a.tar.bz2
llvm-5895a13755cd61c1aead93d68402389dfa8f7b8a.tar.xz
New testcase for folding bswaps into i16/i32 loads and stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/PowerPC/bswap-load-store.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/bswap-load-store.ll b/test/CodeGen/PowerPC/bswap-load-store.ll
new file mode 100644
index 0000000000..b8668bb6f0
--- /dev/null
+++ b/test/CodeGen/PowerPC/bswap-load-store.ll
@@ -0,0 +1,42 @@
+; RUN: llvm-as < %s | llc -march=ppc32 | grep 'stwbrx\|lwbrx\|sthbrx\|lhbrx' | wc -l | grep 4 &&
+; RUN: llvm-as < %s | llc -march=ppc32 | not grep rlwinm &&
+; RUN: llvm-as < %s | llc -march=ppc32 | not grep rlwimi &&
+; RUN: llvm-as < %s | llc -march=ppc64 | grep 'stwbrx\|lwbrx\|sthbrx\|lhbrx' | wc -l | grep 4 &&
+; RUN: llvm-as < %s | llc -march=ppc64 | not grep rlwinm &&
+; RUN: llvm-as < %s | llc -march=ppc64 | not grep rlwimi
+
+void %STWBRX(uint %i, sbyte* %ptr, int %off) {
+ %tmp1 = getelementptr sbyte* %ptr, int %off
+ %tmp1 = cast sbyte* %tmp1 to uint*
+ %tmp13 = tail call uint %llvm.bswap.i32(uint %i)
+ store uint %tmp13, uint* %tmp1
+ ret void
+}
+
+uint %LWBRX(sbyte* %ptr, int %off) {
+ %tmp1 = getelementptr sbyte* %ptr, int %off
+ %tmp1 = cast sbyte* %tmp1 to uint*
+ %tmp = load uint* %tmp1
+ %tmp14 = tail call uint %llvm.bswap.i32( uint %tmp )
+ ret uint %tmp14
+}
+
+void %STHBRX(ushort %s, sbyte* %ptr, int %off) {
+ %tmp1 = getelementptr sbyte* %ptr, int %off
+ %tmp1 = cast sbyte* %tmp1 to ushort*
+ %tmp5 = call ushort %llvm.bswap.i16( ushort %s )
+ store ushort %tmp5, ushort* %tmp1
+ ret void
+}
+
+ushort %LHBRX(sbyte* %ptr, int %off) {
+ %tmp1 = getelementptr sbyte* %ptr, int %off
+ %tmp1 = cast sbyte* %tmp1 to ushort*
+ %tmp = load ushort* %tmp1
+ %tmp6 = call ushort %llvm.bswap.i16(ushort %tmp)
+ ret ushort %tmp6
+}
+
+declare uint %llvm.bswap.i32(uint)
+
+declare ushort %llvm.bswap.i16(ushort)