xref: /llvm-project/llvm/test/CodeGen/AMDGPU/amdpal-metadata-agpr-register-count.ll (revision c897c13dde3bb413e723317c0579781fb6045a8b)
1; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx90a < %s | FileCheck -check-prefixes=CHECK,GFX90A %s
2; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx908 < %s | FileCheck -check-prefixes=CHECK,GFX908 %s
3
4; COM: Adapted from agpr-register-count.ll
5; COM: GFX900 and below should not have .agpr_count present in the metadata
6
7
8; CHECK:      .type          kernel_32_agprs
9; CHECK:      NumAgprs:       32
10define amdgpu_kernel void @kernel_32_agprs() #0 {
11bb:
12  call void asm sideeffect "", "~{v8}" ()
13  call void asm sideeffect "", "~{a31}" ()
14  ret void
15}
16
17; CHECK:      .type          kernel_0_agprs
18; CHECK:      NumAgprs:       0
19define amdgpu_kernel void @kernel_0_agprs() #0 {
20bb:
21  call void asm sideeffect "", "~{v0}" ()
22  ret void
23}
24
25; CHECK:      .type           kernel_40_vgprs
26; CHECK:      NumAgprs:       16
27define amdgpu_kernel void @kernel_40_vgprs() #0 {
28bb:
29  call void asm sideeffect "", "~{v39}" ()
30  call void asm sideeffect "", "~{a15}" ()
31  ret void
32}
33
34; CHECK:      .type          kernel_max_gprs
35; CHECK:      NumAgprs:       256
36define amdgpu_kernel void @kernel_max_gprs() #0 {
37bb:
38  call void asm sideeffect "", "~{v255}" ()
39  call void asm sideeffect "", "~{a255}" ()
40  ret void
41}
42
43; CHECK:      .type          func_32_agprs
44; CHECK:      NumAgprs:       32
45define void @func_32_agprs() #0 {
46bb:
47  call void asm sideeffect "", "~{v8}" ()
48  call void asm sideeffect "", "~{a31}" ()
49  ret void
50}
51
52; CHECK:      .type          kernel_call_func_32_agprs
53; CHECK:      NumAgprs:       32
54define amdgpu_kernel void @kernel_call_func_32_agprs() #0 {
55bb:
56  call void @func_32_agprs() #0
57  ret void
58}
59
60declare void @undef_func()
61
62; CHECK:      .type          kernel_call_undef_func
63; CHECK:      .set kernel_call_undef_func.num_agpr, max(0, amdgpu.max_num_agpr)
64; CHECK:      NumAgprs: kernel_call_undef_func.num_agpr
65; CHECK:      .set amdgpu.max_num_agpr, 32
66define amdgpu_kernel void @kernel_call_undef_func() #0 {
67bb:
68  call void @undef_func()
69  ret void
70}
71
72; CHECK: ---
73; CHECK:  amdpal.pipelines:
74; GFX90A: agpr_count:  0x20
75; GFX90A: vgpr_count:  0x40
76
77; GFX908: agpr_count:  0x20
78; GFX908: vgpr_count:  0x20
79
80attributes #0 = { nounwind noinline "amdgpu-flat-work-group-size"="1,512" }
81