1; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=gfx908 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s
2
3; GCN-LABEL: {{^}}kernel_32_agprs:
4; GCN:    .amdhsa_next_free_vgpr 32
5; GCN:    NumVgprs: 9
6; GCN:    NumAgprs: 32
7; GCN:    TotalNumVgprs: 32
8; GCN:    VGPRBlocks: 7
9; GCN:    NumVGPRsForWavesPerEU: 32
10; GCN:    Occupancy: 8
11define amdgpu_kernel void @kernel_32_agprs() {
12bb:
13  call void asm sideeffect "", "~{v8}" ()
14  call void asm sideeffect "", "~{a31}" ()
15  ret void
16}
17
18; GCN-LABEL: {{^}}kernel_0_agprs:
19; GCN:    .amdhsa_next_free_vgpr 1
20; GCN:    NumVgprs: 1
21; GCN:    NumAgprs: 0
22; GCN:    TotalNumVgprs: 1
23; GCN:    VGPRBlocks: 0
24; GCN:    NumVGPRsForWavesPerEU: 1
25; GCN:    Occupancy: 10
26define amdgpu_kernel void @kernel_0_agprs() {
27bb:
28  call void asm sideeffect "", "~{v0}" ()
29  ret void
30}
31
32; GCN-LABEL: {{^}}kernel_40_vgprs:
33; GCN:    .amdhsa_next_free_vgpr 40
34; GCN:    NumVgprs: 40
35; GCN:    NumAgprs: 16
36; GCN:    TotalNumVgprs: 40
37; GCN:    VGPRBlocks: 9
38; GCN:    NumVGPRsForWavesPerEU: 40
39; GCN:    Occupancy: 6
40define amdgpu_kernel void @kernel_40_vgprs() {
41bb:
42  call void asm sideeffect "", "~{v39}" ()
43  call void asm sideeffect "", "~{a15}" ()
44  ret void
45}
46
47; GCN-LABEL: {{^}}func_32_agprs:
48; GCN:    NumVgprs: 9
49; GCN:    NumAgprs: 32
50; GCN:    TotalNumVgprs: 32
51define void @func_32_agprs() #0 {
52bb:
53  call void asm sideeffect "", "~{v8}" ()
54  call void asm sideeffect "", "~{a31}" ()
55  ret void
56}
57
58; GCN-LABEL: {{^}}func_32_vgprs:
59; GCN:    NumVgprs: 32
60; GCN:    NumAgprs: 9
61; GCN:    TotalNumVgprs: 32
62define void @func_32_vgprs() {
63bb:
64  call void asm sideeffect "", "~{v31}" ()
65  call void asm sideeffect "", "~{a8}" ()
66  ret void
67}
68
69; GCN-LABEL: {{^}}func_0_agprs:
70; GCN:    NumVgprs: 1
71; GCN:    NumAgprs: 0
72; GCN:    TotalNumVgprs: 1
73define amdgpu_kernel void @func_0_agprs() {
74bb:
75  call void asm sideeffect "", "~{v0}" ()
76  ret void
77}
78
79; GCN-LABEL: {{^}}kernel_max_gprs:
80; GCN:    .amdhsa_next_free_vgpr 256
81; GCN:    NumVgprs: 256
82; GCN:    NumAgprs: 256
83; GCN:    TotalNumVgprs: 256
84; GCN:    VGPRBlocks: 63
85; GCN:    NumVGPRsForWavesPerEU: 256
86; GCN:    Occupancy: 1
87define amdgpu_kernel void @kernel_max_gprs() {
88bb:
89  call void asm sideeffect "", "~{v255}" ()
90  call void asm sideeffect "", "~{a255}" ()
91  ret void
92}
93
94; GCN-LABEL: {{^}}kernel_call_func_32_agprs:
95; GCN:    .amdhsa_next_free_vgpr 32
96; GCN:    NumVgprs: 9
97; GCN:    NumAgprs: 32
98; GCN:    TotalNumVgprs: 32
99; GCN:    VGPRBlocks: 7
100; GCN:    NumVGPRsForWavesPerEU: 32
101; GCN:    Occupancy: 8
102define amdgpu_kernel void @kernel_call_func_32_agprs() {
103bb:
104  call void @func_32_agprs() #0
105  ret void
106}
107
108; GCN-LABEL: {{^}}func_call_func_32_agprs:
109; GCN:    NumVgprs: 9
110; GCN:    NumAgprs: 32
111; GCN:    TotalNumVgprs: 32
112define void @func_call_func_32_agprs() {
113bb:
114  call void @func_32_agprs() #0
115  ret void
116}
117
118declare void @undef_func()
119
120; GCN-LABEL: {{^}}kernel_call_undef_func:
121; GCN:    .amdhsa_next_free_vgpr 24
122; GCN:    NumVgprs: 24
123; GCN:    NumAgprs: 24
124; GCN:    TotalNumVgprs: 24
125; GCN:    VGPRBlocks: 5
126; GCN:    NumVGPRsForWavesPerEU: 24
127; GCN:    Occupancy: 10
128define amdgpu_kernel void @kernel_call_undef_func() {
129bb:
130  call void @undef_func()
131  ret void
132}
133
134attributes #0 = { nounwind noinline }
135