1 # RUN: llc -march=amdgcn -mcpu=gfx902 -verify-machineinstrs -run-pass=si-form-memory-clauses %s -o - | FileCheck -check-prefix=GCN %s
3 # GCN-LABEL: {{^}}name: vector_clause{{$}}
4 # GCN: %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
5 # GCN-NEXT: %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
6 # GCN-NEXT: %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
7 # GCN-NEXT: %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
8 # GCN-NEXT: KILL %0{{$}}
9 # GCN-NEXT: %5:vreg_64 = IMPLICIT_DEF
10 # GCN-NEXT: GLOBAL_STORE_DWORDX4 %5, %1, 0, 0, implicit $exec
14 tracksRegLiveness: true
17 %0:vreg_64 = IMPLICIT_DEF
18 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
19 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
20 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
21 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
22 %5:vreg_64 = IMPLICIT_DEF
23 GLOBAL_STORE_DWORDX4 %5, %1, 0, 0, implicit $exec
24 GLOBAL_STORE_DWORDX4 %5, %2, 16, 0, implicit $exec
25 GLOBAL_STORE_DWORDX4 %5, %3, 32, 0, implicit $exec
26 GLOBAL_STORE_DWORDX4 %5, %4, 48, 0, implicit $exec
29 # This would be a valid soft clause, but there's no need for a KILL
30 # since the pointer uses are live beyond the end the clause.
31 # GCN-LABEL: {{^}}name: vector_clause_no_kill{{$}}
32 # GCN: %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
33 # GCN-NEXT: %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
34 # GCN-NEXT: %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
35 # GCN-NEXT: %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
36 # GCN-NEXT: GLOBAL_STORE_DWORDX4 %0, %1, 0, 0, implicit $exec
39 name: vector_clause_no_kill
40 tracksRegLiveness: true
43 %0:vreg_64 = IMPLICIT_DEF
44 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
45 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
46 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
47 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
48 GLOBAL_STORE_DWORDX4 %0, %1, 0, 0, implicit $exec
49 GLOBAL_STORE_DWORDX4 %0, %2, 16, 0, implicit $exec
50 GLOBAL_STORE_DWORDX4 %0, %3, 32, 0, implicit $exec
51 GLOBAL_STORE_DWORDX4 %0, %4, 48, 0, implicit $exec
54 # GCN-LABEL: {{^}}name: subreg_full{{$}}
55 # GCN: undef %1.sub0:vreg_128 = GLOBAL_LOAD_DWORD %0.sub0_sub1, 0, 0, implicit $exec
56 # GCN-NEXT: %1.sub1:vreg_128 = GLOBAL_LOAD_DWORD %0.sub1_sub2, 16, 0, implicit $exec
57 # GCN-NEXT: %1.sub2:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
58 # GCN-NEXT: %1.sub3:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
59 # GCN-NEXT: KILL %0.sub2_sub3{{$}}
60 # GCN-NEXT: GLOBAL_STORE_DWORDX4 %0.sub0_sub1, %1, 0, 0, implicit $exec
64 tracksRegLiveness: true
66 - { id: 0, class: vreg_128 }
67 - { id: 1, class: vreg_128 }
71 undef %1.sub0:vreg_128 = GLOBAL_LOAD_DWORD %0.sub0_sub1, 0, 0, implicit $exec
72 %1.sub1:vreg_128 = GLOBAL_LOAD_DWORD %0.sub1_sub2, 16, 0, implicit $exec
73 %1.sub2:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
74 %1.sub3:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
75 GLOBAL_STORE_DWORDX4 %0.sub0_sub1, %1, 0, 0, implicit $exec
78 # GCN-LABEL: {{^}}name: subreg_part{{$}}
79 # GCN: undef %1.sub0:vreg_128 = GLOBAL_LOAD_DWORD %0.sub0_sub1, 0, 0, implicit $exec
80 # GCN-NEXT: %1.sub1:vreg_128 = GLOBAL_LOAD_DWORD %0.sub1_sub2, 16, 0, implicit $exec
81 # GCN-NEXT: %1.sub3:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
82 # GCN-NEXT: KILL %0.sub2_sub3{{$}}
83 # GCN-NEXT: GLOBAL_STORE_DWORDX4 %0.sub0_sub1, %1, 0, 0, implicit $exec
87 tracksRegLiveness: true
89 - { id: 0, class: vreg_128 }
90 - { id: 1, class: vreg_128 }
94 undef %1.sub0:vreg_128 = GLOBAL_LOAD_DWORD %0.sub0_sub1, 0, 0, implicit $exec
95 %1.sub1:vreg_128 = GLOBAL_LOAD_DWORD %0.sub1_sub2, 16, 0, implicit $exec
96 %1.sub3:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
97 GLOBAL_STORE_DWORDX4 %0.sub0_sub1, %1, 0, 0, implicit $exec
100 # GCN-LABEL: {{^}}name: dead{{$}}
101 # GCN: dead %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
102 # GCN-NEXT: %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
103 # GCN-NEXT: dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
104 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
105 # GCN-NEXT: KILL %0{{$}}
109 tracksRegLiveness: true
111 - { id: 0, class: vreg_64 }
112 - { id: 1, class: vreg_128 }
113 - { id: 2, class: vreg_128 }
114 - { id: 3, class: vreg_128 }
115 - { id: 4, class: vreg_128 }
119 dead %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
120 dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
121 dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
122 dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
125 # GCN-LABEL: {{^}}name: subreg_dead{{$}}
126 # GCN: undef %2.sub0:vreg_64 = GLOBAL_LOAD_DWORD %0, 16, 0, implicit $exec
127 # GCN-NEXT: dead %2.sub1:vreg_64 = GLOBAL_LOAD_DWORD %0, 32, 0, implicit $exec
128 # GCN-NEXT: KILL %0{{$}}
129 # GCN-NEXT: GLOBAL_STORE_DWORD %1, %2.sub0, 0, 0, implicit $exec
133 tracksRegLiveness: true
136 %0:vreg_64 = IMPLICIT_DEF
137 %1:vreg_64 = IMPLICIT_DEF
138 undef %2.sub0:vreg_64 = GLOBAL_LOAD_DWORD %0, 16, 0, implicit $exec
139 dead %2.sub1:vreg_64 = GLOBAL_LOAD_DWORD %0, 32, 0, implicit $exec
140 GLOBAL_STORE_DWORD %1, %2.sub0, 0, 0, implicit $exec
143 # GCN-LABEL: {{^}}name: kill{{$}}
144 # GCN: %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
145 # GCN-NEXT: %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 16, 0, implicit $exec
146 # GCN-NEXT: KILL %1{{$}}
147 # GCN-NEXT: KILL %0{{$}}
151 tracksRegLiveness: true
154 %0:vreg_64 = IMPLICIT_DEF
155 %1:vreg_64 = IMPLICIT_DEF
156 %2:vreg_64 = IMPLICIT_DEF
157 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
158 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 killed %1, 16, 0, implicit $exec
159 GLOBAL_STORE_DWORDX4 %2, %3, 0, 0, implicit $exec
160 GLOBAL_STORE_DWORDX4 %2, %4, 16, 0, implicit $exec
163 # GCN-LABEL: {{^}}name: indirect{{$}}
164 # GCN: %1:vreg_64 = GLOBAL_LOAD_DWORDX2 %0, 0, 0, implicit $exec
165 # GCN-NEXT: %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 0, 0, implicit $exec
166 # GCN-NEXT: %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 16, 0, implicit $exec
167 # GCN-NEXT: KILL %1{{$}}
171 tracksRegLiveness: true
173 - { id: 0, class: vreg_64 }
174 - { id: 1, class: vreg_64 }
175 - { id: 2, class: vreg_128 }
176 - { id: 3, class: vreg_128 }
180 %1:vreg_64 = GLOBAL_LOAD_DWORDX2 %0, 0, 0, implicit $exec
181 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 0, 0, implicit $exec
182 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 16, 0, implicit $exec
183 GLOBAL_STORE_DWORDX4 %0, %2, 0, 0, implicit $exec
184 GLOBAL_STORE_DWORDX4 %0, %3, 16, 0, implicit $exec
187 # GCN-LABEL: {{^}}name: stack{{$}}
188 # GCN: %0:vreg_64 = IMPLICIT_DEF
189 # GCN-NEXT: %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %stack.0, 0, 0, implicit $exec
190 # GCN-NEXT: %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %stack.0, 16, 0, implicit $exec
191 # GCN-NEXT: GLOBAL_STORE_DWORDX4 %0, %1, 0, 0, implicit $exec
195 tracksRegLiveness: true
197 - { id: 0, class: vreg_64 }
198 - { id: 1, class: vreg_128 }
199 - { id: 2, class: vreg_128 }
201 - { id: 0, type: default, offset: 0, size: 64, alignment: 8 }
205 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %stack.0, 0, 0, implicit $exec
206 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %stack.0, 16, 0, implicit $exec
207 GLOBAL_STORE_DWORDX4 %0, %1, 0, 0, implicit $exec
208 GLOBAL_STORE_DWORDX4 %0, %2, 16, 0, implicit $exec
211 # GCN-LABEL: {{^}}name: overflow_counter{{$}}
212 # GCN: dead %2:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
213 # GCN-NEXT: dead %3:vgpr_32 = GLOBAL_LOAD_DWORD %0, 4, 0, implicit $exec
214 # GCN-NEXT: dead %4:vgpr_32 = GLOBAL_LOAD_DWORD %0, 8, 0, implicit $exec
215 # GCN-NEXT: dead %5:vgpr_32 = GLOBAL_LOAD_DWORD %0, 12, 0, implicit $exec
216 # GCN-NEXT: dead %6:vgpr_32 = GLOBAL_LOAD_DWORD %0, 16, 0, implicit $exec
217 # GCN-NEXT: dead %7:vgpr_32 = GLOBAL_LOAD_DWORD %0, 20, 0, implicit $exec
218 # GCN-NEXT: dead %8:vgpr_32 = GLOBAL_LOAD_DWORD %0, 24, 0, implicit $exec
219 # GCN-NEXT: dead %9:vgpr_32 = GLOBAL_LOAD_DWORD %0, 28, 0, implicit $exec
220 # GCN-NEXT: dead %10:vgpr_32 = GLOBAL_LOAD_DWORD %0, 32, 0, implicit $exec
221 # GCN-NEXT: dead %11:vgpr_32 = GLOBAL_LOAD_DWORD %0, 36, 0, implicit $exec
222 # GCN-NEXT: dead %12:vgpr_32 = GLOBAL_LOAD_DWORD %0, 40, 0, implicit $exec
223 # GCN-NEXT: dead %13:vgpr_32 = GLOBAL_LOAD_DWORD %0, 44, 0, implicit $exec
224 # GCN-NEXT: dead %14:vgpr_32 = GLOBAL_LOAD_DWORD %0, 48, 0, implicit $exec
225 # GCN-NEXT: dead %15:vgpr_32 = GLOBAL_LOAD_DWORD %0, 52, 0, implicit $exec
226 # GCN-NEXT: dead %16:vgpr_32 = GLOBAL_LOAD_DWORD %0, 56, 0, implicit $exec
227 # GCN-NEXT: KILL %0{{$}}
228 # GCN-NEXT: dead %17:vgpr_32 = GLOBAL_LOAD_DWORD %1, 60, 0, implicit $exec
229 # GCN-NEXT: dead %18:vgpr_32 = GLOBAL_LOAD_DWORD %1, 64, 0, implicit $exec
230 # GCN-NEXT: KILL %1{{$}}
233 name: overflow_counter
234 tracksRegLiveness: true
237 %0:vreg_64 = IMPLICIT_DEF
238 %1:vreg_64 = IMPLICIT_DEF
239 %2:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
240 %3:vgpr_32 = GLOBAL_LOAD_DWORD %0, 4, 0, implicit $exec
241 %4:vgpr_32 = GLOBAL_LOAD_DWORD %0, 8, 0, implicit $exec
242 %5:vgpr_32 = GLOBAL_LOAD_DWORD %0, 12, 0, implicit $exec
243 %6:vgpr_32 = GLOBAL_LOAD_DWORD %0, 16, 0, implicit $exec
244 %7:vgpr_32 = GLOBAL_LOAD_DWORD %0, 20, 0, implicit $exec
245 %8:vgpr_32 = GLOBAL_LOAD_DWORD %0, 24, 0, implicit $exec
246 %9:vgpr_32 = GLOBAL_LOAD_DWORD %0, 28, 0, implicit $exec
247 %10:vgpr_32 = GLOBAL_LOAD_DWORD %0, 32, 0, implicit $exec
248 %11:vgpr_32 = GLOBAL_LOAD_DWORD %0, 36, 0, implicit $exec
249 %12:vgpr_32 = GLOBAL_LOAD_DWORD %0, 40, 0, implicit $exec
250 %13:vgpr_32 = GLOBAL_LOAD_DWORD %0, 44, 0, implicit $exec
251 %14:vgpr_32 = GLOBAL_LOAD_DWORD %0, 48, 0, implicit $exec
252 %15:vgpr_32 = GLOBAL_LOAD_DWORD %0, 52, 0, implicit $exec
253 %16:vgpr_32 = GLOBAL_LOAD_DWORD %0, 56, 0, implicit $exec
254 %17:vgpr_32 = GLOBAL_LOAD_DWORD %1, 60, 0, implicit $exec
255 %18:vgpr_32 = GLOBAL_LOAD_DWORD %1, 64, 0, implicit $exec
258 # GCN-LABEL: {{^}}name: reg_pressure{{$}}
259 # GCN: dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
260 # GCN-NEXT: dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
261 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
262 # GCN-NEXT: dead %5:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
263 # GCN-NEXT: dead %6:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 64, 0, implicit $exec
264 # GCN-NEXT: dead %7:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 80, 0, implicit $exec
265 # GCN-NEXT: dead %8:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 96, 0, implicit $exec
266 # GCN-NEXT: KILL %0{{$}}
267 # GCN-NEXT: dead %9:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 128, 0, implicit $exec
268 # GCN-NEXT: dead %10:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 144, 0, implicit $exec
269 # GCN-NEXT: KILL %1{{$}}
273 tracksRegLiveness: true
276 %0:vreg_64 = IMPLICIT_DEF
277 %1:vreg_64 = IMPLICIT_DEF
278 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
279 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
280 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
281 %5:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 48, 0, implicit $exec
282 %6:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 64, 0, implicit $exec
283 %7:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 80, 0, implicit $exec
284 %8:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 96, 0, implicit $exec
285 %9:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 128, 0, implicit $exec
286 %10:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 144, 0, implicit $exec
289 # GCN-LABEL: {{^}}name: image_clause{{$}}
290 # GCN: %3:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, undef %2:sgpr_128, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec
291 # GCN-NEXT: %4:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, undef %2:sgpr_128, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec
292 # GCN-NEXT: %5:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, undef %2:sgpr_128, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec
293 # GCN-NEXT: KILL undef %2:sgpr_128{{$}}
294 # GCN-NEXT: IMAGE_STORE_V4_V2 %3, %0, %1, 15, -1, 0, 0, 0, 0, 0, 0, implicit $exec
298 tracksRegLiveness: true
300 - { id: 0, class: vreg_64 }
301 - { id: 1, class: sgpr_256 }
302 - { id: 2, class: sgpr_128 }
303 - { id: 3, class: vreg_128 }
304 - { id: 4, class: vreg_128 }
305 - { id: 5, class: vreg_128 }
310 %3:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, undef %2:sgpr_128, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (load (s128))
311 %4:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, undef %2:sgpr_128, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (load (s128))
312 %5:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, undef %2:sgpr_128, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (load (s128))
313 IMAGE_STORE_V4_V2 %3, %0, %1, 15, -1, 0, 0, 0, 0, 0, 0, implicit $exec :: (store (s128))
314 IMAGE_STORE_V4_V2 %4, %0, %1, 15, -1, 0, 0, 0, 0, 0, 0, implicit $exec :: (store (s128))
315 IMAGE_STORE_V4_V2 %5, %0, %1, 15, -1, 0, 0, 0, 0, 0, 0, implicit $exec :: (store (s128))
318 # GCN-LABEL: {{^}}name: mixed_clause{{$}}
319 # GCN: dead %3:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, %2, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec
320 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
321 # GCN-NEXT: dead %5:vgpr_32 = BUFFER_LOAD_DWORD_OFFSET %2, 0, 0, 0, 0, implicit $exec
322 # GCN-NEXT: KILL %1{{$}}
323 # GCN-NEXT: KILL %2{{$}}
324 # GCN-NEXT: KILL %0{{$}}
328 tracksRegLiveness: true
330 - { id: 0, class: vreg_64 }
331 - { id: 1, class: sgpr_256 }
332 - { id: 2, class: sgpr_128 }
333 - { id: 3, class: vreg_128 }
334 - { id: 4, class: vreg_128 }
335 - { id: 5, class: vgpr_32 }
341 %3:vreg_128 = IMAGE_SAMPLE_LZ_V4_V2 %0, %1, %2, 15, 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (load (s128))
342 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
343 %5:vgpr_32 = BUFFER_LOAD_DWORD_OFFSET %2, 0, 0, 0, 0, implicit $exec
346 # GCN-LABEL: {{^}}name: atomic{{$}}
347 # GCN: %1:vgpr_32 = IMPLICIT_DEF
348 # GCN-NEXT: dead %2:vgpr_32 = FLAT_ATOMIC_ADD_RTN %0, %1, 0, 2, implicit $exec, implicit $flat_scr
349 # GCN-NEXT: dead %3:vgpr_32 = FLAT_ATOMIC_ADD_RTN %0, %1, 0, 2, implicit $exec, implicit $flat_scr
350 # GCN-NEXT: FLAT_ATOMIC_ADD %0, %1, 0, 0, implicit $exec, implicit $flat_scr
351 # GCN-NEXT: FLAT_ATOMIC_ADD %0, %1, 0, 0, implicit $exec, implicit $flat_scr
352 # GCN-NEXT: S_ENDPGM 0
356 tracksRegLiveness: true
358 - { id: 0, class: vreg_64 }
359 - { id: 1, class: vgpr_32 }
360 - { id: 2, class: vgpr_32 }
361 - { id: 3, class: vgpr_32 }
366 %2:vgpr_32 = FLAT_ATOMIC_ADD_RTN %0, %1, 0, 2, implicit $exec, implicit $flat_scr
367 %3:vgpr_32 = FLAT_ATOMIC_ADD_RTN %0, %1, 0, 2, implicit $exec, implicit $flat_scr
368 FLAT_ATOMIC_ADD %0, %1, 0, 0, implicit $exec, implicit $flat_scr
369 FLAT_ATOMIC_ADD %0, %1, 0, 0, implicit $exec, implicit $flat_scr
373 # One of the pointers has an additional use after the clause, but one
374 # doesn't. Only the final use should be killed.
376 # GCN-LABEL: {{^}}name: ptr_use_after_clause{{$}}
377 # GCN: dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
378 # GCN-NEXT: dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 16, 0, implicit $exec
379 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
380 # GCN-NEXT: dead %5:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 48, 0, implicit $exec
381 # GCN-NEXT: KILL %1{{$}}
382 # GCN-NEXT: S_NOP 0, implicit %0
384 name: ptr_use_after_clause
385 tracksRegLiveness: true
388 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
389 %0:vreg_64 = COPY $vgpr0_vgpr1
390 %1:vreg_64 = COPY $vgpr2_vgpr3
391 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
392 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 16, 0, implicit $exec
393 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 32, 0, implicit $exec
394 %5:vreg_128 = GLOBAL_LOAD_DWORDX4 %1, 48, 0, implicit $exec
398 # Only part of the register is really live past the clause.
399 # GCN-LABEL: {{^}}name: ptr_use_after_clause_subreg{{$}}
400 # GCN: dead %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
401 # GCN-NEXT: dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 16, 0, implicit $exec
402 # GCN-NEXT: dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 32, 0, implicit $exec
403 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 48, 0, implicit $exec
404 # GCN-NEXT: KILL %0.sub2_sub3{{$}}
405 # GCN-NEXT: S_NOP 0, implicit %0.sub0_sub1{{$}}
407 name: ptr_use_after_clause_subreg
408 tracksRegLiveness: true
411 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
412 %0:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
413 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
414 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 16, 0, implicit $exec
415 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 32, 0, implicit $exec
416 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 48, 0, implicit $exec
417 S_NOP 0, implicit %0.sub0_sub1
420 # More complex situation where only some of the use subregisters live
423 # GCN-LABEL: {{^}}name: ptr_use_after_clause_subreg_multi{{$}}
424 # GCN: dead %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
425 # GCN-NEXT: dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 16, 0, implicit $exec
426 # GCN-NEXT: dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub3_sub4, 32, 0, implicit $exec
427 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub6_sub7, 48, 0, implicit $exec
428 # GCN-NEXT: KILL %0.sub2_sub3_sub4, %0.sub7{{$}}
429 # GCN-NEXT: S_NOP 0, implicit %0.sub0_sub1, implicit %0.sub5_sub6
431 name: ptr_use_after_clause_subreg_multi
432 tracksRegLiveness: true
435 liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
436 %0:vreg_256 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
437 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
438 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 16, 0, implicit $exec
439 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub3_sub4, 32, 0, implicit $exec
440 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub6_sub7, 48, 0, implicit $exec
441 S_NOP 0, implicit %0.sub0_sub1, implicit %0.sub5_sub6
444 # Have subranges, but none of them are killed
445 # GCN-LABEL: {{^}}name: no_killed_subranges{{$}}
446 # GCN: dead %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
447 # GCN-NEXT: dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 16, 0, implicit $exec
448 # GCN-NEXT: dead %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 32, 0, implicit $exec
449 # GCN-NEXT: dead %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 48, 0, implicit $exec
450 # GCN-NEXT: S_NOP 0, implicit %0.sub0_sub1{{$}}
451 # GCN-NEXT: S_NOP 0, implicit %0.sub2_sub3{{$}}
453 name: no_killed_subranges
454 tracksRegLiveness: true
457 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
458 %0:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
459 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
460 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 16, 0, implicit $exec
461 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 32, 0, implicit $exec
462 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub2_sub3, 48, 0, implicit $exec
463 S_NOP 0, implicit %0.sub0_sub1
464 S_NOP 0, implicit %0.sub2_sub3
467 # sub2 is undef at entry to the soft clause. It should not be have its
468 # live range extended.
470 # GCN-LABEL: name: no_killed_undef_subrange_use
471 # GCN: dead %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
472 # GCN-NEXT: dead %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 32, 0, implicit $exec
473 # GCN-NEXT: KILL %0.sub0_sub1{{$}}
474 # GCN-NEXT: %0.sub2:vreg_128 = V_MOV_B32_e32 0, implicit $exec
475 # GCN-NEXT: S_NOP 0, implicit %0.sub2
477 name: no_killed_undef_subrange_use
478 tracksRegLiveness: true
481 liveins: $vgpr0_vgpr1
482 undef %0.sub0_sub1:vreg_128 = COPY $vgpr0_vgpr1
483 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 0, 0, implicit $exec
484 %3:vreg_128 = GLOBAL_LOAD_DWORDX4 %0.sub0_sub1, 32, 0, implicit $exec
485 %0.sub2:vreg_128 = V_MOV_B32_e32 0, implicit $exec
486 S_NOP 0, implicit %0.sub2
489 # Make sure intervening implicit_defs are not treated as breaking the
492 # GCN-LABEL: {{^}}name: implicit_def_no_break{{$}}
493 # GCN: %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
494 # GCN-NEXT: %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
495 # GCN-NEXT: %3:vreg_64 = IMPLICIT_DEF
496 # GCN-NEXT: %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %3, 32, 0, implicit $exec
497 # GCN-NEXT: %5:vreg_128 = GLOBAL_LOAD_DWORDX4 %3, 48, 0, implicit $exec
498 # GCN-NEXT: KILL %3{{$}}
499 # GCN-NEXT: KILL %0{{$}}
501 name: implicit_def_no_break
502 tracksRegLiveness: true
505 liveins: $vgpr0_vgpr1
506 %0:vreg_64 = COPY $vgpr0_vgpr1
507 %1:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 0, 0, implicit $exec
508 %2:vreg_128 = GLOBAL_LOAD_DWORDX4 %0, 16, 0, implicit $exec
509 %3:vreg_64 = IMPLICIT_DEF
510 %4:vreg_128 = GLOBAL_LOAD_DWORDX4 %3, 32, 0, implicit $exec
511 %5:vreg_128 = GLOBAL_LOAD_DWORDX4 %3, 48, 0, implicit $exec
512 S_NOP 0, implicit %1, implicit %2, implicit %4, implicit %5
515 # GCN-LABEL: {{^}}name: kill_part_subreg{{$}}
516 # GCN: undef %1.sub0:vreg_128 = GLOBAL_LOAD_DWORD %0.sub0_sub1, 0, 0, implicit $exec
517 # GCN-NEXT: %1.sub1:vreg_128 = GLOBAL_LOAD_DWORD %0.sub1_sub2, 16, 0, implicit $exec
518 # GCN-NEXT: %1.sub3:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
519 # GCN-NEXT: KILL %0.sub0_sub1_sub2, %0.sub3
521 name: kill_part_subreg
522 tracksRegLiveness: true
525 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
526 %0:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
527 undef %1.sub0:vreg_128 = GLOBAL_LOAD_DWORD %0.sub0_sub1, 0, 0, implicit $exec
528 %1.sub1:vreg_128 = GLOBAL_LOAD_DWORD %0.sub1_sub2, 16, 0, implicit $exec
529 %1.sub3:vreg_128 = GLOBAL_LOAD_DWORD %0.sub2_sub3, 32, 0, implicit $exec
533 # GCN-LABEL: {{^}}name: mem_clause_sreg256_used_stack{{$}}
534 # GCN: undef %0.sub7:sgpr_256 = S_LOAD_DWORD_IMM undef %1:sgpr_64(p4), 8, 0
535 # GCN-NEXT: dead %0.sub3:sgpr_256 = S_LOAD_DWORD_IMM undef %1:sgpr_64(p4), 24, 0
536 # GCN-NEXT: KILL undef %1
538 name: mem_clause_sreg256_used_stack
540 - { id: 0, type: default, offset: 0, size: 40, alignment: 8 }
542 isEntryFunction: true
543 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
544 stackPtrOffsetReg: '$sgpr32'
548 undef %0.sub7:sgpr_256 = S_LOAD_DWORD_IMM undef %1:sgpr_64(p4), 8, 0
549 %0.sub3:sgpr_256 = S_LOAD_DWORD_IMM undef %1:sgpr_64(p4), 24, 0