1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -run-pass=si-fold-operands -verify-machineinstrs -o - %s | FileCheck --check-prefix=GFX908 %s
3 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -run-pass=si-fold-operands -verify-machineinstrs -o - %s | FileCheck --check-prefix=GFX90A %s
5 # Should fold all copies for gfx908. In case of gfx90a, the folding must happen only for the aligned cases.
9 tracksRegLiveness: true
13 ; GFX908-LABEL: name: aligned_vgpr_64
14 ; GFX908: liveins: $vgpr0_vgpr1
16 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
17 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_64_align2 = IMPLICIT_DEF
18 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]], 0, 0, implicit $exec
19 ; GFX90A-LABEL: name: aligned_vgpr_64
20 ; GFX90A: liveins: $vgpr0_vgpr1
22 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
23 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_64_align2 = IMPLICIT_DEF
24 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]], 0, 0, implicit $exec
25 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
26 %1:vreg_64_align2 = IMPLICIT_DEF
27 %2:vreg_64_align2 = COPY killed %1
28 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
32 name: unaligned_vgpr_64
33 tracksRegLiveness: true
37 ; GFX908-LABEL: name: unaligned_vgpr_64
38 ; GFX908: liveins: $vgpr0_vgpr1
40 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
41 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
42 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]], 0, 0, implicit $exec
43 ; GFX90A-LABEL: name: unaligned_vgpr_64
44 ; GFX90A: liveins: $vgpr0_vgpr1
46 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
47 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
48 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:vreg_64_align2 = COPY killed [[DEF]]
49 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[COPY1]], 0, 0, implicit $exec
50 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
51 %1:vreg_64 = IMPLICIT_DEF
52 %2:vreg_64_align2 = COPY killed %1
53 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
57 name: aligned_vgpr_96_sub0_subg1
58 tracksRegLiveness: true
62 ; GFX908-LABEL: name: aligned_vgpr_96_sub0_subg1
63 ; GFX908: liveins: $vgpr0_vgpr1
65 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
66 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_96_align2 = IMPLICIT_DEF
67 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub0_sub1, 0, 0, implicit $exec
68 ; GFX90A-LABEL: name: aligned_vgpr_96_sub0_subg1
69 ; GFX90A: liveins: $vgpr0_vgpr1
71 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
72 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_96_align2 = IMPLICIT_DEF
73 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub0_sub1, 0, 0, implicit $exec
74 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
75 %1:vreg_96_align2 = IMPLICIT_DEF
76 %2:vreg_64_align2 = COPY killed %1.sub0_sub1:vreg_96_align2
77 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
81 name: unaligned_vgpr_96_sub1_sub2
82 tracksRegLiveness: true
86 ; GFX908-LABEL: name: unaligned_vgpr_96_sub1_sub2
87 ; GFX908: liveins: $vgpr0_vgpr1
89 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
90 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_96_align2 = IMPLICIT_DEF
91 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub1_sub2, 0, 0, implicit $exec
92 ; GFX90A-LABEL: name: unaligned_vgpr_96_sub1_sub2
93 ; GFX90A: liveins: $vgpr0_vgpr1
95 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
96 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_96_align2 = IMPLICIT_DEF
97 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:vreg_64_align2 = COPY killed [[DEF]].sub1_sub2
98 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[COPY1]], 0, 0, implicit $exec
99 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
100 %1:vreg_96_align2 = IMPLICIT_DEF
101 %2:vreg_64_align2 = COPY killed %1.sub1_sub2:vreg_96_align2
102 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
106 name: aligned_vgpr_96
107 tracksRegLiveness: true
110 liveins: $vgpr0_vgpr1
111 ; GFX908-LABEL: name: aligned_vgpr_96
112 ; GFX908: liveins: $vgpr0_vgpr1
113 ; GFX908-NEXT: {{ $}}
114 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
115 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_96_align2 = IMPLICIT_DEF
116 ; GFX908-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]], 0, 0, implicit $exec
117 ; GFX90A-LABEL: name: aligned_vgpr_96
118 ; GFX90A: liveins: $vgpr0_vgpr1
119 ; GFX90A-NEXT: {{ $}}
120 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
121 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_96_align2 = IMPLICIT_DEF
122 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]], 0, 0, implicit $exec
123 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
124 %1:vreg_96_align2 = IMPLICIT_DEF
125 %2:vreg_96_align2 = COPY killed %1
126 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
130 name: unaligned_vgpr_96
131 tracksRegLiveness: true
134 liveins: $vgpr0_vgpr1
135 ; GFX908-LABEL: name: unaligned_vgpr_96
136 ; GFX908: liveins: $vgpr0_vgpr1
137 ; GFX908-NEXT: {{ $}}
138 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
139 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_96 = IMPLICIT_DEF
140 ; GFX908-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]], 0, 0, implicit $exec
141 ; GFX90A-LABEL: name: unaligned_vgpr_96
142 ; GFX90A: liveins: $vgpr0_vgpr1
143 ; GFX90A-NEXT: {{ $}}
144 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
145 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_96 = IMPLICIT_DEF
146 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:vreg_96_align2 = COPY killed [[DEF]]
147 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[COPY1]], 0, 0, implicit $exec
148 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
149 %1:vreg_96 = IMPLICIT_DEF
150 %2:vreg_96_align2 = COPY killed %1
151 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
155 name: aligned_vgpr_128_sub0_sub1
156 tracksRegLiveness: true
159 liveins: $vgpr0_vgpr1
160 ; GFX908-LABEL: name: aligned_vgpr_128_sub0_sub1
161 ; GFX908: liveins: $vgpr0_vgpr1
162 ; GFX908-NEXT: {{ $}}
163 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
164 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
165 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub0_sub1, 0, 0, implicit $exec
166 ; GFX90A-LABEL: name: aligned_vgpr_128_sub0_sub1
167 ; GFX90A: liveins: $vgpr0_vgpr1
168 ; GFX90A-NEXT: {{ $}}
169 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
170 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
171 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub0_sub1, 0, 0, implicit $exec
172 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
173 %1:vreg_128_align2 = IMPLICIT_DEF
174 %2:vreg_64_align2 = COPY killed %1.sub0_sub1:vreg_128_align2
175 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
179 name: aligned_vgpr_128_sub2_sub3
180 tracksRegLiveness: true
183 liveins: $vgpr0_vgpr1
184 ; GFX908-LABEL: name: aligned_vgpr_128_sub2_sub3
185 ; GFX908: liveins: $vgpr0_vgpr1
186 ; GFX908-NEXT: {{ $}}
187 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
188 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
189 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub2_sub3, 0, 0, implicit $exec
190 ; GFX90A-LABEL: name: aligned_vgpr_128_sub2_sub3
191 ; GFX90A: liveins: $vgpr0_vgpr1
192 ; GFX90A-NEXT: {{ $}}
193 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
194 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
195 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub2_sub3, 0, 0, implicit $exec
196 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
197 %1:vreg_128_align2 = IMPLICIT_DEF
198 %2:vreg_64_align2 = COPY killed %1.sub2_sub3:vreg_128_align2
199 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
203 name: unaligned_vgpr_128_sub1_sub2
204 tracksRegLiveness: true
207 liveins: $vgpr0_vgpr1
208 ; GFX908-LABEL: name: unaligned_vgpr_128_sub1_sub2
209 ; GFX908: liveins: $vgpr0_vgpr1
210 ; GFX908-NEXT: {{ $}}
211 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
212 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
213 ; GFX908-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[DEF]].sub1_sub2, 0, 0, implicit $exec
214 ; GFX90A-LABEL: name: unaligned_vgpr_128_sub1_sub2
215 ; GFX90A: liveins: $vgpr0_vgpr1
216 ; GFX90A-NEXT: {{ $}}
217 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
218 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
219 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:vreg_64_align2 = COPY killed [[DEF]].sub1_sub2
220 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX2 [[COPY]], [[COPY1]], 0, 0, implicit $exec
221 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
222 %1:vreg_128_align2 = IMPLICIT_DEF
223 %2:vreg_64_align2 = COPY killed %1.sub1_sub2:vreg_128_align2
224 GLOBAL_STORE_DWORDX2 %0, %2, 0, 0, implicit $exec
228 name: aligned_vgpr_128_sub0_sub1_sub2
229 tracksRegLiveness: true
232 liveins: $vgpr0_vgpr1
233 ; GFX908-LABEL: name: aligned_vgpr_128_sub0_sub1_sub2
234 ; GFX908: liveins: $vgpr0_vgpr1
235 ; GFX908-NEXT: {{ $}}
236 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
237 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
238 ; GFX908-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]].sub0_sub1_sub2, 0, 0, implicit $exec
239 ; GFX90A-LABEL: name: aligned_vgpr_128_sub0_sub1_sub2
240 ; GFX90A: liveins: $vgpr0_vgpr1
241 ; GFX90A-NEXT: {{ $}}
242 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
243 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
244 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]].sub0_sub1_sub2, 0, 0, implicit $exec
245 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
246 %1:vreg_128_align2 = IMPLICIT_DEF
247 %2:vreg_96_align2 = COPY killed %1.sub0_sub1_sub2:vreg_128_align2
248 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
252 name: unaligned_vgpr_128_sub1_sub2_sub3
253 tracksRegLiveness: true
256 liveins: $vgpr0_vgpr1
257 ; GFX908-LABEL: name: unaligned_vgpr_128_sub1_sub2_sub3
258 ; GFX908: liveins: $vgpr0_vgpr1
259 ; GFX908-NEXT: {{ $}}
260 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
261 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
262 ; GFX908-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[DEF]].sub1_sub2_sub3, 0, 0, implicit $exec
263 ; GFX90A-LABEL: name: unaligned_vgpr_128_sub1_sub2_sub3
264 ; GFX90A: liveins: $vgpr0_vgpr1
265 ; GFX90A-NEXT: {{ $}}
266 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
267 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
268 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:vreg_96_align2 = COPY killed [[DEF]].sub1_sub2_sub3
269 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX3 [[COPY]], [[COPY1]], 0, 0, implicit $exec
270 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
271 %1:vreg_128_align2 = IMPLICIT_DEF
272 %2:vreg_96_align2 = COPY killed %1.sub1_sub2_sub3:vreg_128_align2
273 GLOBAL_STORE_DWORDX3 %0, %2, 0, 0, implicit $exec
277 name: aligned_vgpr_128
278 tracksRegLiveness: true
281 liveins: $vgpr0_vgpr1
282 ; GFX908-LABEL: name: aligned_vgpr_128
283 ; GFX908: liveins: $vgpr0_vgpr1
284 ; GFX908-NEXT: {{ $}}
285 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
286 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
287 ; GFX908-NEXT: GLOBAL_STORE_DWORDX4 [[COPY]], [[DEF]], 0, 0, implicit $exec
288 ; GFX90A-LABEL: name: aligned_vgpr_128
289 ; GFX90A: liveins: $vgpr0_vgpr1
290 ; GFX90A-NEXT: {{ $}}
291 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
292 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128_align2 = IMPLICIT_DEF
293 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX4 [[COPY]], [[DEF]], 0, 0, implicit $exec
294 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
295 %1:vreg_128_align2 = IMPLICIT_DEF
296 %2:vreg_128_align2 = COPY killed %1
297 GLOBAL_STORE_DWORDX4 %0, %2, 0, 0, implicit $exec
301 name: unaligned_vgpr_128
302 tracksRegLiveness: true
305 liveins: $vgpr0_vgpr1
306 ; GFX908-LABEL: name: unaligned_vgpr_128
307 ; GFX908: liveins: $vgpr0_vgpr1
308 ; GFX908-NEXT: {{ $}}
309 ; GFX908-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
310 ; GFX908-NEXT: [[DEF:%[0-9]+]]:vreg_128 = IMPLICIT_DEF
311 ; GFX908-NEXT: GLOBAL_STORE_DWORDX4 [[COPY]], [[DEF]], 0, 0, implicit $exec
312 ; GFX90A-LABEL: name: unaligned_vgpr_128
313 ; GFX90A: liveins: $vgpr0_vgpr1
314 ; GFX90A-NEXT: {{ $}}
315 ; GFX90A-NEXT: [[COPY:%[0-9]+]]:vreg_64_align2 = COPY $vgpr0_vgpr1
316 ; GFX90A-NEXT: [[DEF:%[0-9]+]]:vreg_128 = IMPLICIT_DEF
317 ; GFX90A-NEXT: [[COPY1:%[0-9]+]]:vreg_128_align2 = COPY killed [[DEF]]
318 ; GFX90A-NEXT: GLOBAL_STORE_DWORDX4 [[COPY]], [[COPY1]], 0, 0, implicit $exec
319 %0:vreg_64_align2 = COPY $vgpr0_vgpr1
320 %1:vreg_128 = IMPLICIT_DEF
321 %2:vreg_128_align2 = COPY killed %1
322 GLOBAL_STORE_DWORDX4 %0, %2, 0, 0, implicit $exec