summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-04-09 17:27:09 +0000
committerHal Finkel <hfinkel@anl.gov>2013-04-09 17:27:09 +0000
commitf6f8198d85f278ff03aaf32c9db6ae0b3826395c (patch)
treeb5b4e76c738f25c5402e812080d5af875f3edc55 /test/CodeGen/PowerPC
parent307b8535ee4cb37ade40fdc7dd36baa7f27fa34c (diff)
downloadllvm-f6f8198d85f278ff03aaf32c9db6ae0b3826395c.tar.gz
llvm-f6f8198d85f278ff03aaf32c9db6ae0b3826395c.tar.bz2
llvm-f6f8198d85f278ff03aaf32c9db6ae0b3826395c.tar.xz
Use virtual base registers on PPC
On PowerPC, non-vector loads and stores have r+i forms; however, in functions with large stack frames these were not being used to access slots far from the stack pointer because such slots were out of range for the signed 16-bit immediate offset field. This increases register pressure because we need a separate register for each offset (when the r+r form is used). By enabling virtual base registers, we can deal with large stack frames without unduly increasing register pressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC')
-rw-r--r--test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll4
-rw-r--r--test/CodeGen/PowerPC/lsa.ll48
2 files changed, 52 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll b/test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll
index 40f46fda46..ba5c8c172f 100644
--- a/test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll
+++ b/test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll
@@ -1,5 +1,9 @@
; RUN: llc < %s -march=ppc64 | FileCheck %s
+; Temporarily XFAIL this test until LSA stops creating single-use
+; virtual base registers.
+; XFAIL: *
+
%struct.__db_region = type { %struct.__mutex_t, [4 x i8], %struct.anon, i32, [1 x i32] }
%struct.__mutex_t = type { i32 }
%struct.anon = type { i64, i64 }
diff --git a/test/CodeGen/PowerPC/lsa.ll b/test/CodeGen/PowerPC/lsa.ll
new file mode 100644
index 0000000000..3daeccbf40
--- /dev/null
+++ b/test/CodeGen/PowerPC/lsa.ll
@@ -0,0 +1,48 @@
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define signext i32 @foo() #0 {
+entry:
+ %v = alloca [8200 x i32], align 4
+ %w = alloca [8200 x i32], align 4
+ %q = alloca [8200 x i32], align 4
+ %0 = bitcast [8200 x i32]* %v to i8*
+ call void @llvm.lifetime.start(i64 32800, i8* %0) #0
+ %1 = bitcast [8200 x i32]* %w to i8*
+ call void @llvm.lifetime.start(i64 32800, i8* %1) #0
+ %2 = bitcast [8200 x i32]* %q to i8*
+ call void @llvm.lifetime.start(i64 32800, i8* %2) #0
+ %arraydecay = getelementptr inbounds [8200 x i32]* %q, i64 0, i64 0
+ %arraydecay1 = getelementptr inbounds [8200 x i32]* %v, i64 0, i64 0
+ %arraydecay2 = getelementptr inbounds [8200 x i32]* %w, i64 0, i64 0
+ call void @bar(i32* %arraydecay, i32* %arraydecay1, i32* %arraydecay2) #0
+ %3 = load i32* %arraydecay2, align 4, !tbaa !0
+ %arrayidx3 = getelementptr inbounds [8200 x i32]* %w, i64 0, i64 1
+ %4 = load i32* %arrayidx3, align 4, !tbaa !0
+
+; CHECK: @foo
+; CHECK-NOT: lwzx
+; CHECK: lwz {{[0-9]+}}, 4([[REG:[0-9]+]])
+; CHECK: lwz {{[0-9]+}}, 0([[REG]])
+; CHECK: blr
+
+ %add = add nsw i32 %4, %3
+ call void @llvm.lifetime.end(i64 32800, i8* %2) #0
+ call void @llvm.lifetime.end(i64 32800, i8* %1) #0
+ call void @llvm.lifetime.end(i64 32800, i8* %0) #0
+ ret i32 %add
+}
+
+declare void @llvm.lifetime.start(i64, i8* nocapture) #0
+
+declare void @bar(i32*, i32*, i32*)
+
+declare void @llvm.lifetime.end(i64, i8* nocapture) #0
+
+attributes #0 = { nounwind }
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+