xref: /llvm-project/llvm/test/CodeGen/AArch64/swift-async-win.ll (revision c649fd34e928ad01951cbff298c5c44853dd41dd)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2; RUN: llc -mtriple aarch64-unknown-windows -swift-async-fp=never -aarch64-enable-sink-fold=true -filetype asm -o - %s | FileCheck %s
3
4; ModuleID = '_Concurrency.ll'
5source_filename = "_Concurrency.ll"
6target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
7target triple = "aarch64-unknown-windows-msvc19.32.31302"
8
9%swift.context = type { ptr, ptr }
10
11; Function Attrs: argmemonly nofree nosync nounwind willreturn
12declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
13
14; NOTE: we do not see the canonical windows frame setup due to the `nounwind`
15; attribtue on the function.
16
17; Function Attrs: nounwind
18define hidden swifttailcc void @"$ss23withCheckedContinuation8function_xSS_yScCyxs5NeverOGXEtYalFTQ0_"(ptr nocapture readonly %0) #1 {
19; CHECK-LABEL: $ss23withCheckedContinuation8function_xSS_yScCyxs5NeverOGXEtYalFTQ0_:
20; CHECK:       // %bb.0: // %entryresume.0
21; CHECK-NEXT:    sub sp, sp, #48
22; CHECK-NEXT:    stp x30, x29, [sp, #24] // 16-byte Folded Spill
23; CHECK-NEXT:    add x29, sp, #24
24; CHECK-NEXT:    str x19, [sp, #40] // 8-byte Folded Spill
25; CHECK-NEXT:    adrp x19, __imp_swift_task_dealloc
26; CHECK-NEXT:    str xzr, [sp, #16]
27; CHECK-NEXT:    ldr x8, [x0]
28; CHECK-NEXT:    stur x8, [x29, #-8]
29; CHECK-NEXT:    ldr x20, [x0]
30; CHECK-NEXT:    ldp x22, x0, [x8, #16]
31; CHECK-NEXT:    stur x20, [x29, #-8]
32; CHECK-NEXT:    ldr x19, [x19, :lo12:__imp_swift_task_dealloc]
33; CHECK-NEXT:    blr x19
34; CHECK-NEXT:    mov x0, x22
35; CHECK-NEXT:    blr x19
36; CHECK-NEXT:    ldp x30, x29, [sp, #24] // 16-byte Folded Reload
37; CHECK-NEXT:    mov x0, x20
38; CHECK-NEXT:    ldr x1, [x20, #8]
39; CHECK-NEXT:    ldr x19, [sp, #40] // 8-byte Folded Reload
40; CHECK-NEXT:    add sp, sp, #48
41; CHECK-NEXT:    br x1
42entryresume.0:
43  %1 = load ptr, ptr %0, align 8
44  %2 = tail call ptr @llvm.swift.async.context.addr() #4
45  store ptr %1, ptr %2, align 8
46  %async.ctx.frameptr1 = getelementptr inbounds i8, ptr %1, i64 16
47  %.reload.addr4 = getelementptr inbounds i8, ptr %1, i64 24
48  %.reload5 = load ptr, ptr %.reload.addr4, align 8
49  %.reload = load ptr, ptr %async.ctx.frameptr1, align 8
50  %3 = load ptr, ptr %0, align 8
51  store ptr %3, ptr %2, align 8
52  tail call swiftcc void @swift_task_dealloc(ptr %.reload5) #4
53  tail call void @llvm.lifetime.end.p0(i64 -1, ptr %.reload5)
54  tail call swiftcc void @swift_task_dealloc(ptr %.reload) #4
55  %4 = getelementptr inbounds i8, ptr %3, i64 8
56  %5 = load ptr, ptr %4, align 8
57  musttail call swifttailcc void %5(ptr %3) #4
58  ret void
59}
60
61
62; Function Attrs: nounwind readnone
63declare ptr @llvm.swift.async.context.addr() #2
64
65; Function Attrs: argmemonly nounwind
66declare dllimport swiftcc void @swift_task_dealloc(ptr) local_unnamed_addr #3
67
68attributes #0 = { argmemonly nofree nosync nounwind willreturn }
69attributes #1 = { nounwind "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" }
70attributes #2 = { nounwind readnone }
71attributes #3 = { argmemonly nounwind }
72attributes #4 = { nounwind }
73
74