1 ; RUN: llc -mtriple=x86_64-apple-macosx12.0 %s -o - | FileCheck %s
2 ; RUN: llc -mtriple=i686-apple-darwin %s -o - | FileCheck %s --check-prefix=CHECK-32
5 define void @simple(ptr swiftasync %ctx) "frame-pointer"="all" {
7 ; CHECK: btsq $60, %rbp
10 ; CHECK: leaq 8(%rsp), %rbp
14 ; CHECK: addq $16, %rsp
16 ; CHECK: btrq $60, %rbp
19 ; CHECK-32-LABEL: simple:
20 ; CHECK-32: movl 8(%ebp), [[TMP:%.*]]
21 ; CHECK-32: movl [[TMP]], {{.*}}(%ebp)
26 define void @more_csrs(ptr swiftasync %ctx) "frame-pointer"="all" {
27 ; CHECK-LABEL: more_csrs:
28 ; CHECK: btsq $60, %rbp
30 ; CHECK: .cfi_offset %rbp, -16
32 ; CHECK: leaq 8(%rsp), %rbp
33 ; CHECK: subq $8, %rsp
35 ; CHECK: .cfi_offset %r15, -40
40 ; CHECK: addq $16, %rsp
42 ; CHECK: btrq $60, %rbp
44 call void asm sideeffect "", "~{r15}"()
48 define void @locals(ptr swiftasync %ctx) "frame-pointer"="all" {
49 ; CHECK-LABEL: locals:
50 ; CHECK: btsq $60, %rbp
52 ; CHECK: .cfi_def_cfa_offset 16
53 ; CHECK: .cfi_offset %rbp, -16
55 ; CHECK: leaq 8(%rsp), %rbp
56 ; CHECK: .cfi_def_cfa_register %rbp
57 ; CHECK: subq $56, %rsp
59 ; CHECK: leaq -48(%rbp), %rdi
62 ; CHECK: addq $48, %rsp
63 ; CHECK: addq $16, %rsp
65 ; CHECK: btrq $60, %rbp
68 %var = alloca i32, i32 10
69 call void @bar(ptr %var)
73 define void @use_input_context(ptr swiftasync %ctx, ptr %ptr) "frame-pointer"="all" {
74 ; CHECK-LABEL: use_input_context:
75 ; CHECK: movq %r14, (%rdi)
77 store ptr %ctx, ptr %ptr
81 define ptr @context_in_func() "frame-pointer"="non-leaf" {
82 ; CHECK-LABEL: context_in_func:
83 ; CHECK: leaq -8(%rbp), %rax
85 ; CHECK-32-LABEL: context_in_func
86 ; CHECK-32: movl %esp, %eax
88 %ptr = call ptr @llvm.swift.async.context.addr()
92 define void @write_frame_context(ptr swiftasync %ctx, ptr %newctx) "frame-pointer"="non-leaf" {
93 ; CHECK-LABEL: write_frame_context:
94 ; CHECK: movq %rbp, [[TMP:%.*]]
95 ; CHECK: subq $8, [[TMP]]
96 ; CHECK: movq %rdi, ([[TMP]])
98 %ptr = call ptr @llvm.swift.async.context.addr()
99 store ptr %newctx, ptr %ptr
103 define void @simple_fp_elim(ptr swiftasync %ctx) "frame-pointer"="non-leaf" {
104 ; CHECK-LABEL: simple_fp_elim:
110 declare void @bar(ptr)
111 declare ptr @llvm.swift.async.context.addr()