1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -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"
9 define void @test_empty() gc "statepoint-example" {
10 ; CHECK-LABEL: test_empty:
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: pushq %rax
13 ; CHECK-NEXT: .cfi_def_cfa_offset 16
14 ; CHECK-NEXT: callq foo@PLT
16 ; CHECK-NEXT: popq %rax
17 ; CHECK-NEXT: .cfi_def_cfa_offset 8
20 %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) ["gc-live" ()]
24 define void @test_dead(ptr addrspace(1) %p) gc "statepoint-example" {
25 ; CHECK-LABEL: test_dead:
26 ; CHECK: # %bb.0: # %entry
27 ; CHECK-NEXT: pushq %rax
28 ; CHECK-NEXT: .cfi_def_cfa_offset 16
29 ; CHECK-NEXT: callq foo@PLT
31 ; CHECK-NEXT: popq %rax
32 ; CHECK-NEXT: .cfi_def_cfa_offset 8
35 %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) ["gc-live" (ptr addrspace(1) %p)]
39 define ptr addrspace(1) @test_one(ptr addrspace(1) %p) gc "statepoint-example" {
40 ; CHECK-LABEL: test_one:
41 ; CHECK: # %bb.0: # %entry
42 ; CHECK-NEXT: pushq %rax
43 ; CHECK-NEXT: .cfi_def_cfa_offset 16
44 ; CHECK-NEXT: movq %rdi, (%rsp)
45 ; CHECK-NEXT: callq foo@PLT
47 ; CHECK-NEXT: movq (%rsp), %rax
48 ; CHECK-NEXT: popq %rcx
49 ; CHECK-NEXT: .cfi_def_cfa_offset 8
52 %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) ["gc-live" (ptr addrspace(1) %p)]
53 %p2 = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %token, i32 0, i32 0)
54 ret ptr addrspace(1) %p2
57 define ptr addrspace(1) @test_one_derived(ptr addrspace(1) %p) gc "statepoint-example" {
58 ; CHECK-LABEL: test_one_derived:
59 ; CHECK: # %bb.0: # %entry
60 ; CHECK-NEXT: subq $24, %rsp
61 ; CHECK-NEXT: .cfi_def_cfa_offset 32
62 ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp)
63 ; CHECK-NEXT: addq $8, %rdi
64 ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp)
65 ; CHECK-NEXT: callq foo@PLT
67 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax
68 ; CHECK-NEXT: addq $24, %rsp
69 ; CHECK-NEXT: .cfi_def_cfa_offset 8
72 %gep = getelementptr i8, ptr addrspace(1) %p, i32 8
73 %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) ["gc-live" (ptr addrspace(1) %p, ptr addrspace(1) %gep)]
74 %gep2 = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %token, i32 0, i32 1)
75 ret ptr addrspace(1) %gep2
80 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
81 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32)