1; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-stackmap-liveness| FileCheck -check-prefix=STACK %s
3; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-patchpoint-liveness| FileCheck -check-prefix=PATCH %s
4;
5; Note: Print verbose stackmaps using -debug-only=stackmaps.
6
7; CHECK-LABEL:  .section  __LLVM_STACKMAPS,__llvm_stackmaps
8; CHECK-NEXT:   __LLVM_StackMaps:
9; Header
10; CHECK-NEXT:   .byte 1
11; CHECK-NEXT:   .byte 0
12; CHECK-NEXT:   .short 0
13; Num Functions
14; CHECK-NEXT:   .long 2
15; Num LargeConstants
16; CHECK-NEXT:   .long   0
17; Num Callsites
18; CHECK-NEXT:   .long   5
19
20; Functions and stack size
21; CHECK-NEXT:   .quad _stackmap_liveness
22; CHECK-NEXT:   .quad 8
23; CHECK-NEXT:   .quad _mixed_liveness
24; CHECK-NEXT:   .quad 8
25
26define void @stackmap_liveness() {
27entry:
28  %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
29; StackMap 1 (no liveness information available)
30; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
31; CHECK-NEXT:   .short  0
32; CHECK-NEXT:   .short  0
33; Padding
34; CHECK-NEXT:   .short  0
35; Num LiveOut Entries: 0
36; CHECK-NEXT:   .short  0
37; Align
38; CHECK-NEXT:   .align  3
39
40; StackMap 1 (stackmap liveness information enabled)
41; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
42; STACK-NEXT:   .short  0
43; STACK-NEXT:   .short  0
44; Padding
45; STACK-NEXT:   .short  0
46; Num LiveOut Entries: 2
47; STACK-NEXT:   .short  2
48; LiveOut Entry 1: %RSP (8 bytes)
49; STACK-NEXT:   .short  7
50; STACK-NEXT:   .byte 0
51; STACK-NEXT:   .byte 8
52; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
53; STACK-NEXT:   .short  19
54; STACK-NEXT:   .byte 0
55; STACK-NEXT:   .byte 16
56; Align
57; STACK-NEXT:   .align  3
58
59; StackMap 1 (patchpoint liveness information enabled)
60; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
61; PATCH-NEXT:   .short  0
62; PATCH-NEXT:   .short  0
63; Padding
64; PATCH-NEXT:   .short  0
65; Num LiveOut Entries: 0
66; PATCH-NEXT:   .short  0
67; Align
68; PATCH-NEXT:   .align  3
69  call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 1, i32 5)
70  %a2 = call i64 asm sideeffect "", "={r8}"() nounwind
71  %a3 = call i8 asm sideeffect "", "={ah}"() nounwind
72  %a4 = call <4 x double> asm sideeffect "", "={ymm0}"() nounwind
73  %a5 = call <4 x double> asm sideeffect "", "={ymm1}"() nounwind
74
75; StackMap 2 (no liveness information available)
76; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
77; CHECK-NEXT:   .short  0
78; CHECK-NEXT:   .short  0
79; Padding
80; CHECK-NEXT:   .short  0
81; Num LiveOut Entries: 0
82; CHECK-NEXT:   .short  0
83; Align
84; CHECK-NEXT:   .align  3
85
86; StackMap 2 (stackmap liveness information enabled)
87; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
88; STACK-NEXT:   .short  0
89; STACK-NEXT:   .short  0
90; Padding
91; STACK-NEXT:   .short  0
92; Num LiveOut Entries: 6
93; STACK-NEXT:   .short  6
94; LiveOut Entry 1: %RAX (1 bytes) --> %AL or %AH
95; STACK-NEXT:   .short  0
96; STACK-NEXT:   .byte 0
97; STACK-NEXT:   .byte 1
98; LiveOut Entry 2: %RSP (8 bytes)
99; STACK-NEXT:   .short  7
100; STACK-NEXT:   .byte 0
101; STACK-NEXT:   .byte 8
102; LiveOut Entry 3: %R8 (8 bytes)
103; STACK-NEXT:   .short  8
104; STACK-NEXT:   .byte 0
105; STACK-NEXT:   .byte 8
106; LiveOut Entry 4: %YMM0 (32 bytes)
107; STACK-NEXT:   .short  17
108; STACK-NEXT:   .byte 0
109; STACK-NEXT:   .byte 32
110; LiveOut Entry 5: %YMM1 (32 bytes)
111; STACK-NEXT:   .short  18
112; STACK-NEXT:   .byte 0
113; STACK-NEXT:   .byte 32
114; LiveOut Entry 6: %YMM2 (16 bytes) --> %XMM2
115; STACK-NEXT:   .short  19
116; STACK-NEXT:   .byte 0
117; STACK-NEXT:   .byte 16
118; Align
119; STACK-NEXT:   .align  3
120
121; StackMap 2 (patchpoint liveness information enabled)
122; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
123; PATCH-NEXT:   .short  0
124; PATCH-NEXT:   .short  0
125; Padding
126; PATCH-NEXT:   .short  0
127; Num LiveOut Entries: 0
128; PATCH-NEXT:   .short  0
129; Align
130; PATCH-NEXT:   .align  3
131  call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 2, i32 5)
132  call void asm sideeffect "", "{r8},{ah},{ymm0},{ymm1}"(i64 %a2, i8 %a3, <4 x double> %a4, <4 x double> %a5) nounwind
133
134; StackMap 3 (no liveness information available)
135; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
136; CHECK-NEXT:   .short  0
137; CHECK-NEXT:   .short  0
138; Padding
139; CHECK-NEXT:   .short  0
140; Num LiveOut Entries: 0
141; CHECK-NEXT:   .short  0
142; Align
143; CHECK-NEXT:   .align  3
144
145; StackMap 3 (stackmap liveness information enabled)
146; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
147; STACK-NEXT:   .short  0
148; STACK-NEXT:   .short  0
149; Padding
150; STACK-NEXT:   .short  0
151; Num LiveOut Entries: 2
152; STACK-NEXT:   .short  2
153; LiveOut Entry 1: %RSP (8 bytes)
154; STACK-NEXT:   .short  7
155; STACK-NEXT:   .byte 0
156; STACK-NEXT:   .byte 8
157; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
158; STACK-NEXT:   .short  19
159; STACK-NEXT:   .byte 0
160; STACK-NEXT:   .byte 16
161; Align
162; STACK-NEXT:   .align  3
163
164; StackMap 3 (patchpoint liveness information enabled)
165; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
166; PATCH-NEXT:   .short  0
167; PATCH-NEXT:   .short  0
168; Padding
169; PATCH-NEXT:   .short  0
170; Num LiveOut Entries: 0
171; PATCH-NEXT:   .short  0
172; Align
173; PATCH-NEXT:   .align  3
174  call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 3, i32 5)
175  call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
176  ret void
177}
178
179define void @mixed_liveness() {
180entry:
181  %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
182; StackMap 4 (stackmap liveness information enabled)
183; STACK-LABEL:  .long L{{.*}}-_mixed_liveness
184; STACK-NEXT:   .short  0
185; STACK-NEXT:   .short  0
186; Padding
187; STACK-NEXT:   .short  0
188; Num LiveOut Entries: 1
189; STACK-NEXT:   .short  1
190; LiveOut Entry 1: %YMM2 (16 bytes) --> %XMM2
191; STACK-NEXT:   .short  19
192; STACK-NEXT:   .byte 0
193; STACK-NEXT:   .byte 16
194; Align
195; STACK-NEXT:   .align  3
196
197
198; StackMap 5 (stackmap liveness information enabled)
199; STACK-LABEL:  .long L{{.*}}-_mixed_liveness
200; STACK-NEXT:   .short  0
201; STACK-NEXT:   .short  0
202; Padding
203; STACK-NEXT:   .short  0
204; Num LiveOut Entries: 0
205; STACK-NEXT:   .short  0
206; Align
207; STACK-NEXT:   .align  3
208
209; StackMap 4 (patchpoint liveness information enabled)
210; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
211; PATCH-NEXT:   .short  0
212; PATCH-NEXT:   .short  0
213; Padding
214; PATCH-NEXT:   .short  0
215; Num LiveOut Entries: 0
216; PATCH-NEXT:   .short  0
217; Align
218; PATCH-NEXT:   .align  3
219
220; StackMap 5 (patchpoint liveness information enabled)
221; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
222; PATCH-NEXT:   .short  0
223; PATCH-NEXT:   .short  0
224; Padding
225; PATCH-NEXT:   .short  0
226; Num LiveOut Entries: 2
227; PATCH-NEXT:   .short  2
228; LiveOut Entry 1: %RSP (8 bytes)
229; PATCH-NEXT:   .short  7
230; PATCH-NEXT:   .byte 0
231; PATCH-NEXT:   .byte 8
232; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
233; PATCH-NEXT:   .short  19
234; PATCH-NEXT:   .byte 0
235; PATCH-NEXT:   .byte 16
236; Align
237; PATCH-NEXT:   .align  3
238  call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 4, i32 5)
239  call anyregcc void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 5, i32 0, i8* null, i32 0)
240  call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
241  ret void
242}
243
244declare void @llvm.experimental.stackmap(i64, i32, ...)
245declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
246