OSDN Git Service

[StackMaps] Increase the size of the "location size" field
[android-x86/external-llvm.git] / test / CodeGen / X86 / deopt-bundles.ll
1 ; RUN: llc     < %s | FileCheck %s
2 ; RUN: llc -O3 < %s | FileCheck %s
3 ; RUN: llc -O3 -debug-only=stackmaps < %s 2>&1 | FileCheck -check-prefix=STACKMAPS %s
4 ; REQUIRES: asserts
5
6 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-apple-macosx10.11.0"
8
9
10 ; STACKMAPS: Stack Maps: callsite 2882400015
11 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
12 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
13 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
14 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
15 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
16 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
17 ; STACKMAPS-NEXT: Stack Maps: callsite 4242
18 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
19 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
20 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
21 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
22 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
23 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
24 ; STACKMAPS-NEXT: Stack Maps: callsite 4243
25 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
26 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
27 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
28 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
29 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Constant 16      [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 16]
30 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
31 ; STACKMAPS-NEXT: Stack Maps: callsite 2882400015
32 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
33 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
34 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
35 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
36 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Constant 2       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 2]
37 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
38 ; STACKMAPS-NEXT: Stack Maps: callsite 2882400015
39 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
40 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
41 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
42 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
43 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Constant 3       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 3]
44 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
45 ; STACKMAPS-NEXT: Stack Maps: callsite 4243
46 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
47 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
48 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
49 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
50 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Constant 55      [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 55]
51 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
52
53 declare i32 @callee_0()
54 declare i32 @callee_1(i32)
55 declare i32 @callee_vararg(...)
56
57 define i32 @caller_0() {
58 ; CHECK-LABEL: _caller_0
59 entry:
60   %v = call i32 @callee_0() [ "deopt"(i32 0) ]
61   %v2 = add i32 %v, 1
62   ret i32 %v2
63 ; CHECK:        callq   _callee_0
64 ; CHECK:        incl    %eax
65 ; CHECK:        retq
66 }
67
68 define i32 @caller_1() {
69 ; CHECK-LABEL: _caller_1
70 entry:
71   %v = call i32 @callee_1(i32 42) "statepoint-id"="4242" [ "deopt"(i32 1) ]
72   ret i32 %v
73 ; CHECK:        callq   _callee_1
74 ; CHECK:        popq    %rcx
75 ; CHECK:        retq
76 }
77
78 define i32 @caller_vararg() {
79 ; CHECK-LABEL: _caller_vararg
80 entry:
81 ; CHECK: movb    $1, %al
82 ; CHECK: callq   _callee_vararg
83   %v = call i32(...) @callee_vararg(i32 42, double 500.0) "statepoint-id"="4243" [ "deopt"(i32 16) ]
84   ret i32 %v
85 }
86
87 define i32 @invoker_0() personality i8 0 {
88 ; CHECK-LABEL: _invoker_0
89 entry:
90   %v = invoke i32 @callee_0() [ "deopt"(i32 2) ]
91           to label %normal unwind label %uw
92
93 normal:
94   ret i32 %v
95
96 uw:
97   %ehvals = landingpad { i8*, i32 }
98       cleanup
99   ret i32 1
100 ; CHECK:        callq   _callee_0
101 ; CHECK:        popq    %rcx
102 ; CHECK:        retq
103 ; CHECK:        movl    $1, %eax
104 ; CHECK:        popq    %rcx
105 ; CHECK:        retq
106 }
107
108 define i32 @invoker_1() personality i8 0 {
109 ; CHECK-LABEL: _invoker_1
110 entry:
111   %v = invoke i32 @callee_1(i32 45) "statepoint-num-patch-bytes"="9" [ "deopt"(i32 3) ]
112           to label %normal unwind label %uw
113
114 normal:
115   ret i32 %v
116
117 uw:
118   %ehvals = landingpad { i8*, i32 }
119       cleanup
120   ret i32 1
121 ; CHECK:        movl    $45, %edi
122 ; CHECK:        nopw    512(%rax,%rax)
123 ; CHECK:        popq    %rcx
124 ; CHECK:        retq
125 ; CHECK:        movl    $1, %eax
126 ; CHECK:        popq    %rcx
127 ; CHECK:        retq
128 }
129
130 define i32 @invoker_2() personality i32 (...)* @__CxxFrameHandler3 {
131 entry:
132   %val = invoke i32 @callee_1(i32 1)
133           to label %try.cont unwind label %catch.dispatch
134
135 catch.dispatch:
136   %cs1 = catchswitch within none [label %catch] unwind to caller
137
138 catch:
139   %cp1 = catchpad within %cs1 [i8* null, i32 64, i8* null]
140   %val2 = call i32 @callee_1(i32 100) "statepoint-id"="4243" [ "funclet"(token %cp1), "deopt"(i32 55) ]
141   catchret from %cp1 to label %try.cont
142
143 try.cont:
144   ret i32 0
145 }
146
147 declare i32 @__CxxFrameHandler3(...)
148
149 define void @f_0(i64 %n) {
150   ; CHECK-LABEL: _f_0
151   %s = alloca i64
152   %vl = alloca i64, i64 %n
153   ; Check that the stackmap does not reference %s through
154   ; SP since the offset is not static because of %vl.
155   ; STACKMAPS: Loc 3: Direct 6
156   call void @g_0(i64* %vl) [ "deopt"(i64* %s) ]
157   ret void
158 }
159
160 declare void @g_0(i64* %vl)
161
162 define void @vector_deopt_bundle(<32 x i64 addrspace(1)*> %val) {
163 ; CHECK-LABEL: _vector_deopt_bundle:
164 ; CHECK: movaps  16(%rbp), %xmm8
165 ; CHECK-NEXT: movaps  32(%rbp), %xmm9
166 ; CHECK-NEXT: movaps  48(%rbp), %xmm10
167 ; CHECK-NEXT: movaps  64(%rbp), %xmm11
168 ; CHECK-NEXT: movaps  80(%rbp), %xmm12
169 ; CHECK-NEXT: movaps  96(%rbp), %xmm13
170 ; CHECK-NEXT: movaps  112(%rbp), %xmm14
171 ; CHECK-NEXT: movaps  128(%rbp), %xmm15
172 ; CHECK-NEXT: movaps  %xmm15, 240(%rsp)
173 ; CHECK-NEXT: movaps  %xmm14, 224(%rsp)
174 ; CHECK-NEXT: movaps  %xmm13, 208(%rsp)
175 ; CHECK-NEXT: movaps  %xmm12, 192(%rsp)
176 ; CHECK-NEXT: movaps  %xmm11, 176(%rsp)
177 ; CHECK-NEXT: movaps  %xmm10, 160(%rsp)
178 ; CHECK-NEXT: movaps  %xmm9, 144(%rsp)
179 ; CHECK-NEXT: movaps  %xmm8, 128(%rsp)
180 ; CHECK-NEXT: movaps  %xmm7, 112(%rsp)
181 ; CHECK-NEXT: movaps  %xmm6, 96(%rsp)
182 ; CHECK-NEXT: movaps  %xmm5, 80(%rsp)
183 ; CHECK-NEXT: movaps  %xmm4, 64(%rsp)
184 ; CHECK-NEXT: movaps  %xmm3, 48(%rsp)
185 ; CHECK-NEXT: movaps  %xmm2, 32(%rsp)
186 ; CHECK-NEXT: movaps  %xmm1, 16(%rsp)
187 ; CHECK-NEXT: movaps  %xmm0, (%rsp)
188   call void @unknown() [ "deopt"(<32 x i64 addrspace(1)*> %val) ]
189   ret void
190 ; STACKMAPS: Stack Maps: callsite 2882400015
191 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
192 ; STACKMAPS-NEXT: Stack Maps:           Loc 0: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
193 ; STACKMAPS-NEXT: Stack Maps:           Loc 1: Constant 0       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
194 ; STACKMAPS-NEXT: Stack Maps:           Loc 2: Constant 1       [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
195 ; STACKMAPS-NEXT: Stack Maps:           Loc 3: Indirect 7+0     [encoding: .byte 3, .byte 0, .short 256, .short 7, .short 0, .int 0]
196 ; STACKMAPS-NEXT: Stack Maps:   has 0 live-out registers
197 }
198
199 declare void @unknown()