summaryrefslogtreecommitdiff
path: root/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-19 20:50:05 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-19 20:50:05 +0000
commit5994e167a78be1204d127a7835eb2e38245b614b (patch)
tree75c9aa142ab4b088b9b3914a510e53f8243875df /test/CodeGen/SystemZ
parent3a6eaef3ccd5810e72dd520c98bb1c609f8a525b (diff)
[SystemZ] Fix truncstore + bswap codegen bug
SystemZTargetLowering::combineSTORE contains code to transform a combination of STORE + BSWAP into a STRV type instruction. This transformation is correct for regular stores, but not for truncating stores. The routine neglected to check for that case. Fixes a miscompilation of llvm-objcopy with clang, which caused test suite failures in the SystemZ multistage build bot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ')
-rw-r--r--test/CodeGen/SystemZ/bswap-08.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/bswap-08.ll b/test/CodeGen/SystemZ/bswap-08.ll
new file mode 100644
index 00000000000..f82b09b37b7
--- /dev/null
+++ b/test/CodeGen/SystemZ/bswap-08.ll
@@ -0,0 +1,17 @@
+; Verify that truncating stores do not use STRV
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+
+declare i64 @llvm.bswap.i64(i64)
+
+define void @f1(i32* %x, i64* %y) {
+; CHECK-LABEL: f1:
+; CHECK-NOT: strv
+; CHECK: br %r14
+ %a = load i64, i64* %y, align 8
+ %b = tail call i64 @llvm.bswap.i64(i64 %a)
+ %conv = trunc i64 %b to i32
+ store i32 %conv, i32* %x, align 4
+ ret void
+}
+