summaryrefslogtreecommitdiff
path: root/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:34:52 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:34:52 +0000
commit6ff3f2c7106046ffa4479983899e1e0060be19be (patch)
treed45fe774d5cbf1b050df823ed82944d515332cb6 /test/CodeGen/SystemZ
parent21ddf779bfceb2ba98f976bcd36fbf017ed54c52 (diff)
downloadllvm-6ff3f2c7106046ffa4479983899e1e0060be19be.tar.gz
llvm-6ff3f2c7106046ffa4479983899e1e0060be19be.tar.bz2
llvm-6ff3f2c7106046ffa4479983899e1e0060be19be.tar.xz
Add bswap patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ')
-rw-r--r--test/CodeGen/SystemZ/11-BSwap.ll48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/11-BSwap.ll b/test/CodeGen/SystemZ/11-BSwap.ll
new file mode 100644
index 0000000000..d04fa42bc1
--- /dev/null
+++ b/test/CodeGen/SystemZ/11-BSwap.ll
@@ -0,0 +1,48 @@
+; RUN: llvm-as < %s | llc | grep lrvr | count 2
+; RUN: llvm-as < %s | llc | grep lrvgr | count 1
+; RUN: llvm-as < %s | llc | grep lrvh | count 1
+; RUN: llvm-as < %s | llc | grep {lrv.%} | count 1
+; RUN: llvm-as < %s | llc | grep {lrvg.%} | count 1
+
+
+target datalayout = "E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-a0:16:16"
+target triple = "s390x-linux"
+
+
+define i16 @foo(i16 zeroext %a) zeroext {
+ %res = tail call i16 @llvm.bswap.i16(i16 %a)
+ ret i16 %res
+}
+
+define i32 @foo2(i32 zeroext %a) zeroext {
+ %res = tail call i32 @llvm.bswap.i32(i32 %a)
+ ret i32 %res
+}
+
+define i64 @foo3(i64 %a) zeroext {
+ %res = tail call i64 @llvm.bswap.i64(i64 %a)
+ ret i64 %res
+}
+
+define i16 @foo4(i16* %b) zeroext {
+ %a = load i16* %b
+ %res = tail call i16 @llvm.bswap.i16(i16 %a)
+ ret i16 %res
+}
+
+define i32 @foo5(i32* %b) zeroext {
+ %a = load i32* %b
+ %res = tail call i32 @llvm.bswap.i32(i32 %a)
+ ret i32 %res
+}
+
+define i64 @foo6(i64* %b) {
+ %a = load i64* %b
+ %res = tail call i64 @llvm.bswap.i64(i64 %a)
+ ret i64 %res
+}
+
+declare i16 @llvm.bswap.i16(i16) nounwind readnone
+declare i32 @llvm.bswap.i32(i32) nounwind readnone
+declare i64 @llvm.bswap.i64(i64) nounwind readnone
+