summaryrefslogtreecommitdiff
path: root/test/CodeGen/SPARC
diff options
context:
space:
mode:
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-06-01 04:51:18 +0000
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-06-01 04:51:18 +0000
commit72ad17c48c15562fe31c65f6daa09c83f42860c1 (patch)
tree90c980de9939263feabe0c7dbb71b87247516b33 /test/CodeGen/SPARC
parent2e2922cd90922eaf3736421bd0ad4331f89f3e75 (diff)
downloadllvm-72ad17c48c15562fe31c65f6daa09c83f42860c1.tar.gz
llvm-72ad17c48c15562fe31c65f6daa09c83f42860c1.tar.bz2
llvm-72ad17c48c15562fe31c65f6daa09c83f42860c1.tar.xz
[Sparc] Generate correct code for leaf functions with stack objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SPARC')
-rw-r--r--test/CodeGen/SPARC/leafproc.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/SPARC/leafproc.ll b/test/CodeGen/SPARC/leafproc.ll
index 5abdfba3e7..a162df1b0c 100644
--- a/test/CodeGen/SPARC/leafproc.ll
+++ b/test/CodeGen/SPARC/leafproc.ll
@@ -55,3 +55,26 @@ entry:
%6 = add nsw i32 %5, %h
ret i32 %6
}
+
+; CHECK: leaf_proc_with_local_array:
+; CHECK: add %sp, -104, %sp
+; CHECK: or %g0, 1, [[R1:%[go][0-7]]]
+; CHECK: st [[R1]], [%sp+96]
+; CHECK: or %g0, 2, [[R2:%[go][0-7]]]
+; CHECK: st [[R2]], [%sp+100]
+; CHECK: ld {{.+}}, %o0
+; CHECK: jmp %o7+8
+; CHECK-NEXT: add %sp, 104, %sp
+
+define i32 @leaf_proc_with_local_array(i32 %a, i32 %b, i32 %c) {
+entry:
+ %array = alloca [2 x i32], align 4
+ %0 = sub nsw i32 %b, %c
+ %1 = getelementptr inbounds [2 x i32]* %array, i32 0, i32 0
+ store i32 1, i32* %1, align 4
+ %2 = getelementptr inbounds [2 x i32]* %array, i32 0, i32 1
+ store i32 2, i32* %2, align 4
+ %3 = getelementptr inbounds [2 x i32]* %array, i32 0, i32 %a
+ %4 = load i32* %3, align 4
+ ret i32 %4
+}