1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=sparc < %s | FileCheck %s --check-prefix=V8
3 ; RUN: llc -march=sparcv9 < %s | FileCheck %s --check-prefix=SPARC64
5 ; (this should ideally be doing "add 4+7; and -8", instead of
6 ; "add 7; and -8; add 8"; see comments in LowerDYNAMIC_STACKALLOC)
8 define void @variable_alloca_with_adj_call_stack(i32 %num) nounwind {
9 ; V8-LABEL: variable_alloca_with_adj_call_stack:
10 ; V8: ! %bb.0: ! %entry
11 ; V8-NEXT: save %sp, -96, %sp
12 ; V8-NEXT: add %i0, 7, %i0
13 ; V8-NEXT: and %i0, -8, %i0
14 ; V8-NEXT: sub %sp, %i0, %i0
15 ; V8-NEXT: add %i0, -8, %sp
16 ; V8-NEXT: add %i0, 88, %o0
17 ; V8-NEXT: add %sp, -16, %sp
18 ; V8-NEXT: st %o0, [%sp+104]
19 ; V8-NEXT: st %o0, [%sp+100]
20 ; V8-NEXT: st %o0, [%sp+96]
21 ; V8-NEXT: st %o0, [%sp+92]
22 ; V8-NEXT: mov %o0, %o1
23 ; V8-NEXT: mov %o0, %o2
24 ; V8-NEXT: mov %o0, %o3
25 ; V8-NEXT: mov %o0, %o4
27 ; V8-NEXT: mov %o0, %o5
28 ; V8-NEXT: add %sp, 16, %sp
32 ; SPARC64-LABEL: variable_alloca_with_adj_call_stack:
33 ; SPARC64: ! %bb.0: ! %entry
34 ; SPARC64-NEXT: save %sp, -128, %sp
35 ; SPARC64-NEXT: srl %i0, 0, %i0
36 ; SPARC64-NEXT: add %i0, 15, %i0
37 ; SPARC64-NEXT: sethi 4194303, %i1
38 ; SPARC64-NEXT: or %i1, 1008, %i1
39 ; SPARC64-NEXT: sethi 0, %i2
40 ; SPARC64-NEXT: or %i2, 1, %i2
41 ; SPARC64-NEXT: sllx %i2, 32, %i2
42 ; SPARC64-NEXT: or %i2, %i1, %i1
43 ; SPARC64-NEXT: and %i0, %i1, %i0
44 ; SPARC64-NEXT: sub %sp, %i0, %i0
45 ; SPARC64-NEXT: add %i0, 2175, %o0
46 ; SPARC64-NEXT: mov %i0, %sp
47 ; SPARC64-NEXT: add %sp, -80, %sp
48 ; SPARC64-NEXT: stx %o0, [%sp+2247]
49 ; SPARC64-NEXT: stx %o0, [%sp+2239]
50 ; SPARC64-NEXT: stx %o0, [%sp+2231]
51 ; SPARC64-NEXT: stx %o0, [%sp+2223]
52 ; SPARC64-NEXT: mov %o0, %o1
53 ; SPARC64-NEXT: mov %o0, %o2
54 ; SPARC64-NEXT: mov %o0, %o3
55 ; SPARC64-NEXT: mov %o0, %o4
56 ; SPARC64-NEXT: call foo
57 ; SPARC64-NEXT: mov %o0, %o5
58 ; SPARC64-NEXT: add %sp, 80, %sp
60 ; SPARC64-NEXT: restore
62 %0 = alloca i8, i32 %num, align 8
63 call void @foo(ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0)
67 declare void @foo(ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr);