1; RUN: not llc -march=amdgcn -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=ERROR %s
2
3; ERROR: error: scalar registers limit of 104 exceeded (106) in use_too_many_sgprs_tahiti
4define amdgpu_kernel void @use_too_many_sgprs_tahiti() #0 {
5  call void asm sideeffect "", "~{s[0:7]}" ()
6  call void asm sideeffect "", "~{s[8:15]}" ()
7  call void asm sideeffect "", "~{s[16:23]}" ()
8  call void asm sideeffect "", "~{s[24:31]}" ()
9  call void asm sideeffect "", "~{s[32:39]}" ()
10  call void asm sideeffect "", "~{s[40:47]}" ()
11  call void asm sideeffect "", "~{s[48:55]}" ()
12  call void asm sideeffect "", "~{s[56:63]}" ()
13  call void asm sideeffect "", "~{s[64:71]}" ()
14  call void asm sideeffect "", "~{s[72:79]}" ()
15  call void asm sideeffect "", "~{s[80:87]}" ()
16  call void asm sideeffect "", "~{s[88:95]}" ()
17  call void asm sideeffect "", "~{s[96:103]}" ()
18  call void asm sideeffect "", "~{vcc}" ()
19  ret void
20}
21
22; ERROR: error: scalar registers limit of 104 exceeded (106) in use_too_many_sgprs_bonaire
23define amdgpu_kernel void @use_too_many_sgprs_bonaire() #1 {
24  call void asm sideeffect "", "~{s[0:7]}" ()
25  call void asm sideeffect "", "~{s[8:15]}" ()
26  call void asm sideeffect "", "~{s[16:23]}" ()
27  call void asm sideeffect "", "~{s[24:31]}" ()
28  call void asm sideeffect "", "~{s[32:39]}" ()
29  call void asm sideeffect "", "~{s[40:47]}" ()
30  call void asm sideeffect "", "~{s[48:55]}" ()
31  call void asm sideeffect "", "~{s[56:63]}" ()
32  call void asm sideeffect "", "~{s[64:71]}" ()
33  call void asm sideeffect "", "~{s[72:79]}" ()
34  call void asm sideeffect "", "~{s[80:87]}" ()
35  call void asm sideeffect "", "~{s[88:95]}" ()
36  call void asm sideeffect "", "~{s[96:103]}" ()
37  call void asm sideeffect "", "~{vcc}" ()
38  ret void
39}
40
41; ERROR: error: scalar registers limit of 104 exceeded (108) in use_too_many_sgprs_bonaire_flat_scr
42define amdgpu_kernel void @use_too_many_sgprs_bonaire_flat_scr() #1 {
43  call void asm sideeffect "", "~{s[0:7]}" ()
44  call void asm sideeffect "", "~{s[8:15]}" ()
45  call void asm sideeffect "", "~{s[16:23]}" ()
46  call void asm sideeffect "", "~{s[24:31]}" ()
47  call void asm sideeffect "", "~{s[32:39]}" ()
48  call void asm sideeffect "", "~{s[40:47]}" ()
49  call void asm sideeffect "", "~{s[48:55]}" ()
50  call void asm sideeffect "", "~{s[56:63]}" ()
51  call void asm sideeffect "", "~{s[64:71]}" ()
52  call void asm sideeffect "", "~{s[72:79]}" ()
53  call void asm sideeffect "", "~{s[80:87]}" ()
54  call void asm sideeffect "", "~{s[88:95]}" ()
55  call void asm sideeffect "", "~{s[96:103]}" ()
56  call void asm sideeffect "", "~{vcc}" ()
57  call void asm sideeffect "", "~{flat_scratch}" ()
58  ret void
59}
60
61; ERROR: error: scalar registers limit of 96 exceeded (98) in use_too_many_sgprs_iceland
62define amdgpu_kernel void @use_too_many_sgprs_iceland() #2 {
63  call void asm sideeffect "", "~{vcc}" ()
64  call void asm sideeffect "", "~{s[0:7]}" ()
65  call void asm sideeffect "", "~{s[8:15]}" ()
66  call void asm sideeffect "", "~{s[16:23]}" ()
67  call void asm sideeffect "", "~{s[24:31]}" ()
68  call void asm sideeffect "", "~{s[32:39]}" ()
69  call void asm sideeffect "", "~{s[40:47]}" ()
70  call void asm sideeffect "", "~{s[48:55]}" ()
71  call void asm sideeffect "", "~{s[56:63]}" ()
72  call void asm sideeffect "", "~{s[64:71]}" ()
73  call void asm sideeffect "", "~{s[72:79]}" ()
74  call void asm sideeffect "", "~{s[80:87]}" ()
75  call void asm sideeffect "", "~{s[88:95]}" ()
76  ret void
77}
78
79; ERROR: error: addressable scalar registers limit of 102 exceeded (103) in use_too_many_sgprs_fiji
80define amdgpu_kernel void @use_too_many_sgprs_fiji() #3 {
81  call void asm sideeffect "", "~{s[0:7]}" ()
82  call void asm sideeffect "", "~{s[8:15]}" ()
83  call void asm sideeffect "", "~{s[16:23]}" ()
84  call void asm sideeffect "", "~{s[24:31]}" ()
85  call void asm sideeffect "", "~{s[32:39]}" ()
86  call void asm sideeffect "", "~{s[40:47]}" ()
87  call void asm sideeffect "", "~{s[48:55]}" ()
88  call void asm sideeffect "", "~{s[56:63]}" ()
89  call void asm sideeffect "", "~{s[64:71]}" ()
90  call void asm sideeffect "", "~{s[72:79]}" ()
91  call void asm sideeffect "", "~{s[80:87]}" ()
92  call void asm sideeffect "", "~{s[88:95]}" ()
93  call void asm sideeffect "", "~{s[96:99]}" ()
94  call void asm sideeffect "", "~{s[100:101]}" ()
95  call void asm sideeffect "", "~{s102}" ()
96  ret void
97}
98
99attributes #0 = { nounwind "target-cpu"="tahiti" }
100attributes #1 = { nounwind "target-cpu"="bonaire" }
101attributes #2 = { nounwind "target-cpu"="iceland" }
102attributes #3 = { nounwind "target-cpu"="fiji" }
103