1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX10 %s
3 # RUN: llc -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX11 %s
6 name: test_waitcnt_preexisting_vscnt_unmodified
9 liveins: $vgpr0_vgpr1, $vgpr2
11 ; GFX10-LABEL: name: test_waitcnt_preexisting_vscnt_unmodified
12 ; GFX10: liveins: $vgpr0_vgpr1, $vgpr2
14 ; GFX10-NEXT: S_WAITCNT 0
15 ; GFX10-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
16 ; GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
17 ; GFX10-NEXT: S_BARRIER
18 ; GFX10-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
19 ; GFX10-NEXT: S_WAITCNT 112
20 ; GFX10-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
21 ; GFX10-NEXT: S_ENDPGM 0
22 ; GFX11-LABEL: name: test_waitcnt_preexisting_vscnt_unmodified
23 ; GFX11: liveins: $vgpr0_vgpr1, $vgpr2
25 ; GFX11-NEXT: S_WAITCNT 0
26 ; GFX11-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
27 ; GFX11-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
28 ; GFX11-NEXT: S_BARRIER
29 ; GFX11-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
30 ; GFX11-NEXT: S_WAITCNT 7
31 ; GFX11-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
32 ; GFX11-NEXT: S_ENDPGM 0
33 GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
34 S_WAITCNT_VSCNT undef $sgpr_null, 0
36 $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
37 FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
42 name: test_waitcnt_preexisting_vscnt_needs_vscnt
45 liveins: $vgpr0_vgpr1, $vgpr2
47 ; GFX10-LABEL: name: test_waitcnt_preexisting_vscnt_needs_vscnt
48 ; GFX10: liveins: $vgpr0_vgpr1, $vgpr2
50 ; GFX10-NEXT: S_WAITCNT 0
51 ; GFX10-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
52 ; GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 1
53 ; GFX10-NEXT: S_BARRIER
54 ; GFX10-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
55 ; GFX10-NEXT: S_WAITCNT 112
56 ; GFX10-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
57 ; GFX10-NEXT: S_ENDPGM 0
58 ; GFX11-LABEL: name: test_waitcnt_preexisting_vscnt_needs_vscnt
59 ; GFX11: liveins: $vgpr0_vgpr1, $vgpr2
61 ; GFX11-NEXT: S_WAITCNT 0
62 ; GFX11-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
63 ; GFX11-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
64 ; GFX11-NEXT: S_BARRIER
65 ; GFX11-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
66 ; GFX11-NEXT: S_WAITCNT 7
67 ; GFX11-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
68 ; GFX11-NEXT: S_ENDPGM 0
69 GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
70 S_WAITCNT_VSCNT undef $sgpr_null, 1
72 $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
73 FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
78 name: test_waitcnt_preexisting_vscnt_with_other_waitcnt
81 liveins: $vgpr0_vgpr1, $vgpr2
83 ; GFX10-LABEL: name: test_waitcnt_preexisting_vscnt_with_other_waitcnt
84 ; GFX10: liveins: $vgpr0_vgpr1, $vgpr2
86 ; GFX10-NEXT: S_WAITCNT 0
87 ; GFX10-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
88 ; GFX10-NEXT: S_WAITCNT 112
89 ; GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
90 ; GFX10-NEXT: S_BARRIER
91 ; GFX10-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
92 ; GFX10-NEXT: S_WAITCNT 112
93 ; GFX10-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
94 ; GFX10-NEXT: S_ENDPGM 0
95 ; GFX11-LABEL: name: test_waitcnt_preexisting_vscnt_with_other_waitcnt
96 ; GFX11: liveins: $vgpr0_vgpr1, $vgpr2
98 ; GFX11-NEXT: S_WAITCNT 0
99 ; GFX11-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
100 ; GFX11-NEXT: S_WAITCNT 112
101 ; GFX11-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
102 ; GFX11-NEXT: S_BARRIER
103 ; GFX11-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
104 ; GFX11-NEXT: S_WAITCNT 7
105 ; GFX11-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
106 ; GFX11-NEXT: S_ENDPGM 0
107 GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
109 S_WAITCNT_VSCNT undef $sgpr_null, 0
111 $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
112 FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
117 name: test_waitcnt_preexisting_vscnt_combined
120 liveins: $vgpr0_vgpr1, $vgpr2
122 ; GFX10-LABEL: name: test_waitcnt_preexisting_vscnt_combined
123 ; GFX10: liveins: $vgpr0_vgpr1, $vgpr2
125 ; GFX10-NEXT: S_WAITCNT 0
126 ; GFX10-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
127 ; GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
128 ; GFX10-NEXT: S_BARRIER
129 ; GFX10-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
130 ; GFX10-NEXT: S_WAITCNT 112
131 ; GFX10-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
132 ; GFX10-NEXT: S_ENDPGM 0
133 ; GFX11-LABEL: name: test_waitcnt_preexisting_vscnt_combined
134 ; GFX11: liveins: $vgpr0_vgpr1, $vgpr2
136 ; GFX11-NEXT: S_WAITCNT 0
137 ; GFX11-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
138 ; GFX11-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
139 ; GFX11-NEXT: S_BARRIER
140 ; GFX11-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
141 ; GFX11-NEXT: S_WAITCNT 7
142 ; GFX11-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
143 ; GFX11-NEXT: S_ENDPGM 0
144 GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
145 S_WAITCNT_VSCNT undef $sgpr_null, 0
146 S_WAITCNT_VSCNT undef $sgpr_null, 1
147 S_WAITCNT_VSCNT undef $sgpr_null, 2
149 $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
150 FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
155 name: test_waitcnt_preexisting_vscnt_combined_both_types
158 liveins: $vgpr0_vgpr1, $vgpr2
160 ; GFX10-LABEL: name: test_waitcnt_preexisting_vscnt_combined_both_types
161 ; GFX10: liveins: $vgpr0_vgpr1, $vgpr2
163 ; GFX10-NEXT: S_WAITCNT 0
164 ; GFX10-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
165 ; GFX10-NEXT: S_WAITCNT 0
166 ; GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 1
167 ; GFX10-NEXT: S_BARRIER
168 ; GFX10-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
169 ; GFX10-NEXT: S_WAITCNT 112
170 ; GFX10-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
171 ; GFX10-NEXT: S_ENDPGM 0
172 ; GFX11-LABEL: name: test_waitcnt_preexisting_vscnt_combined_both_types
173 ; GFX11: liveins: $vgpr0_vgpr1, $vgpr2
175 ; GFX11-NEXT: S_WAITCNT 0
176 ; GFX11-NEXT: GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
177 ; GFX11-NEXT: S_WAITCNT 0
178 ; GFX11-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
179 ; GFX11-NEXT: S_BARRIER
180 ; GFX11-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
181 ; GFX11-NEXT: S_WAITCNT 7
182 ; GFX11-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
183 ; GFX11-NEXT: S_ENDPGM 0
184 GLOBAL_STORE_DWORD $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec
186 S_WAITCNT_VSCNT undef $sgpr_null, 1
188 S_WAITCNT_VSCNT undef $sgpr_null, 2
191 $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
192 FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr