diff options
author | Tony Jiang <jtony@ca.ibm.com> | 2017-07-11 16:42:20 +0000 |
---|---|---|
committer | Tony Jiang <jtony@ca.ibm.com> | 2017-07-11 16:42:20 +0000 |
commit | f6179755b35936e58a2098f0ddc3ce7113385448 (patch) | |
tree | 5fc38c186ec12072247ac05d979a8126ca87fe1b /test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll | |
parent | 609a5df2257e4da2336f0aa162e03fd8429fc4cd (diff) |
[PPC] Fix two bugs in frame lowering.
1. The available program storage region of the red zone to compilers is 288
bytes rather than 244 bytes.
2. The formula for negative number alignment calculation should be
y = x & ~(n-1) rather than y = (x + (n-1)) & ~(n-1).
Differential Revision: https://reviews.llvm.org/D34337
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll')
-rw-r--r-- | test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll b/test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll new file mode 100644 index 00000000000..87b45beeab7 --- /dev/null +++ b/test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll @@ -0,0 +1,32 @@ +; Note the formula for negative number alignment calculation should be y = x & ~(n-1) rather than y = (x + (n-1)) & ~(n-1). +; after patch https://reviews.llvm.org/D34337, we could save 16 bytes in the best case. +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s -check-prefix=CHECK-BE +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s -check-prefix=CHECK-LE + +define signext i32 @bar(i32 signext %ii) { +entry: + %0 = tail call i32 asm sideeffect "add $0, $1, $2\0A", "=r,r,r,~{f14},~{r15},~{v20}"(i32 %ii, i32 10) + ret i32 %0 +; Before the fix by patch D34337: +; stdu 1, -544(1) +; std 15, 264(1) +; stfd 14, 400(1) +; stdu 1, -560(1) +; std 15, 280(1) +; stfd 14, 416(1) + +; After the fix by patch D34337: +; CHECK-LE: stdu 1, -528(1) +; CHECK-LE:std 15, 248(1) +; CHECK-LE:stfd 14, 384(1) +; CHECK-BE: stdu 1, -544(1) +; CHECK-BE:std 15, 264(1) +; CHECK-BE:stfd 14, 400(1) +} + +define signext i32 @foo() { +entry: + %call = tail call signext i32 @bar(i32 signext 5) + ret i32 %call +} + |