aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/SPARC/2013-05-17-CallFrame.ll
blob: 4a4db8c2ebaa6b4d136f540d803f6f6f893433e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=sparc < %s | FileCheck %s --check-prefix=V8
; RUN: llc -mtriple=sparcv9 < %s | FileCheck %s --check-prefix=SPARC64

; (this should ideally be doing "add 4+7; and -8", instead of
;  "add 7; and -8; add 8"; see comments in LowerDYNAMIC_STACKALLOC)

define void @variable_alloca_with_adj_call_stack(i32 %num) nounwind {
; V8-LABEL: variable_alloca_with_adj_call_stack:
; V8:       ! %bb.0: ! %entry
; V8-NEXT:    save %sp, -96, %sp
; V8-NEXT:    add %i0, 7, %i0
; V8-NEXT:    and %i0, -8, %i0
; V8-NEXT:    sub %sp, %i0, %i0
; V8-NEXT:    add %i0, -8, %sp
; V8-NEXT:    add %i0, 88, %o0
; V8-NEXT:    add %sp, -16, %sp
; V8-NEXT:    st %o0, [%sp+104]
; V8-NEXT:    st %o0, [%sp+100]
; V8-NEXT:    st %o0, [%sp+96]
; V8-NEXT:    st %o0, [%sp+92]
; V8-NEXT:    mov %o0, %o1
; V8-NEXT:    mov %o0, %o2
; V8-NEXT:    mov %o0, %o3
; V8-NEXT:    mov %o0, %o4
; V8-NEXT:    call foo
; V8-NEXT:    mov %o0, %o5
; V8-NEXT:    add %sp, 16, %sp
; V8-NEXT:    ret
; V8-NEXT:    restore
;
; SPARC64-LABEL: variable_alloca_with_adj_call_stack:
; SPARC64:       ! %bb.0: ! %entry
; SPARC64-NEXT:    save %sp, -128, %sp
; SPARC64-NEXT:    srl %i0, 0, %i0
; SPARC64-NEXT:    add %i0, 15, %i0
; SPARC64-NEXT:    sethi 4194303, %i1
; SPARC64-NEXT:    or %i1, 1008, %i1
; SPARC64-NEXT:    sethi 0, %i2
; SPARC64-NEXT:    or %i2, 1, %i2
; SPARC64-NEXT:    sllx %i2, 32, %i2
; SPARC64-NEXT:    or %i2, %i1, %i1
; SPARC64-NEXT:    and %i0, %i1, %i0
; SPARC64-NEXT:    sub %sp, %i0, %i0
; SPARC64-NEXT:    add %i0, 2175, %o0
; SPARC64-NEXT:    mov %i0, %sp
; SPARC64-NEXT:    add %sp, -80, %sp
; SPARC64-NEXT:    stx %o0, [%sp+2247]
; SPARC64-NEXT:    stx %o0, [%sp+2239]
; SPARC64-NEXT:    stx %o0, [%sp+2231]
; SPARC64-NEXT:    stx %o0, [%sp+2223]
; SPARC64-NEXT:    mov %o0, %o1
; SPARC64-NEXT:    mov %o0, %o2
; SPARC64-NEXT:    mov %o0, %o3
; SPARC64-NEXT:    mov %o0, %o4
; SPARC64-NEXT:    call foo
; SPARC64-NEXT:    mov %o0, %o5
; SPARC64-NEXT:    add %sp, 80, %sp
; SPARC64-NEXT:    ret
; SPARC64-NEXT:    restore
entry:
  %0 = alloca i8, i32 %num, align 8
  call void @foo(ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0, ptr %0)
  ret void
}

declare void @foo(ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr);