1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -max-registers-for-gc-values=256 -verify-machineinstrs < %s | FileCheck %s
4 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-pc-win64"
10 define void @test(ptr addrspace(1) %b) gc "statepoint-example" {
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: pushq %rbp
14 ; CHECK-NEXT: .cfi_def_cfa_offset 16
15 ; CHECK-NEXT: pushq %r15
16 ; CHECK-NEXT: .cfi_def_cfa_offset 24
17 ; CHECK-NEXT: pushq %r14
18 ; CHECK-NEXT: .cfi_def_cfa_offset 32
19 ; CHECK-NEXT: pushq %r13
20 ; CHECK-NEXT: .cfi_def_cfa_offset 40
21 ; CHECK-NEXT: pushq %r12
22 ; CHECK-NEXT: .cfi_def_cfa_offset 48
23 ; CHECK-NEXT: pushq %rbx
24 ; CHECK-NEXT: .cfi_def_cfa_offset 56
25 ; CHECK-NEXT: subq $24, %rsp
26 ; CHECK-NEXT: .cfi_def_cfa_offset 80
27 ; CHECK-NEXT: .cfi_offset %rbx, -56
28 ; CHECK-NEXT: .cfi_offset %r12, -48
29 ; CHECK-NEXT: .cfi_offset %r13, -40
30 ; CHECK-NEXT: .cfi_offset %r14, -32
31 ; CHECK-NEXT: .cfi_offset %r15, -24
32 ; CHECK-NEXT: .cfi_offset %rbp, -16
33 ; CHECK-NEXT: movq (%rdi), %rbx
34 ; CHECK-NEXT: movq 8(%rdi), %rax
35 ; CHECK-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
36 ; CHECK-NEXT: movq 16(%rdi), %r14
37 ; CHECK-NEXT: movq 24(%rdi), %r15
38 ; CHECK-NEXT: movq 32(%rdi), %r12
39 ; CHECK-NEXT: movq 40(%rdi), %r13
40 ; CHECK-NEXT: movq 48(%rdi), %rbp
41 ; CHECK-NEXT: movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
42 ; CHECK-NEXT: callq foo@PLT # 8-byte Folded Reload
44 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
45 ; CHECK-NEXT: movq %rbp, %rdi
46 ; CHECK-NEXT: callq bar@PLT
47 ; CHECK-NEXT: movq %r13, %rdi
48 ; CHECK-NEXT: callq bar@PLT
49 ; CHECK-NEXT: movq %r12, %rdi
50 ; CHECK-NEXT: callq bar@PLT
51 ; CHECK-NEXT: movq %r15, %rdi
52 ; CHECK-NEXT: callq bar@PLT
53 ; CHECK-NEXT: movq %r14, %rdi
54 ; CHECK-NEXT: callq bar@PLT
55 ; CHECK-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdi # 8-byte Reload
56 ; CHECK-NEXT: callq bar@PLT
57 ; CHECK-NEXT: addq $24, %rsp
58 ; CHECK-NEXT: .cfi_def_cfa_offset 56
59 ; CHECK-NEXT: popq %rbx
60 ; CHECK-NEXT: .cfi_def_cfa_offset 48
61 ; CHECK-NEXT: popq %r12
62 ; CHECK-NEXT: .cfi_def_cfa_offset 40
63 ; CHECK-NEXT: popq %r13
64 ; CHECK-NEXT: .cfi_def_cfa_offset 32
65 ; CHECK-NEXT: popq %r14
66 ; CHECK-NEXT: .cfi_def_cfa_offset 24
67 ; CHECK-NEXT: popq %r15
68 ; CHECK-NEXT: .cfi_def_cfa_offset 16
69 ; CHECK-NEXT: popq %rbp
70 ; CHECK-NEXT: .cfi_def_cfa_offset 8
73 %p = load ptr addrspace(1), ptr addrspace(1) %b
74 %a6.ptr = getelementptr i64, ptr addrspace(1) %b, i64 1
75 %a6 = load i64, ptr addrspace(1) %a6.ptr
76 %a5.ptr = getelementptr i64, ptr addrspace(1) %b, i64 2
77 %a5 = load i64, ptr addrspace(1) %a5.ptr
78 %a4.ptr = getelementptr i64, ptr addrspace(1) %b, i64 3
79 %a4 = load i64, ptr addrspace(1) %a4.ptr
80 %a3.ptr = getelementptr i64, ptr addrspace(1) %b, i64 4
81 %a3 = load i64, ptr addrspace(1) %a3.ptr
82 %a2.ptr = getelementptr i64, ptr addrspace(1) %b, i64 5
83 %a2 = load i64, ptr addrspace(1) %a2.ptr
84 %a1.ptr = getelementptr i64, ptr addrspace(1) %b, i64 6
85 %a1 = load i64, ptr addrspace(1) %a1.ptr
86 %token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) ["deopt" (ptr addrspace(1) %p)]
87 call void @bar(i64 %a1)
88 call void @bar(i64 %a2)
89 call void @bar(i64 %a3)
90 call void @bar(i64 %a4)
91 call void @bar(i64 %a5)
92 call void @bar(i64 %a6)
96 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
97 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32)