[CodeGenPrepare] Handle properly the promotion of operands when this does not
[oota-llvm.git] / test / CodeGen / X86 / statepoint-stackmap-format.ll
1 ; RUN: llc < %s | FileCheck %s
2 ; This test is a sanity check to ensure statepoints are generating StackMap
3 ; sections correctly.  This is not intended to be a rigorous test of the 
4 ; StackMap format (see the stackmap tests for that).
5
6 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-pc-linux-gnu"
8
9 declare zeroext i1 @return_i1()
10
11 define i1 @test(i32 addrspace(1)* %ptr) {
12 ; CHECK-LABEL: test
13 ; Do we see one spill for the local value and the store to the
14 ; alloca?
15 ; CHECK: subq   $24, %rsp
16 ; CHECK: movq   $0, 8(%rsp)
17 ; CHECK: movq   %rdi, (%rsp)
18 ; CHECK: callq return_i1
19 ; CHECK: addq   $24, %rsp
20 ; CHECK: retq
21 entry:
22   %metadata1 = alloca i32 addrspace(1)*, i32 2, align 8
23   store i32 addrspace(1)* null, i32 addrspace(1)** %metadata1
24 ; NOTE: Currently NOT testing alloca lowering in the StackMap format.  Its 
25 ; known to be broken.  
26   %safepoint_token = tail call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 2, i32 addrspace(1)* %ptr, i32 addrspace(1)* null)
27   %call1 = call zeroext i1 @llvm.experimental.gc.result.int.i1(i32 %safepoint_token)
28   %a = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 4, i32 4)
29   %b = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %safepoint_token, i32 5, i32 5)
30
31   ret i1 %call1
32 }
33
34 declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...)
35 declare i1 @llvm.experimental.gc.result.int.i1(i32)
36 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3
37
38
39 ; CHECK-LABEL: .section .llvm_stackmaps
40 ; CHECK-NEXT:  __LLVM_StackMaps:
41 ; Header
42 ; CHECK-NEXT:   .byte 1
43 ; CHECK-NEXT:   .byte 0
44 ; CHECK-NEXT:   .short 0
45 ; Num Functions
46 ; CHECK-NEXT:   .long 1
47 ; Num LargeConstants
48 ; CHECK-NEXT:   .long 0
49 ; Num Callsites
50 ; CHECK-NEXT:   .long 1
51
52 ; Functions and stack size
53 ; CHECK-NEXT:   .quad test
54 ; CHECK-NEXT:   .quad 24
55
56 ; Large Constants
57 ; Statepoint ID only
58 ; CHECK: .quad  2882400000
59
60 ; Callsites
61 ; Constant arguments
62 ; CHECK: .long  .Ltmp1-test
63 ; CHECK: .short 0
64 ; CHECK: .short 8
65 ; SmallConstant (0)
66 ; CHECK: .byte  4
67 ; CHECK: .byte  8
68 ; CHECK: .short 0
69 ; CHECK: .long  0
70 ; SmallConstant (2)
71 ; CHECK: .byte  4
72 ; CHECK: .byte  8
73 ; CHECK: .short 0
74 ; CHECK: .long  2
75 ; Direct Spill Slot [RSP+0]
76 ; CHECK: .byte  2
77 ; CHECK: .byte  8
78 ; CHECK: .short 7
79 ; CHECK: .long  0
80 ; SmallConstant  (0)
81 ; CHECK: .byte  4
82 ; CHECK: .byte  8
83 ; CHECK: .short 0
84 ; CHECK: .long  0
85 ; SmallConstant  (0)
86 ; CHECK: .byte  4
87 ; CHECK: .byte  8
88 ; CHECK: .short 0
89 ; CHECK: .long  0
90 ; SmallConstant  (0)
91 ; CHECK: .byte  4
92 ; CHECK: .byte  8
93 ; CHECK: .short 0
94 ; CHECK: .long  0
95 ; Direct Spill Slot [RSP+0]
96 ; CHECK: .byte  2
97 ; CHECK: .byte  8
98 ; CHECK: .short 7
99 ; CHECK: .long  0
100 ; Direct Spill Slot [RSP+0]
101 ; CHECK: .byte  2
102 ; CHECK: .byte  8
103 ; CHECK: .short 7
104 ; CHECK: .long  0
105
106 ; No Padding or LiveOuts
107 ; CHECK: .short 0
108 ; CHECK: .short 0
109 ; CHECK: .align 8
110
111