diff options
author | Jonas Paulsson <paulsson@linux.vnet.ibm.com> | 2018-03-13 08:36:20 +0000 |
---|---|---|
committer | Jonas Paulsson <paulsson@linux.vnet.ibm.com> | 2018-03-13 08:36:20 +0000 |
commit | 5612bb292c861f41c71abf2cb3e48fff93a3f34f (patch) | |
tree | 2b55c35661b2d4899154c2d6eed735bec97694f4 /llvm/test | |
parent | afbf90aef9e7878a2b139c3f7a5ef22b5d34caf7 (diff) | |
download | bcm5719-llvm-5612bb292c861f41c71abf2cb3e48fff93a3f34f.tar.gz bcm5719-llvm-5612bb292c861f41c71abf2cb3e48fff93a3f34f.zip |
[CodeGenPrepare] Respect endianness in splitMergedValStore.
splitMergedValStore will split a store into two if target prefers this, or if
-force-split-store is passed.
This patch adds the missing handling for endianness in this function along
with a test case.
Review: Eli Friedman
https://reviews.llvm.org/D44396
llvm-svn: 327375
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/SystemZ/codegenprepare-splitstore.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/codegenprepare-splitstore.ll b/llvm/test/CodeGen/SystemZ/codegenprepare-splitstore.ll new file mode 100644 index 00000000000..0b1e2b477c2 --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/codegenprepare-splitstore.ll @@ -0,0 +1,22 @@ +; Test that CodeGenPrepare respects endianness when splitting a store. +; +; RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 -force-split-store < %s | FileCheck %s + +define void @fun(i16* %Src, i16* %Dst) { +; CHECK-LABEL: # %bb.0: +; CHECK: lh %r0, 0(%r2) +; CHECK-NEXT: stc %r0, 1(%r3) +; CHECK-NEXT: srl %r0, 8 +; CHECK-NEXT: stc %r0, 0(%r3) +; CHECK-NEXT: br %r14 + %1 = load i16, i16* %Src + %2 = trunc i16 %1 to i8 + %3 = lshr i16 %1, 8 + %4 = trunc i16 %3 to i8 + %5 = zext i8 %2 to i16 + %6 = zext i8 %4 to i16 + %7 = shl nuw i16 %6, 8 + %8 = or i16 %7, %5 + store i16 %8, i16* %Dst + ret void +} |