1 ; RUN: llc -mtriple x86_64-unknown-windows-msvc %s -o - | FileCheck %s -check-prefix CHECK64
2 ; RUN: llc -mtriple i686-windows-msvc %s -o - | FileCheck %s -check-prefix CHECK32
4 define void @simple(ptr swiftasync %context) "frame-pointer"="all" {
8 ; CHECK64-LABEL: simple:
11 ; CHECK64: movq %rsp, %rbp
12 ; CHECK64: movq %r14, (%rbp)
13 ; CHECK64: addq $8, %rsp
17 ; CHECK32-LABEL: simple:
18 ; CHECK32: movl 8(%ebp), [[TMP:%.*]]
19 ; CHECK32: movl [[TMP]], {{.*}}(%ebp)
21 define void @more_csrs(ptr swiftasync %context) "frame-pointer"="all" {
22 call void asm sideeffect "", "~{r15}"()
26 ; CHECK64-LABEL: more_csrs:
28 ; CHECK64: .seh_pushreg %rbp
30 ; CHECK64: .seh_pushreg %r15
32 ; CHECK64: .seh_stackalloc 8
33 ; CHECK64: movq %rsp, %rbp
34 ; CHECK64: .seh_setframe %rbp, 0
35 ; CHECK64: .seh_endprologue
36 ; CHECK64: movq %r14, (%rbp)
38 ; CHECK64: addq $8, %rsp
45 define void @locals(ptr swiftasync %context) "frame-pointer"="all" {
46 %var = alloca i32, i32 10
47 call void @f(ptr %var)
51 ; CHECK64-LABEL: locals:
53 ; CHECK64: .seh_pushreg %rbp
54 ; CHECK64: subq $80, %rsp
55 ; CHECK64: movq %r14, -8(%rbp)
57 ; CHECK64: leaq -48(%rbp), %rcx
60 ; CHECK64: addq $80, %rsp
64 define void @use_input_context(ptr swiftasync %context, ptr %ptr) "frame-pointer"="all" {
65 store ptr %context, ptr %ptr
69 ; CHECK64-LABEL: use_input_context:
70 ; CHECK64: movq %r14, (%rcx)
72 declare ptr @llvm.swift.async.context.addr()
74 define ptr @context_in_func() "frmae-pointer"="non-leaf" {
75 %ptr = call ptr @llvm.swift.async.context.addr()
79 ; CHECK64-LABEL: context_in_func:
80 ; CHECK64: movq %rsp, %rax
82 ; CHECK32-LABEL: context_in_func:
83 ; CHECK32: movl %esp, %eax
85 define void @write_frame_context(ptr swiftasync %context, ptr %new_context) "frame-pointer"="non-leaf" {
86 %ptr = call ptr @llvm.swift.async.context.addr()
87 store ptr %new_context, ptr %ptr
91 ; CHECK64-LABEL: write_frame_context:
92 ; CHECK64: movq %rcx, (%rsp)
94 define void @simple_fp_elim(ptr swiftasync %context) "frame-pointer"="non-leaf" {
98 ; CHECK64-LABEL: simple_fp_elim:
101 define void @manylocals_and_overwritten_context(ptr swiftasync %context, ptr %new_context) "frame-pointer"="all" {
102 %ptr = call ptr @llvm.swift.async.context.addr()
103 store ptr %new_context, ptr %ptr
104 %var1 = alloca i64, i64 1
105 call void @f(ptr %var1)
106 %var2 = alloca i64, i64 16
107 call void @f(ptr %var2)
108 %ptr2 = call ptr @llvm.swift.async.context.addr()
109 store ptr %new_context, ptr %ptr2
113 ; CHECK64-LABEL: manylocals_and_overwritten_context:
114 ; CHECK64: pushq %rbp
115 ; CHECK64: subq $184, %rsp
116 ; CHECK64: leaq 128(%rsp), %rbp
117 ; CHECK64: movq %rcx, %rsi
118 ; CHECK64: movq %rcx, 48(%rbp)
121 ; CHECK64: movq %rsi, 48(%rbp)