1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
5 name: sext_inreg_s32_7_sextload_from_1
6 tracksRegLiveness: true
9 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
11 ; GCN-LABEL: name: sext_inreg_s32_7_sextload_from_1
12 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
14 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
15 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
16 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SEXTLOAD]], 7
17 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
18 %0:_(p1) = COPY $vgpr0_vgpr1
19 %1:_(s32) = G_SEXTLOAD %0 :: (load (s8), addrspace 1)
20 %2:_(s32) = G_SEXT_INREG %1, 7
26 name: sext_inreg_s32_8_sextload_from_1
27 tracksRegLiveness: true
30 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
32 ; GCN-LABEL: name: sext_inreg_s32_8_sextload_from_1
33 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
35 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
36 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
37 ; GCN-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
38 %0:_(p1) = COPY $vgpr0_vgpr1
39 %1:_(s32) = G_SEXTLOAD %0 :: (load (s8), addrspace 1)
40 %2:_(s32) = G_SEXT_INREG %1, 8
46 name: sext_inreg_s32_9_sextload_from_1
47 tracksRegLiveness: true
50 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
52 ; GCN-LABEL: name: sext_inreg_s32_9_sextload_from_1
53 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
55 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
56 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
57 ; GCN-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
58 %0:_(p1) = COPY $vgpr0_vgpr1
59 %1:_(s32) = G_SEXTLOAD %0 :: (load (s8), addrspace 1)
60 %2:_(s32) = G_SEXT_INREG %1, 9
66 name: sext_inreg_s32_7_sext_from_s8
67 tracksRegLiveness: true
70 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
72 ; GCN-LABEL: name: sext_inreg_s32_7_sext_from_s8
73 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
75 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
76 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
77 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SEXTLOAD]], 7
78 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
79 %0:_(p1) = COPY $vgpr0_vgpr1
80 %1:_(s8) = G_LOAD %0 :: (load (s8), addrspace 1)
82 %3:_(s32) = G_SEXT_INREG %2, 7
88 name: sext_inreg_s32_8_sext_from_s8
89 tracksRegLiveness: true
92 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
94 ; GCN-LABEL: name: sext_inreg_s32_8_sext_from_s8
95 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
97 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
98 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
99 ; GCN-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
100 %0:_(p1) = COPY $vgpr0_vgpr1
101 %1:_(s8) = G_LOAD %0 :: (load (s8), addrspace 1)
102 %2:_(s32) = G_SEXT %1
103 %3:_(s32) = G_SEXT_INREG %2, 8
109 name: sext_inreg_s32_8_sext_from_s9
110 tracksRegLiveness: true
113 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
115 ; GCN-LABEL: name: sext_inreg_s32_8_sext_from_s9
116 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
118 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
119 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
120 ; GCN-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
121 %0:_(p1) = COPY $vgpr0_vgpr1
122 %1:_(s8) = G_LOAD %0 :: (load (s8), addrspace 1)
123 %2:_(s32) = G_SEXT %1
124 %3:_(s32) = G_SEXT_INREG %2, 9
130 name: sext_inreg_v2s32_7_sext_from_v2s8
131 tracksRegLiveness: true
134 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
136 ; GCN-LABEL: name: sext_inreg_v2s32_7_sext_from_v2s8
137 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
139 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
140 ; GCN-NEXT: [[LOAD:%[0-9]+]]:_(<2 x s8>) = G_LOAD [[COPY]](p1) :: (load (<2 x s8>), addrspace 1)
141 ; GCN-NEXT: [[SEXT:%[0-9]+]]:_(<2 x s32>) = G_SEXT [[LOAD]](<2 x s8>)
142 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(<2 x s32>) = G_SEXT_INREG [[SEXT]], 7
143 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[SEXT_INREG]](<2 x s32>)
144 %0:_(p1) = COPY $vgpr0_vgpr1
145 %1:_(<2 x s8>) = G_LOAD %0 :: (load (<2 x s8>), addrspace 1)
146 %2:_(<2 x s32>) = G_SEXT %1
147 %3:_(<2 x s32>) = G_SEXT_INREG %2, 7
148 $vgpr0_vgpr1 = COPY %3
153 name: sext_inreg_v2s32_8_sext_from_v2s8
154 tracksRegLiveness: true
157 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
159 ; GCN-LABEL: name: sext_inreg_v2s32_8_sext_from_v2s8
160 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
162 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
163 ; GCN-NEXT: [[LOAD:%[0-9]+]]:_(<2 x s8>) = G_LOAD [[COPY]](p1) :: (load (<2 x s8>), addrspace 1)
164 ; GCN-NEXT: [[SEXT:%[0-9]+]]:_(<2 x s32>) = G_SEXT [[LOAD]](<2 x s8>)
165 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[SEXT]](<2 x s32>)
166 %0:_(p1) = COPY $vgpr0_vgpr1
167 %1:_(<2 x s8>) = G_LOAD %0 :: (load (<2 x s8>), addrspace 1)
168 %2:_(<2 x s32>) = G_SEXT %1
169 %3:_(<2 x s32>) = G_SEXT_INREG %2, 8
170 $vgpr0_vgpr1 = COPY %3
175 name: sext_inreg_v2s32_9_sext_from_v2s8
176 tracksRegLiveness: true
179 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
181 ; GCN-LABEL: name: sext_inreg_v2s32_9_sext_from_v2s8
182 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
184 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
185 ; GCN-NEXT: [[LOAD:%[0-9]+]]:_(<2 x s8>) = G_LOAD [[COPY]](p1) :: (load (<2 x s8>), addrspace 1)
186 ; GCN-NEXT: [[SEXT:%[0-9]+]]:_(<2 x s32>) = G_SEXT [[LOAD]](<2 x s8>)
187 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[SEXT]](<2 x s32>)
188 %0:_(p1) = COPY $vgpr0_vgpr1
189 %1:_(<2 x s8>) = G_LOAD %0 :: (load (<2 x s8>), addrspace 1)
190 %2:_(<2 x s32>) = G_SEXT %1
191 %3:_(<2 x s32>) = G_SEXT_INREG %2, 9
192 $vgpr0_vgpr1 = COPY %3
197 name: sext_inreg_s32_7_zextload_from_1
198 tracksRegLiveness: true
201 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
203 ; GCN-LABEL: name: sext_inreg_s32_7_zextload_from_1
204 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
206 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
207 ; GCN-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
208 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ZEXTLOAD]], 7
209 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
210 %0:_(p1) = COPY $vgpr0_vgpr1
211 %1:_(s32) = G_ZEXTLOAD %0 :: (load (s8), addrspace 1)
212 %2:_(s32) = G_SEXT_INREG %1, 7
218 name: sext_inreg_s32_8_zextload_from_1
219 tracksRegLiveness: true
222 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
224 ; GCN-LABEL: name: sext_inreg_s32_8_zextload_from_1
225 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
227 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
228 ; GCN-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
229 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ZEXTLOAD]], 8
230 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
231 %0:_(p1) = COPY $vgpr0_vgpr1
232 %1:_(s32) = G_ZEXTLOAD %0 :: (load (s8), addrspace 1)
233 %2:_(s32) = G_SEXT_INREG %1, 8
239 name: sext_inreg_s32_9_zextload_from_1
240 tracksRegLiveness: true
243 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
245 ; GCN-LABEL: name: sext_inreg_s32_9_zextload_from_1
246 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
248 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
249 ; GCN-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
250 ; GCN-NEXT: $vgpr0 = COPY [[ZEXTLOAD]](s32)
251 %0:_(p1) = COPY $vgpr0_vgpr1
252 %1:_(s32) = G_ZEXTLOAD %0 :: (load (s8), addrspace 1)
253 %2:_(s32) = G_SEXT_INREG %1, 9
259 name: sext_inreg_s32_select_sextload_from_1
260 tracksRegLiveness: true
263 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5
265 ; GCN-LABEL: name: sext_inreg_s32_select_sextload_from_1
266 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5
268 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
269 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3
270 ; GCN-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4
271 ; GCN-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr5
272 ; GCN-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]]
273 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
274 ; GCN-NEXT: [[SEXTLOAD1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY1]](p1) :: (load (s8), addrspace 1)
275 ; GCN-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SEXTLOAD]], [[SEXTLOAD1]]
276 ; GCN-NEXT: $vgpr0 = COPY [[SELECT]](s32)
277 %0:_(p1) = COPY $vgpr0_vgpr1
278 %1:_(p1) = COPY $vgpr2_vgpr3
279 %2:_(s32) = COPY $vgpr4
280 %3:_(s32) = COPY $vgpr5
281 %4:_(s1) = G_ICMP intpred(eq), %2, %3
282 %5:_(s32) = G_SEXTLOAD %0 :: (load (s8), addrspace 1)
283 %6:_(s32) = G_SEXTLOAD %1 :: (load (s8), addrspace 1)
284 %7:_(s32) = G_SELECT %4, %5, %6
285 %8:_(s32) = G_SEXT_INREG %7, 8
291 name: sext_inreg_s32_select_sextload_from_1_fail_lhs
292 tracksRegLiveness: true
295 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5
297 ; GCN-LABEL: name: sext_inreg_s32_select_sextload_from_1_fail_lhs
298 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5
300 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
301 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3
302 ; GCN-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4
303 ; GCN-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr5
304 ; GCN-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]]
305 ; GCN-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load (s32), addrspace 1)
306 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY1]](p1) :: (load (s8), addrspace 1)
307 ; GCN-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[LOAD]], [[SEXTLOAD]]
308 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SELECT]], 8
309 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
310 %0:_(p1) = COPY $vgpr0_vgpr1
311 %1:_(p1) = COPY $vgpr2_vgpr3
312 %2:_(s32) = COPY $vgpr4
313 %3:_(s32) = COPY $vgpr5
314 %4:_(s1) = G_ICMP intpred(eq), %2, %3
315 %5:_(s32) = G_LOAD %0 :: (load (s32), addrspace 1)
316 %6:_(s32) = G_SEXTLOAD %1 :: (load (s8), addrspace 1)
317 %7:_(s32) = G_SELECT %4, %5, %6
318 %8:_(s32) = G_SEXT_INREG %7, 8
324 name: sext_inreg_s32_select_sextload_from_1_fail_rhs
325 tracksRegLiveness: true
328 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5
330 ; GCN-LABEL: name: sext_inreg_s32_select_sextload_from_1_fail_rhs
331 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5
333 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
334 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3
335 ; GCN-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4
336 ; GCN-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr5
337 ; GCN-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]]
338 ; GCN-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
339 ; GCN-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY1]](p1) :: (load (s32), addrspace 1)
340 ; GCN-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SEXTLOAD]], [[LOAD]]
341 ; GCN-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SELECT]], 8
342 ; GCN-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
343 %0:_(p1) = COPY $vgpr0_vgpr1
344 %1:_(p1) = COPY $vgpr2_vgpr3
345 %2:_(s32) = COPY $vgpr4
346 %3:_(s32) = COPY $vgpr5
347 %4:_(s1) = G_ICMP intpred(eq), %2, %3
348 %5:_(s32) = G_SEXTLOAD %0 :: (load (s8), addrspace 1)
349 %6:_(s32) = G_LOAD %1 :: (load (s32), addrspace 1)
350 %7:_(s32) = G_SELECT %4, %5, %6
351 %8:_(s32) = G_SEXT_INREG %7, 8
357 tracksRegLiveness: true
361 ; GCN-LABEL: name: assert_sext_s8
362 ; GCN: liveins: $vgpr0
364 ; GCN-NEXT: %copy:_(s32) = COPY $vgpr0
365 ; GCN-NEXT: %assert_sext:_(s32) = G_ASSERT_SEXT %copy, 8
366 ; GCN-NEXT: $vgpr0 = COPY %assert_sext(s32)
367 %copy:_(s32) = COPY $vgpr0
368 %assert_sext:_(s32) = G_ASSERT_SEXT %copy, 8
369 %sext_inreg:_(s32) = G_SEXT_INREG %assert_sext, 8
370 $vgpr0 = COPY %sext_inreg
374 name: sext_inreg_s7_assert_sext_s8
375 tracksRegLiveness: true
379 ; GCN-LABEL: name: sext_inreg_s7_assert_sext_s8
380 ; GCN: liveins: $vgpr0
382 ; GCN-NEXT: %copy:_(s32) = COPY $vgpr0
383 ; GCN-NEXT: %assert_sext:_(s32) = G_ASSERT_SEXT %copy, 8
384 ; GCN-NEXT: %sext_inreg:_(s32) = G_SEXT_INREG %assert_sext, 7
385 ; GCN-NEXT: $vgpr0 = COPY %sext_inreg(s32)
386 %copy:_(s32) = COPY $vgpr0
387 %assert_sext:_(s32) = G_ASSERT_SEXT %copy, 8
388 %sext_inreg:_(s32) = G_SEXT_INREG %assert_sext, 7
389 $vgpr0 = COPY %sext_inreg