1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs -run-pass=si-fold-operands %s -o - | FileCheck -check-prefix=GCN %s
5 define amdgpu_kernel void @redef_m0_same_copy() { ret void }
6 define amdgpu_kernel void @multi_redef_m0_same_copy() { ret void }
7 define amdgpu_kernel void @redef_m0_different_copy() { ret void }
8 define amdgpu_kernel void @redef_m0_mixed_copy0() { ret void }
9 define amdgpu_kernel void @redef_m0_mixed_copy1() { ret void }
10 define amdgpu_kernel void @redef_m0_same_mov_imm() { ret void }
11 define amdgpu_kernel void @redef_m0_different_inst0() { ret void }
12 define amdgpu_kernel void @redef_m0_different_inst1() { ret void }
13 define amdgpu_kernel void @redef_m0_mixed_read_m0() { ret void }
14 define amdgpu_kernel void @redef_m0_same_copy_call() { ret void }
15 define amdgpu_kernel void @redef_m0_same_copy_multi_block() { ret void }
16 define amdgpu_kernel void @redef_m0_copy_self() { ret void }
17 define amdgpu_kernel void @redef_m0_copy_physreg() { ret void }
23 name: redef_m0_same_copy
24 tracksRegLiveness: true
29 liveins: $vgpr0, $sgpr0
31 ; GCN-LABEL: name: redef_m0_same_copy
32 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
33 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
34 ; GCN: $m0 = COPY [[COPY1]]
35 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
36 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
37 %0:vgpr_32 = COPY $vgpr0
38 %1:sgpr_32 = COPY $sgpr0
40 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
42 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
47 name: multi_redef_m0_same_copy
48 tracksRegLiveness: true
53 liveins: $vgpr0, $sgpr0
55 ; GCN-LABEL: name: multi_redef_m0_same_copy
56 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
57 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
58 ; GCN: $m0 = COPY [[COPY1]]
59 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
60 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
61 %0:vgpr_32 = COPY $vgpr0
62 %1:sgpr_32 = COPY $sgpr0
64 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
67 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
72 name: redef_m0_different_copy
73 tracksRegLiveness: true
78 liveins: $vgpr0, $sgpr0, $sgpr1
80 ; GCN-LABEL: name: redef_m0_different_copy
81 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
82 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
83 ; GCN: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr1
84 ; GCN: $m0 = COPY [[COPY1]]
85 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
86 ; GCN: $m0 = COPY [[COPY2]]
87 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
88 %0:vgpr_32 = COPY $vgpr0
89 %1:sgpr_32 = COPY $sgpr0
90 %2:sgpr_32 = COPY $sgpr1
92 %3:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
94 %4:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
99 name: redef_m0_mixed_copy0
100 tracksRegLiveness: true
102 isEntryFunction: true
105 liveins: $vgpr0, $sgpr0, $sgpr1
107 ; GCN-LABEL: name: redef_m0_mixed_copy0
108 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
109 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
110 ; GCN: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr1
111 ; GCN: $m0 = COPY [[COPY1]]
112 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
113 ; GCN: $m0 = COPY [[COPY2]]
114 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
115 %0:vgpr_32 = COPY $vgpr0
116 %1:sgpr_32 = COPY $sgpr0
117 %2:sgpr_32 = COPY $sgpr1
119 %3:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
122 %4:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
127 name: redef_m0_mixed_copy1
128 tracksRegLiveness: true
131 isEntryFunction: true
134 liveins: $vgpr0, $sgpr0, $sgpr1
136 ; GCN-LABEL: name: redef_m0_mixed_copy1
137 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
138 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
139 ; GCN: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr1
140 ; GCN: $m0 = COPY [[COPY1]]
141 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
142 ; GCN: $m0 = COPY [[COPY2]]
143 ; GCN: $m0 = COPY [[COPY1]]
144 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
145 %0:vgpr_32 = COPY $vgpr0
146 %1:sgpr_32 = COPY $sgpr0
147 %2:sgpr_32 = COPY $sgpr1
149 %3:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
152 %4:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
157 name: redef_m0_same_mov_imm
158 tracksRegLiveness: true
160 isEntryFunction: true
163 liveins: $vgpr0, $sgpr0
165 ; GCN-LABEL: name: redef_m0_same_mov_imm
166 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
167 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
168 ; GCN: $m0 = S_MOV_B32 -1
169 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
170 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
171 %0:vgpr_32 = COPY $vgpr0
172 %1:sgpr_32 = COPY $sgpr0
174 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
176 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
181 name: redef_m0_different_inst0
182 tracksRegLiveness: true
184 isEntryFunction: true
187 liveins: $vgpr0, $sgpr0
189 ; GCN-LABEL: name: redef_m0_different_inst0
190 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
191 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
192 ; GCN: $m0 = COPY [[COPY1]]
193 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
194 ; GCN: $m0 = IMPLICIT_DEF
195 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
196 %0:vgpr_32 = COPY $vgpr0
197 %1:sgpr_32 = COPY $sgpr0
199 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
201 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
206 name: redef_m0_different_inst1
207 tracksRegLiveness: true
209 isEntryFunction: true
212 liveins: $vgpr0, $sgpr0
214 ; GCN-LABEL: name: redef_m0_different_inst1
215 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
216 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
217 ; GCN: $m0 = COPY [[COPY1]]
218 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
219 ; GCN: S_NOP 0, implicit-def $m0
220 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
221 %0:vgpr_32 = COPY $vgpr0
222 %1:sgpr_32 = COPY $sgpr0
224 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
225 S_NOP 0, implicit-def $m0
226 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
231 name: redef_m0_mixed_read_m0
232 tracksRegLiveness: true
234 isEntryFunction: true
237 liveins: $vgpr0, $sgpr0, $sgpr1
239 ; GCN-LABEL: name: redef_m0_mixed_read_m0
240 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
241 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
242 ; GCN: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr1
243 ; GCN: $m0 = COPY [[COPY1]]
244 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
245 ; GCN: $m0 = COPY [[COPY2]]
246 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
247 ; GCN: [[DS_READ_B32_2:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 128, 0, implicit $m0, implicit $exec :: (load 4)
248 %0:vgpr_32 = COPY $vgpr0
249 %1:sgpr_32 = COPY $sgpr0
250 %2:sgpr_32 = COPY $sgpr1
252 %3:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
254 %4:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
256 %5:vgpr_32 = DS_READ_B32 %0, 128, 0, implicit $m0, implicit $exec :: (load 4)
260 name: redef_m0_same_copy_call
261 tracksRegLiveness: true
263 isEntryFunction: true
266 liveins: $vgpr0, $sgpr0
268 ; GCN-LABEL: name: redef_m0_same_copy_call
269 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
270 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
271 ; GCN: $m0 = COPY [[COPY1]]
272 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
273 ; GCN: dead $sgpr30_sgpr31 = SI_CALL undef $sgpr6_sgpr7, @func, csr_amdgpu_highregs
274 ; GCN: $m0 = COPY [[COPY1]]
275 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
276 %0:vgpr_32 = COPY $vgpr0
277 %1:sgpr_32 = COPY $sgpr0
279 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
280 dead $sgpr30_sgpr31 = SI_CALL undef $sgpr6_sgpr7, @func, csr_amdgpu_highregs
282 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
287 name: redef_m0_same_copy_multi_block
288 tracksRegLiveness: true
290 isEntryFunction: true
292 ; GCN-LABEL: name: redef_m0_same_copy_multi_block
294 ; GCN: successors: %bb.1(0x80000000)
295 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
296 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
297 ; GCN: $m0 = COPY [[COPY1]]
298 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
300 ; GCN: $m0 = COPY [[COPY1]]
301 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
303 liveins: $vgpr0, $sgpr0
305 %0:vgpr_32 = COPY $vgpr0
306 %1:sgpr_32 = COPY $sgpr0
308 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
312 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
317 name: redef_m0_copy_self
318 tracksRegLiveness: true
320 isEntryFunction: true
323 liveins: $vgpr0, $sgpr0
325 ; GCN-LABEL: name: redef_m0_copy_self
326 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
327 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
328 ; GCN: $m0 = COPY [[COPY1]]
329 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
330 ; GCN: $m0 = COPY $m0
331 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
332 %0:vgpr_32 = COPY $vgpr0
333 %1:sgpr_32 = COPY $sgpr0
335 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
337 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)
342 name: redef_m0_copy_physreg
343 tracksRegLiveness: true
345 isEntryFunction: true
348 liveins: $vgpr0, $sgpr0
350 ; GCN-LABEL: name: redef_m0_copy_physreg
351 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
352 ; GCN: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0
353 ; GCN: $m0 = COPY $sgpr0
354 ; GCN: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load 4)
355 ; GCN: $sgpr0 = S_MOV_B32 0
356 ; GCN: $m0 = COPY $sgpr0
357 ; GCN: [[DS_READ_B32_1:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 64, 0, implicit $m0, implicit $exec :: (load 4)
358 %0:vgpr_32 = COPY $vgpr0
359 %1:sgpr_32 = COPY $sgpr0
361 %2:vgpr_32 = DS_READ_B32 %0, 0, 0, implicit $m0, implicit $exec :: (load 4)
364 %3:vgpr_32 = DS_READ_B32 %0, 64, 0, implicit $m0, implicit $exec :: (load 4)