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 | d5acad053b54315818ef81133844d6ff754959d7 (patch) | |
tree | 267070bbd30104f39ee79ebec93a5c19ae1c3df2 /llvm/test/CodeGen | |
parent | c86e2ef3f56ada69643832ca06270402f643b0d0 (diff) | |
download | bcm5719-llvm-d5acad053b54315818ef81133844d6ff754959d7.tar.gz bcm5719-llvm-d5acad053b54315818ef81133844d6ff754959d7.zip |
[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
llvm-svn: 307672
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll | 32 | ||||
-rw-r--r-- | llvm/test/CodeGen/PowerPC/svr4-redzone.ll | 6 | ||||
-rw-r--r-- | llvm/test/CodeGen/PowerPC/tailcall1-64.ll | 6 |
3 files changed, 40 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll b/llvm/test/CodeGen/PowerPC/ppc-redzone-alignment-bug.ll new file mode 100644 index 00000000000..87b45beeab7 --- /dev/null +++ b/llvm/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 +} + diff --git a/llvm/test/CodeGen/PowerPC/svr4-redzone.ll b/llvm/test/CodeGen/PowerPC/svr4-redzone.ll index 7bb6cc180c9..26c4410ded6 100644 --- a/llvm/test/CodeGen/PowerPC/svr4-redzone.ll +++ b/llvm/test/CodeGen/PowerPC/svr4-redzone.ll @@ -29,11 +29,11 @@ entry: define i8* @bigstack() nounwind { entry: - %0 = alloca i8, i32 230 + %0 = alloca i8, i32 290 ret i8* %0 } ; PPC32-LABEL: bigstack: -; PPC32: stwu 1, -240(1) +; PPC32: stwu 1, -304(1) ; PPC64-LABEL: bigstack: -; PPC64: stdu 1, -288(1) +; PPC64: stdu 1, -352(1) diff --git a/llvm/test/CodeGen/PowerPC/tailcall1-64.ll b/llvm/test/CodeGen/PowerPC/tailcall1-64.ll index 3dc2672556e..21d6046a30c 100644 --- a/llvm/test/CodeGen/PowerPC/tailcall1-64.ll +++ b/llvm/test/CodeGen/PowerPC/tailcall1-64.ll @@ -1,4 +1,5 @@ ; RUN: llc -relocation-model=static -verify-machineinstrs < %s -march=ppc64 -tailcallopt | grep TC_RETURNd8 +; RUN: llc -relocation-model=static -verify-machineinstrs -march=ppc64 < %s | FileCheck %s define fastcc i32 @tailcallee(i32 %a1, i32 %a2, i32 %a3, i32 %a4) { entry: ret i32 %a3 @@ -6,6 +7,9 @@ entry: define fastcc i32 @tailcaller(i32 %in1, i32 %in2) { entry: - %tmp11 = tail call fastcc i32 @tailcallee( i32 %in1, i32 %in2, i32 %in1, i32 %in2 ) ; <i32> [#uses=1] + %tmp11 = tail call fastcc i32 @tailcallee( i32 %in1, i32 %in2, i32 %in1, i32 %in2 ) ret i32 %tmp11 +; CHECK-LABEL: tailcaller +; CHECK-NOT: stdu +; CHECK: b tailcallee } |