1; RUN: llc -march=amdgcn -mcpu=gfx900 < %s | FileCheck --check-prefixes=GCN,GFX9 %s
2; RUN: llc -march=amdgcn -mcpu=gfx1010 < %s | FileCheck --check-prefixes=GCN,GFX10,GFX10W32,GFX1010,GFX1010W32 %s
3; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize64 < %s | FileCheck --check-prefixes=GCN,GFX10,GFX10W64,GFX1010,GFX1010W64 %s
4; RUN: llc -march=amdgcn -mcpu=gfx1030 < %s | FileCheck --check-prefixes=GCN,GFX10,GFX10W32,GFX1030,GFX1030W32 %s
5; RUN: llc -march=amdgcn -mcpu=gfx1030 -mattr=+wavefrontsize64 < %s | FileCheck --check-prefixes=GCN,GFX10,GFX10W64,GFX1030,GFX1030W64 %s
6
7; GCN-LABEL: {{^}}max_occupancy:
8; GFX9:       ; Occupancy: 10
9; GFX1010:    ; Occupancy: 20
10; GFX1030:    ; Occupancy: 16
11define amdgpu_kernel void @max_occupancy() {
12  ret void
13}
14
15; GCN-LABEL: {{^}}limited_occupancy_3:
16; GFX9:       ; Occupancy: 3
17; GFX10W64:   ; Occupancy: 3
18; GFX10W32:   ; Occupancy: 4
19define amdgpu_kernel void @limited_occupancy_3() #0 {
20  ret void
21}
22
23; GCN-LABEL: {{^}}limited_occupancy_18:
24; GFX9:       ; Occupancy: 10
25; GFX1010:    ; Occupancy: 18
26; GFX1030:    ; Occupancy: 16
27define amdgpu_kernel void @limited_occupancy_18() #1 {
28  ret void
29}
30
31; GCN-LABEL: {{^}}limited_occupancy_19:
32; GFX9:       ; Occupancy: 10
33; GFX1010:    ; Occupancy: 18
34; GFX1030:    ; Occupancy: 16
35define amdgpu_kernel void @limited_occupancy_19() #2 {
36  ret void
37}
38
39; GCN-LABEL: {{^}}used_24_vgprs:
40; GFX9:       ; Occupancy: 10
41; GFX1010:    ; Occupancy: 20
42; GFX1030:    ; Occupancy: 16
43define amdgpu_kernel void @used_24_vgprs() {
44  call void asm sideeffect "", "~{v23}" ()
45  ret void
46}
47
48; GCN-LABEL: {{^}}used_28_vgprs:
49; GFX9:       ; Occupancy: 9
50; GFX1010W64: ; Occupancy: 18
51; GFX1010W32: ; Occupancy: 20
52; GFX1030:    ; Occupancy: 16
53define amdgpu_kernel void @used_28_vgprs() {
54  call void asm sideeffect "", "~{v27}" ()
55  ret void
56}
57
58; GCN-LABEL: {{^}}used_32_vgprs:
59; GFX9:       ; Occupancy: 8
60; GFX10W64:   ; Occupancy: 16
61; GFX1010W32: ; Occupancy: 20
62; GFX1030W32: ; Occupancy: 16
63define amdgpu_kernel void @used_32_vgprs() {
64  call void asm sideeffect "", "~{v31}" ()
65  ret void
66}
67
68; GCN-LABEL: {{^}}used_36_vgprs:
69; GFX9:       ; Occupancy: 7
70; GFX1010W64: ; Occupancy: 14
71; GFX1010W32: ; Occupancy: 20
72; GFX1030W64: ; Occupancy: 12
73; GFX1030W32: ; Occupancy: 16
74define amdgpu_kernel void @used_36_vgprs() {
75  call void asm sideeffect "", "~{v35}" ()
76  ret void
77}
78
79; GCN-LABEL: {{^}}used_40_vgprs:
80; GFX9:       ; Occupancy: 6
81; GFX10W64:   ; Occupancy: 12
82; GFX1010W32: ; Occupancy: 20
83; GFX1030W32: ; Occupancy: 16
84define amdgpu_kernel void @used_40_vgprs() {
85  call void asm sideeffect "", "~{v39}" ()
86  ret void
87}
88
89; GCN-LABEL: {{^}}used_44_vgprs:
90; GFX9:       ; Occupancy: 5
91; GFX1010W64: ; Occupancy: 11
92; GFX1010W32: ; Occupancy: 20
93; GFX1030W64: ; Occupancy: 10
94; GFX1030W32: ; Occupancy: 16
95define amdgpu_kernel void @used_44_vgprs() {
96  call void asm sideeffect "", "~{v43}" ()
97  ret void
98}
99
100; GCN-LABEL: {{^}}used_48_vgprs:
101; GFX9:       ; Occupancy: 5
102; GFX10W64:   ; Occupancy: 10
103; GFX1010W32: ; Occupancy: 20
104; GFX1030W32: ; Occupancy: 16
105define amdgpu_kernel void @used_48_vgprs() {
106  call void asm sideeffect "", "~{v47}" ()
107  ret void
108}
109
110; GCN-LABEL: {{^}}used_56_vgprs:
111; GFX9:       ; Occupancy: 4
112; GFX10W64:   ; Occupancy: 9
113; GFX1010W32: ; Occupancy: 18
114; GFX1030W32: ; Occupancy: 16
115define amdgpu_kernel void @used_56_vgprs() {
116  call void asm sideeffect "", "~{v55}" ()
117  ret void
118}
119
120; GCN-LABEL: {{^}}used_64_vgprs:
121; GFX9:       ; Occupancy: 4
122; GFX10W64:   ; Occupancy: 8
123; GFX10W32:   ; Occupancy: 16
124define amdgpu_kernel void @used_64_vgprs() {
125  call void asm sideeffect "", "~{v63}" ()
126  ret void
127}
128
129; GCN-LABEL: {{^}}used_72_vgprs:
130; GFX9:       ; Occupancy: 3
131; GFX10W64:   ; Occupancy: 7
132; GFX1010W32: ; Occupancy: 14
133; GFX1030W32: ; Occupancy: 12
134define amdgpu_kernel void @used_72_vgprs() {
135  call void asm sideeffect "", "~{v71}" ()
136  ret void
137}
138
139; GCN-LABEL: {{^}}used_80_vgprs:
140; GFX9:       ; Occupancy: 3
141; GFX10W64:   ; Occupancy: 6
142; GFX10W32:   ; Occupancy: 12
143define amdgpu_kernel void @used_80_vgprs() {
144  call void asm sideeffect "", "~{v79}" ()
145  ret void
146}
147
148; GCN-LABEL: {{^}}used_84_vgprs:
149; GFX9:       ; Occupancy: 3
150; GFX1010W64: ; Occupancy: 6
151; GFX1010W32: ; Occupancy: 11
152; GFX1030W64: ; Occupancy: 5
153; GFX1030W32: ; Occupancy: 10
154define amdgpu_kernel void @used_84_vgprs() {
155  call void asm sideeffect "", "~{v83}" ()
156  ret void
157}
158
159; GCN-LABEL: {{^}}used_88_vgprs:
160; GFX9:       ; Occupancy: 2
161; GFX10W64:   ; Occupancy: 5
162; GFX1010W32: ; Occupancy: 11
163; GFX1030W32: ; Occupancy: 10
164define amdgpu_kernel void @used_88_vgprs() {
165  call void asm sideeffect "", "~{v87}" ()
166  ret void
167}
168
169; GCN-LABEL: {{^}}used_96_vgprs:
170; GFX9:       ; Occupancy: 2
171; GFX10W64:   ; Occupancy: 5
172; GFX10W32:   ; Occupancy: 10
173define amdgpu_kernel void @used_96_vgprs() {
174  call void asm sideeffect "", "~{v95}" ()
175  ret void
176}
177
178; GCN-LABEL: {{^}}used_100_vgprs:
179; GFX9:       ; Occupancy: 2
180; GFX1010W64: ; Occupancy: 5
181; GFX1030W64: ; Occupancy: 4
182; GFX10W32:   ; Occupancy: 9
183define amdgpu_kernel void @used_100_vgprs() {
184  call void asm sideeffect "", "~{v99}" ()
185  ret void
186}
187
188; GCN-LABEL: {{^}}used_112_vgprs:
189; GFX9:       ; Occupancy: 2
190; GFX10W64:   ; Occupancy: 4
191; GFX10W32:   ; Occupancy: 9
192define amdgpu_kernel void @used_112_vgprs() {
193  call void asm sideeffect "", "~{v111}" ()
194  ret void
195}
196
197; GCN-LABEL: {{^}}used_128_vgprs:
198; GFX9:       ; Occupancy: 2
199; GFX10W64:   ; Occupancy: 4
200; GFX10W32:   ; Occupancy: 8
201define amdgpu_kernel void @used_128_vgprs() {
202  call void asm sideeffect "", "~{v127}" ()
203  ret void
204}
205
206; GCN-LABEL: {{^}}used_144_vgprs:
207; GFX9:       ; Occupancy: 1
208; GFX10W64:   ; Occupancy: 3
209; GFX10W32:   ; Occupancy: 7
210define amdgpu_kernel void @used_144_vgprs() {
211  call void asm sideeffect "", "~{v143}" ()
212  ret void
213}
214
215; GCN-LABEL: {{^}}used_168_vgprs:
216; GFX9:       ; Occupancy: 1
217; GFX10W64:   ; Occupancy: 3
218; GFX1010W32: ; Occupancy: 6
219; GFX1030W32: ; Occupancy: 5
220define amdgpu_kernel void @used_168_vgprs() {
221  call void asm sideeffect "", "~{v167}" ()
222  ret void
223}
224
225; GCN-LABEL: {{^}}used_200_vgprs:
226; GFX9:       ; Occupancy: 1
227; GFX10W64:   ; Occupancy: 2
228; GFX1010W32: ; Occupancy: 5
229; GFX1030W32: ; Occupancy: 4
230define amdgpu_kernel void @used_200_vgprs() {
231  call void asm sideeffect "", "~{v199}" ()
232  ret void
233}
234
235; GCN-LABEL: {{^}}used_256_vgprs:
236; GFX9:       ; Occupancy: 1
237; GFX10W64:   ; Occupancy: 2
238; GFX10W32:   ; Occupancy: 4
239define amdgpu_kernel void @used_256_vgprs() {
240  call void asm sideeffect "", "~{v255}" ()
241  ret void
242}
243
244; GCN-LABEL: {{^}}used_80_sgprs:
245; GFX9:       ; Occupancy: 10
246; GFX1010:    ; Occupancy: 20
247; GFX1030:    ; Occupancy: 16
248define amdgpu_kernel void @used_80_sgprs() {
249  call void asm sideeffect "", "~{s79}" ()
250  ret void
251}
252
253; GCN-LABEL: {{^}}used_88_sgprs:
254; GFX9:       ; Occupancy: 9
255; GFX1010:    ; Occupancy: 20
256; GFX1030:    ; Occupancy: 16
257define amdgpu_kernel void @used_88_sgprs() {
258  call void asm sideeffect "", "~{s87}" ()
259  ret void
260}
261
262; GCN-LABEL: {{^}}used_100_sgprs:
263; GFX9:       ; Occupancy: 8
264; GFX1010:    ; Occupancy: 20
265; GFX1030:    ; Occupancy: 16
266define amdgpu_kernel void @used_100_sgprs() {
267  call void asm sideeffect "", "~{s99}" ()
268  ret void
269}
270
271; GCN-LABEL: {{^}}used_101_sgprs:
272; GFX9:       ; Occupancy: 7
273; GFX1010:    ; Occupancy: 20
274; GFX1030:    ; Occupancy: 16
275define amdgpu_kernel void @used_101_sgprs() {
276  call void asm sideeffect "", "~{s100}" ()
277  ret void
278}
279
280; GCN-LABEL: {{^}}used_lds_6552:
281; GFX9:       ; Occupancy: 10
282; GFX1010:    ; Occupancy: 20
283; GFX1030:    ; Occupancy: 16
284@lds6552 = internal addrspace(3) global [6552 x i8] undef, align 4
285define amdgpu_kernel void @used_lds_6552() {
286  %p = bitcast [6552 x i8] addrspace(3)* @lds6552 to i8 addrspace(3)*
287  store volatile i8 1, i8 addrspace(3)* %p
288  ret void
289}
290
291; GCN-LABEL: {{^}}used_lds_6556:
292; GFX9:       ; Occupancy: 10
293; GFX1010:    ; Occupancy: 20
294; GFX1030:    ; Occupancy: 16
295@lds6556 = internal addrspace(3) global [6556 x i8] undef, align 4
296define amdgpu_kernel void @used_lds_6556() {
297  %p = bitcast [6556 x i8] addrspace(3)* @lds6556 to i8 addrspace(3)*
298  store volatile i8 1, i8 addrspace(3)* %p
299  ret void
300}
301
302; GCN-LABEL: {{^}}used_lds_13112:
303; GFX9:       ; Occupancy: 10
304; GFX1010:    ; Occupancy: 20
305; GFX1030:    ; Occupancy: 16
306@lds13112 = internal addrspace(3) global [13112 x i8] undef, align 4
307define amdgpu_kernel void @used_lds_13112() {
308  %p = bitcast [13112 x i8] addrspace(3)* @lds13112 to i8 addrspace(3)*
309  store volatile i8 1, i8 addrspace(3)* %p
310  ret void
311}
312
313; GCN-LABEL: {{^}}used_lds_8252_max_group_size_64:
314; GFX9:       ; Occupancy: 7{{$}}
315; GFX10W64:   ; Occupancy: 7{{$}}
316; GFX10W32:   ; Occupancy: 14{{$}}
317@lds8252 = internal addrspace(3) global [8252 x i8] undef, align 4
318define amdgpu_kernel void @used_lds_8252_max_group_size_64() #3 {
319  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
320  store volatile i8 1, i8 addrspace(3)* %p
321  ret void
322}
323
324; GCN-LABEL: {{^}}used_lds_8252_max_group_size_96:
325; GFX9:       ; Occupancy: 10{{$}}
326; GFX10W64:   ; Occupancy: 14{{$}}
327; GFX1010W32: ; Occupancy: 20{{$}}
328; GFX1030W32: ; Occupancy: 16{{$}}
329define amdgpu_kernel void @used_lds_8252_max_group_size_96() #4 {
330  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
331  store volatile i8 1, i8 addrspace(3)* %p
332  ret void
333}
334
335; GCN-LABEL: {{^}}used_lds_8252_max_group_size_128:
336; GFX9:       ; Occupancy: 10{{$}}
337; GFX10W64:   ; Occupancy: 14{{$}}
338; GFX1010W32: ; Occupancy: 20{{$}}
339; GFX1030W32: ; Occupancy: 16{{$}}
340define amdgpu_kernel void @used_lds_8252_max_group_size_128() #5 {
341  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
342  store volatile i8 1, i8 addrspace(3)* %p
343  ret void
344}
345
346; GCN-LABEL: {{^}}used_lds_8252_max_group_size_192:
347; GFX9:       ; Occupancy: 10{{$}}
348; GFX1010:    ; Occupancy: 20{{$}}
349; GFX1030:    ; Occupancy: 16{{$}}
350define amdgpu_kernel void @used_lds_8252_max_group_size_192() #6 {
351  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
352  store volatile i8 1, i8 addrspace(3)* %p
353  ret void
354}
355
356; GCN-LABEL: {{^}}used_lds_8252_max_group_size_256:
357; GFX9:       ; Occupancy: 10{{$}}
358; GFX1010:    ; Occupancy: 20{{$}}
359; GFX1030:    ; Occupancy: 16{{$}}
360define amdgpu_kernel void @used_lds_8252_max_group_size_256() #7 {
361  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
362  store volatile i8 1, i8 addrspace(3)* %p
363  ret void
364}
365
366; GCN-LABEL: {{^}}used_lds_8252_max_group_size_512:
367; GFX9:       ; Occupancy: 10{{$}}
368; GFX1010:    ; Occupancy: 20{{$}}
369; GFX1030:    ; Occupancy: 16{{$}}
370define amdgpu_kernel void @used_lds_8252_max_group_size_512() #8 {
371  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
372  store volatile i8 1, i8 addrspace(3)* %p
373  ret void
374}
375
376; GCN-LABEL: {{^}}used_lds_8252_max_group_size_1024:
377; GFX9:       ; Occupancy: 10{{$}}
378; GFX1010:    ; Occupancy: 20{{$}}
379; GFX1030:    ; Occupancy: 16{{$}}
380define amdgpu_kernel void @used_lds_8252_max_group_size_1024() #9 {
381  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
382  store volatile i8 1, i8 addrspace(3)* %p
383  ret void
384}
385
386; GCN-LABEL: {{^}}used_lds_8252_max_group_size_32:
387; GFX9:       ; Occupancy: 7{{$}}
388; GFX10:      ; Occupancy: 7{{$}}
389define amdgpu_kernel void @used_lds_8252_max_group_size_32() #10 {
390  %p = bitcast [8252 x i8] addrspace(3)* @lds8252 to i8 addrspace(3)*
391  store volatile i8 1, i8 addrspace(3)* %p
392  ret void
393}
394
395attributes #0 = { "amdgpu-waves-per-eu"="2,3" }
396attributes #1 = { "amdgpu-waves-per-eu"="18,18" }
397attributes #2 = { "amdgpu-waves-per-eu"="19,19" }
398attributes #3 = { "amdgpu-flat-work-group-size"="1,64" }
399attributes #4 = { "amdgpu-flat-work-group-size"="1,96" }
400attributes #5 = { "amdgpu-flat-work-group-size"="1,128" }
401attributes #6 = { "amdgpu-flat-work-group-size"="1,192" }
402attributes #7 = { "amdgpu-flat-work-group-size"="1,256" }
403attributes #8 = { "amdgpu-flat-work-group-size"="1,512" }
404attributes #9 = { "amdgpu-flat-work-group-size"="1,1024" }
405attributes #10 = { "amdgpu-flat-work-group-size"="1,32" }
406