1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=fiji -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefix=VI %s
3 # RUN: llc -march=amdgcn -mcpu=gfx900 -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefix=GFX9 %s
4 # RUN: llc -march=amdgcn -mcpu=tahiti -O0 -run-pass=legalizer -global-isel-abort=0 -o - %s | FileCheck -check-prefix=SI %s
5 # RUN: llc -march=amdgcn -mcpu=gfx1010 -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefix=GFX9 %s
8 name: test_addrspacecast_p0_to_p1
11 queuePtr: { reg: '$sgpr4_sgpr5' }
17 ; VI-LABEL: name: test_addrspacecast_p0_to_p1
18 ; VI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
19 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[COPY]](p0)
20 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p1)
21 ; GFX9-LABEL: name: test_addrspacecast_p0_to_p1
22 ; GFX9: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
23 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[COPY]](p0)
24 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p1)
25 ; SI-LABEL: name: test_addrspacecast_p0_to_p1
26 ; SI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
27 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[COPY]](p0)
28 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p1)
29 %0:_(p0) = COPY $vgpr0_vgpr1
30 %1:_(p1) = G_ADDRSPACE_CAST %0
31 $vgpr0_vgpr1 = COPY %1
35 name: test_addrspacecast_p1_to_p0
38 queuePtr: { reg: '$sgpr4_sgpr5' }
44 ; VI-LABEL: name: test_addrspacecast_p1_to_p0
45 ; VI: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
46 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p1)
47 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
48 ; GFX9-LABEL: name: test_addrspacecast_p1_to_p0
49 ; GFX9: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
50 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p1)
51 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
52 ; SI-LABEL: name: test_addrspacecast_p1_to_p0
53 ; SI: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
54 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p1)
55 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
56 %0:_(p1) = COPY $vgpr0_vgpr1
57 %1:_(p0) = G_ADDRSPACE_CAST %0
58 $vgpr0_vgpr1 = COPY %1
62 name: test_addrspacecast_p0_to_p4
65 queuePtr: { reg: '$sgpr4_sgpr5' }
70 ; VI-LABEL: name: test_addrspacecast_p0_to_p4
71 ; VI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
72 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p4) = G_BITCAST [[COPY]](p0)
73 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p4)
74 ; GFX9-LABEL: name: test_addrspacecast_p0_to_p4
75 ; GFX9: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
76 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p4) = G_BITCAST [[COPY]](p0)
77 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p4)
78 ; SI-LABEL: name: test_addrspacecast_p0_to_p4
79 ; SI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
80 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p4) = G_BITCAST [[COPY]](p0)
81 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p4)
82 %0:_(p0) = COPY $vgpr0_vgpr1
83 %1:_(p4) = G_ADDRSPACE_CAST %0
84 $vgpr0_vgpr1 = COPY %1
88 name: test_addrspacecast_p4_to_p0
91 queuePtr: { reg: '$sgpr4_sgpr5' }
96 ; VI-LABEL: name: test_addrspacecast_p4_to_p0
97 ; VI: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
98 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p4)
99 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
100 ; GFX9-LABEL: name: test_addrspacecast_p4_to_p0
101 ; GFX9: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
102 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p4)
103 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
104 ; SI-LABEL: name: test_addrspacecast_p4_to_p0
105 ; SI: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
106 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p4)
107 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
108 %0:_(p4) = COPY $vgpr0_vgpr1
109 %1:_(p0) = G_ADDRSPACE_CAST %0
110 $vgpr0_vgpr1 = COPY %1
114 name: test_addrspacecast_p0_to_p999
117 queuePtr: { reg: '$sgpr4_sgpr5' }
120 liveins: $vgpr0_vgpr1
122 ; VI-LABEL: name: test_addrspacecast_p0_to_p999
123 ; VI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
124 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p999) = G_BITCAST [[COPY]](p0)
125 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p999)
126 ; GFX9-LABEL: name: test_addrspacecast_p0_to_p999
127 ; GFX9: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
128 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p999) = G_BITCAST [[COPY]](p0)
129 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p999)
130 ; SI-LABEL: name: test_addrspacecast_p0_to_p999
131 ; SI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
132 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p999) = G_BITCAST [[COPY]](p0)
133 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p999)
134 %0:_(p0) = COPY $vgpr0_vgpr1
135 %1:_(p999) = G_ADDRSPACE_CAST %0
136 $vgpr0_vgpr1 = COPY %1
140 name: test_addrspacecast_p999_to_p0
143 queuePtr: { reg: '$sgpr4_sgpr5' }
146 liveins: $vgpr0_vgpr1
148 ; VI-LABEL: name: test_addrspacecast_p999_to_p0
149 ; VI: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
150 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p999)
151 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
152 ; GFX9-LABEL: name: test_addrspacecast_p999_to_p0
153 ; GFX9: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
154 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p999)
155 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
156 ; SI-LABEL: name: test_addrspacecast_p999_to_p0
157 ; SI: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
158 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p999)
159 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
160 %0:_(p999) = COPY $vgpr0_vgpr1
161 %1:_(p0) = G_ADDRSPACE_CAST %0
162 $vgpr0_vgpr1 = COPY %1
166 name: test_addrspacecast_p5_to_p0
169 queuePtr: { reg: '$sgpr4_sgpr5' }
174 ; VI-LABEL: name: test_addrspacecast_p5_to_p0
175 ; VI: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
176 ; VI-NEXT: [[COPY1:%[0-9]+]]:_(p5) = COPY $vgpr0
177 ; VI-NEXT: [[COPY2:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
178 ; VI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 68
179 ; VI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY2]], [[C]](s64)
180 ; VI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), addrspace 4)
181 ; VI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p5)
182 ; VI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
183 ; VI-NEXT: [[C1:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
184 ; VI-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
185 ; VI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY1]](p5), [[C1]]
186 ; VI-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
187 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
188 ; GFX9-LABEL: name: test_addrspacecast_p5_to_p0
189 ; GFX9: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
190 ; GFX9-NEXT: [[S_GETREG_B32_:%[0-9]+]]:sreg_32(s32) = S_GETREG_B32 30735
191 ; GFX9-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
192 ; GFX9-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[S_GETREG_B32_]], [[C]](s32)
193 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p5)
194 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[SHL]](s32)
195 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
196 ; GFX9-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
197 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p5), [[C1]]
198 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
199 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
200 ; SI-LABEL: name: test_addrspacecast_p5_to_p0
201 ; SI: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
202 ; SI-NEXT: [[ADDRSPACE_CAST:%[0-9]+]]:_(p0) = G_ADDRSPACE_CAST [[COPY]](p5)
203 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[ADDRSPACE_CAST]](p0)
204 %0:_(p5) = COPY $vgpr0
205 %1:_(p0) = G_ADDRSPACE_CAST %0
206 $vgpr0_vgpr1 = COPY %1
210 name: test_addrspacecast_p0_to_p5
213 queuePtr: { reg: '$sgpr4_sgpr5' }
216 liveins: $vgpr0_vgpr1
218 ; VI-LABEL: name: test_addrspacecast_p0_to_p5
219 ; VI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
220 ; VI-NEXT: [[C:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
221 ; VI-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
222 ; VI-NEXT: [[EXTRACT:%[0-9]+]]:_(p5) = G_EXTRACT [[COPY]](p0), 0
223 ; VI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
224 ; VI-NEXT: [[SELECT:%[0-9]+]]:_(p5) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
225 ; VI-NEXT: $vgpr0 = COPY [[SELECT]](p5)
226 ; GFX9-LABEL: name: test_addrspacecast_p0_to_p5
227 ; GFX9: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
228 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
229 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
230 ; GFX9-NEXT: [[EXTRACT:%[0-9]+]]:_(p5) = G_EXTRACT [[COPY]](p0), 0
231 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
232 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p5) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
233 ; GFX9-NEXT: $vgpr0 = COPY [[SELECT]](p5)
234 ; SI-LABEL: name: test_addrspacecast_p0_to_p5
235 ; SI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
236 ; SI-NEXT: [[C:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
237 ; SI-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
238 ; SI-NEXT: [[EXTRACT:%[0-9]+]]:_(p5) = G_EXTRACT [[COPY]](p0), 0
239 ; SI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
240 ; SI-NEXT: [[SELECT:%[0-9]+]]:_(p5) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
241 ; SI-NEXT: $vgpr0 = COPY [[SELECT]](p5)
242 %0:_(p0) = COPY $vgpr0_vgpr1
243 %1:_(p5) = G_ADDRSPACE_CAST %0
248 name: test_addrspacecast_p3_to_p0
251 queuePtr: { reg: '$sgpr4_sgpr5' }
257 ; VI-LABEL: name: test_addrspacecast_p3_to_p0
258 ; VI: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
259 ; VI-NEXT: [[COPY1:%[0-9]+]]:_(p3) = COPY $vgpr0
260 ; VI-NEXT: [[COPY2:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
261 ; VI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
262 ; VI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY2]], [[C]](s64)
263 ; VI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), align 64, addrspace 4)
264 ; VI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p3)
265 ; VI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
266 ; VI-NEXT: [[C1:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
267 ; VI-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
268 ; VI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY1]](p3), [[C1]]
269 ; VI-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
270 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
271 ; GFX9-LABEL: name: test_addrspacecast_p3_to_p0
272 ; GFX9: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
273 ; GFX9-NEXT: [[S_GETREG_B32_:%[0-9]+]]:sreg_32(s32) = S_GETREG_B32 31759
274 ; GFX9-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
275 ; GFX9-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[S_GETREG_B32_]], [[C]](s32)
276 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
277 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[SHL]](s32)
278 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
279 ; GFX9-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
280 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p3), [[C1]]
281 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
282 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
283 ; SI-LABEL: name: test_addrspacecast_p3_to_p0
284 ; SI: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
285 ; SI-NEXT: [[ADDRSPACE_CAST:%[0-9]+]]:_(p0) = G_ADDRSPACE_CAST [[COPY]](p3)
286 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[ADDRSPACE_CAST]](p0)
287 %0:_(p3) = COPY $vgpr0
288 %1:_(p0) = G_ADDRSPACE_CAST %0
289 $vgpr0_vgpr1 = COPY %1
293 name: test_addrspacecast_p0_to_p3
296 queuePtr: { reg: '$sgpr4_sgpr5' }
299 liveins: $vgpr0_vgpr1
301 ; VI-LABEL: name: test_addrspacecast_p0_to_p3
302 ; VI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
303 ; VI-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
304 ; VI-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
305 ; VI-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[COPY]](p0), 0
306 ; VI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
307 ; VI-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
308 ; VI-NEXT: $vgpr0 = COPY [[SELECT]](p3)
309 ; GFX9-LABEL: name: test_addrspacecast_p0_to_p3
310 ; GFX9: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
311 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
312 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
313 ; GFX9-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[COPY]](p0), 0
314 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
315 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
316 ; GFX9-NEXT: $vgpr0 = COPY [[SELECT]](p3)
317 ; SI-LABEL: name: test_addrspacecast_p0_to_p3
318 ; SI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
319 ; SI-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
320 ; SI-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
321 ; SI-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[COPY]](p0), 0
322 ; SI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
323 ; SI-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
324 ; SI-NEXT: $vgpr0 = COPY [[SELECT]](p3)
325 %0:_(p0) = COPY $vgpr0_vgpr1
326 %1:_(p3) = G_ADDRSPACE_CAST %0
331 name: test_addrspacecast_v2p0_to_v2p1
334 queuePtr: { reg: '$sgpr4_sgpr5' }
337 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
339 ; VI-LABEL: name: test_addrspacecast_v2p0_to_v2p1
340 ; VI: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
341 ; VI-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
342 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[UV]](p0)
343 ; VI-NEXT: [[BITCAST1:%[0-9]+]]:_(p1) = G_BITCAST [[UV1]](p0)
344 ; VI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p1>) = G_BUILD_VECTOR [[BITCAST]](p1), [[BITCAST1]](p1)
345 ; VI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p1>)
346 ; GFX9-LABEL: name: test_addrspacecast_v2p0_to_v2p1
347 ; GFX9: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
348 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
349 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[UV]](p0)
350 ; GFX9-NEXT: [[BITCAST1:%[0-9]+]]:_(p1) = G_BITCAST [[UV1]](p0)
351 ; GFX9-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p1>) = G_BUILD_VECTOR [[BITCAST]](p1), [[BITCAST1]](p1)
352 ; GFX9-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p1>)
353 ; SI-LABEL: name: test_addrspacecast_v2p0_to_v2p1
354 ; SI: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
355 ; SI-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
356 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[UV]](p0)
357 ; SI-NEXT: [[BITCAST1:%[0-9]+]]:_(p1) = G_BITCAST [[UV1]](p0)
358 ; SI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p1>) = G_BUILD_VECTOR [[BITCAST]](p1), [[BITCAST1]](p1)
359 ; SI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p1>)
360 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
361 %1:_(<2 x p1>) = G_ADDRSPACE_CAST %0
362 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
366 name: test_addrspacecast_v2p1_to_v2p0
369 queuePtr: { reg: '$sgpr4_sgpr5' }
372 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
374 ; VI-LABEL: name: test_addrspacecast_v2p1_to_v2p0
375 ; VI: [[COPY:%[0-9]+]]:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
376 ; VI-NEXT: [[UV:%[0-9]+]]:_(p1), [[UV1:%[0-9]+]]:_(p1) = G_UNMERGE_VALUES [[COPY]](<2 x p1>)
377 ; VI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[UV]](p1)
378 ; VI-NEXT: [[BITCAST1:%[0-9]+]]:_(p0) = G_BITCAST [[UV1]](p1)
379 ; VI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[BITCAST]](p0), [[BITCAST1]](p0)
380 ; VI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
381 ; GFX9-LABEL: name: test_addrspacecast_v2p1_to_v2p0
382 ; GFX9: [[COPY:%[0-9]+]]:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
383 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(p1), [[UV1:%[0-9]+]]:_(p1) = G_UNMERGE_VALUES [[COPY]](<2 x p1>)
384 ; GFX9-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[UV]](p1)
385 ; GFX9-NEXT: [[BITCAST1:%[0-9]+]]:_(p0) = G_BITCAST [[UV1]](p1)
386 ; GFX9-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[BITCAST]](p0), [[BITCAST1]](p0)
387 ; GFX9-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
388 ; SI-LABEL: name: test_addrspacecast_v2p1_to_v2p0
389 ; SI: [[COPY:%[0-9]+]]:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
390 ; SI-NEXT: [[UV:%[0-9]+]]:_(p1), [[UV1:%[0-9]+]]:_(p1) = G_UNMERGE_VALUES [[COPY]](<2 x p1>)
391 ; SI-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[UV]](p1)
392 ; SI-NEXT: [[BITCAST1:%[0-9]+]]:_(p0) = G_BITCAST [[UV1]](p1)
393 ; SI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[BITCAST]](p0), [[BITCAST1]](p0)
394 ; SI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
395 %0:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
396 %1:_(<2 x p0>) = G_ADDRSPACE_CAST %0
397 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
401 name: test_addrspacecast_v2p0_to_v2p3
404 queuePtr: { reg: '$sgpr4_sgpr5' }
407 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
409 ; VI-LABEL: name: test_addrspacecast_v2p0_to_v2p3
410 ; VI: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
411 ; VI-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
412 ; VI-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
413 ; VI-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
414 ; VI-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[UV]](p0), 0
415 ; VI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p0), [[C1]]
416 ; VI-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
417 ; VI-NEXT: [[EXTRACT1:%[0-9]+]]:_(p3) = G_EXTRACT [[UV1]](p0), 0
418 ; VI-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p0), [[C1]]
419 ; VI-NEXT: [[SELECT1:%[0-9]+]]:_(p3) = G_SELECT [[ICMP1]](s1), [[EXTRACT1]], [[C]]
420 ; VI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p3>) = G_BUILD_VECTOR [[SELECT]](p3), [[SELECT1]](p3)
421 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x p3>)
422 ; GFX9-LABEL: name: test_addrspacecast_v2p0_to_v2p3
423 ; GFX9: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
424 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
425 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
426 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
427 ; GFX9-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[UV]](p0), 0
428 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p0), [[C1]]
429 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
430 ; GFX9-NEXT: [[EXTRACT1:%[0-9]+]]:_(p3) = G_EXTRACT [[UV1]](p0), 0
431 ; GFX9-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p0), [[C1]]
432 ; GFX9-NEXT: [[SELECT1:%[0-9]+]]:_(p3) = G_SELECT [[ICMP1]](s1), [[EXTRACT1]], [[C]]
433 ; GFX9-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p3>) = G_BUILD_VECTOR [[SELECT]](p3), [[SELECT1]](p3)
434 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x p3>)
435 ; SI-LABEL: name: test_addrspacecast_v2p0_to_v2p3
436 ; SI: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
437 ; SI-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
438 ; SI-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
439 ; SI-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
440 ; SI-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[UV]](p0), 0
441 ; SI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p0), [[C1]]
442 ; SI-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
443 ; SI-NEXT: [[EXTRACT1:%[0-9]+]]:_(p3) = G_EXTRACT [[UV1]](p0), 0
444 ; SI-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p0), [[C1]]
445 ; SI-NEXT: [[SELECT1:%[0-9]+]]:_(p3) = G_SELECT [[ICMP1]](s1), [[EXTRACT1]], [[C]]
446 ; SI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p3>) = G_BUILD_VECTOR [[SELECT]](p3), [[SELECT1]](p3)
447 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x p3>)
448 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
449 %1:_(<2 x p3>) = G_ADDRSPACE_CAST %0
450 $vgpr0_vgpr1 = COPY %1
454 name: test_addrspacecast_v2p3_to_v2p0
457 queuePtr: { reg: '$sgpr4_sgpr5' }
460 liveins: $vgpr0_vgpr1
462 ; VI-LABEL: name: test_addrspacecast_v2p3_to_v2p0
463 ; VI: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
464 ; VI-NEXT: [[COPY1:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
465 ; VI-NEXT: [[UV:%[0-9]+]]:_(p3), [[UV1:%[0-9]+]]:_(p3) = G_UNMERGE_VALUES [[COPY1]](<2 x p3>)
466 ; VI-NEXT: [[COPY2:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
467 ; VI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
468 ; VI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY2]], [[C]](s64)
469 ; VI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), align 64, addrspace 4)
470 ; VI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV]](p3)
471 ; VI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
472 ; VI-NEXT: [[C1:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
473 ; VI-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
474 ; VI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p3), [[C1]]
475 ; VI-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
476 ; VI-NEXT: [[COPY3:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
477 ; VI-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY3]], [[C]](s64)
478 ; VI-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD1]](p4) :: (dereferenceable invariant load (s32), align 64, addrspace 4)
479 ; VI-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV1]](p3)
480 ; VI-NEXT: [[MV1:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT1]](s32), [[LOAD1]](s32)
481 ; VI-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p3), [[C1]]
482 ; VI-NEXT: [[SELECT1:%[0-9]+]]:_(p0) = G_SELECT [[ICMP1]](s1), [[MV1]], [[C2]]
483 ; VI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[SELECT]](p0), [[SELECT1]](p0)
484 ; VI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
485 ; GFX9-LABEL: name: test_addrspacecast_v2p3_to_v2p0
486 ; GFX9: [[COPY:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
487 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(p3), [[UV1:%[0-9]+]]:_(p3) = G_UNMERGE_VALUES [[COPY]](<2 x p3>)
488 ; GFX9-NEXT: [[S_GETREG_B32_:%[0-9]+]]:sreg_32(s32) = S_GETREG_B32 31759
489 ; GFX9-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
490 ; GFX9-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[S_GETREG_B32_]], [[C]](s32)
491 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV]](p3)
492 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[SHL]](s32)
493 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
494 ; GFX9-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
495 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p3), [[C1]]
496 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
497 ; GFX9-NEXT: [[S_GETREG_B32_1:%[0-9]+]]:sreg_32(s32) = S_GETREG_B32 31759
498 ; GFX9-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[S_GETREG_B32_1]], [[C]](s32)
499 ; GFX9-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV1]](p3)
500 ; GFX9-NEXT: [[MV1:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT1]](s32), [[SHL1]](s32)
501 ; GFX9-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p3), [[C1]]
502 ; GFX9-NEXT: [[SELECT1:%[0-9]+]]:_(p0) = G_SELECT [[ICMP1]](s1), [[MV1]], [[C2]]
503 ; GFX9-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[SELECT]](p0), [[SELECT1]](p0)
504 ; GFX9-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
505 ; SI-LABEL: name: test_addrspacecast_v2p3_to_v2p0
506 ; SI: [[COPY:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
507 ; SI-NEXT: [[UV:%[0-9]+]]:_(p3), [[UV1:%[0-9]+]]:_(p3) = G_UNMERGE_VALUES [[COPY]](<2 x p3>)
508 ; SI-NEXT: [[ADDRSPACE_CAST:%[0-9]+]]:_(p0) = G_ADDRSPACE_CAST [[UV]](p3)
509 ; SI-NEXT: [[ADDRSPACE_CAST1:%[0-9]+]]:_(p0) = G_ADDRSPACE_CAST [[UV1]](p3)
510 ; SI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[ADDRSPACE_CAST]](p0), [[ADDRSPACE_CAST1]](p0)
511 ; SI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
512 %0:_(<2 x p3>) = COPY $vgpr0_vgpr1
513 %1:_(<2 x p0>) = G_ADDRSPACE_CAST %0
514 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
518 name: test_addrspacecast_p4_to_p6
521 liveins: $vgpr0_vgpr1
523 ; VI-LABEL: name: test_addrspacecast_p4_to_p6
524 ; VI: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
525 ; VI-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p4), 0
526 ; VI-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
527 ; GFX9-LABEL: name: test_addrspacecast_p4_to_p6
528 ; GFX9: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
529 ; GFX9-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p4), 0
530 ; GFX9-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
531 ; SI-LABEL: name: test_addrspacecast_p4_to_p6
532 ; SI: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
533 ; SI-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p4), 0
534 ; SI-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
535 %0:_(p4) = COPY $vgpr0_vgpr1
536 %1:_(p6) = G_ADDRSPACE_CAST %0
541 name: test_addrspacecast_p6_to_p4_0
546 ; VI-LABEL: name: test_addrspacecast_p6_to_p4_0
547 ; VI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
548 ; VI-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
549 ; VI-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
550 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
551 ; GFX9-LABEL: name: test_addrspacecast_p6_to_p4_0
552 ; GFX9: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
553 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
554 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
555 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
556 ; SI-LABEL: name: test_addrspacecast_p6_to_p4_0
557 ; SI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
558 ; SI-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
559 ; SI-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
560 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
561 %0:_(p6) = COPY $vgpr0
562 %1:_(p4) = G_ADDRSPACE_CAST %0
563 $vgpr0_vgpr1 = COPY %1
567 name: test_addrspacecast_p6_to_p4_0xdeadbeef
569 highBitsOf32BitAddress: 0xdeadbeef
574 ; VI-LABEL: name: test_addrspacecast_p6_to_p4_0xdeadbeef
575 ; VI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
576 ; VI-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 -559038737
577 ; VI-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
578 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
579 ; GFX9-LABEL: name: test_addrspacecast_p6_to_p4_0xdeadbeef
580 ; GFX9: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
581 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 -559038737
582 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
583 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
584 ; SI-LABEL: name: test_addrspacecast_p6_to_p4_0xdeadbeef
585 ; SI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
586 ; SI-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 -559038737
587 ; SI-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
588 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
589 %0:_(p6) = COPY $vgpr0
590 %1:_(p4) = G_ADDRSPACE_CAST %0
591 $vgpr0_vgpr1 = COPY %1
595 name: test_addrspacecast_p0_to_p6
598 liveins: $vgpr0_vgpr1
600 ; VI-LABEL: name: test_addrspacecast_p0_to_p6
601 ; VI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
602 ; VI-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p0), 0
603 ; VI-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
604 ; GFX9-LABEL: name: test_addrspacecast_p0_to_p6
605 ; GFX9: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
606 ; GFX9-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p0), 0
607 ; GFX9-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
608 ; SI-LABEL: name: test_addrspacecast_p0_to_p6
609 ; SI: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
610 ; SI-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p0), 0
611 ; SI-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
612 %0:_(p0) = COPY $vgpr0_vgpr1
613 %1:_(p6) = G_ADDRSPACE_CAST %0
618 name: test_addrspacecast_p6_to_p0
623 ; VI-LABEL: name: test_addrspacecast_p6_to_p0
624 ; VI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
625 ; VI-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
626 ; VI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
627 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p0)
628 ; GFX9-LABEL: name: test_addrspacecast_p6_to_p0
629 ; GFX9: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
630 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
631 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
632 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p0)
633 ; SI-LABEL: name: test_addrspacecast_p6_to_p0
634 ; SI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
635 ; SI-NEXT: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
636 ; SI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
637 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p0)
638 %0:_(p6) = COPY $vgpr0
639 %1:_(p0) = G_ADDRSPACE_CAST %0
640 $vgpr0_vgpr1 = COPY %1
643 name: test_addrspacecast_p5_fi_to_p0
646 queuePtr: { reg: '$sgpr4_sgpr5' }
648 - { id: 0, size: 4, alignment: 4 }
651 ; VI-LABEL: name: test_addrspacecast_p5_fi_to_p0
652 ; VI: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
653 ; VI-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p5) = G_FRAME_INDEX %stack.0
654 ; VI-NEXT: [[COPY1:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
655 ; VI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 68
656 ; VI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY1]], [[C]](s64)
657 ; VI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), addrspace 4)
658 ; VI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[FRAME_INDEX]](p5)
659 ; VI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
660 ; VI-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY [[MV]](p0)
661 ; VI-NEXT: $vgpr0_vgpr1 = COPY [[COPY2]](p0)
662 ; GFX9-LABEL: name: test_addrspacecast_p5_fi_to_p0
663 ; GFX9: [[FRAME_INDEX:%[0-9]+]]:_(p5) = G_FRAME_INDEX %stack.0
664 ; GFX9-NEXT: [[S_GETREG_B32_:%[0-9]+]]:sreg_32(s32) = S_GETREG_B32 30735
665 ; GFX9-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
666 ; GFX9-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[S_GETREG_B32_]], [[C]](s32)
667 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[FRAME_INDEX]](p5)
668 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[SHL]](s32)
669 ; GFX9-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY [[MV]](p0)
670 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[COPY]](p0)
671 ; SI-LABEL: name: test_addrspacecast_p5_fi_to_p0
672 ; SI: [[FRAME_INDEX:%[0-9]+]]:_(p5) = G_FRAME_INDEX %stack.0
673 ; SI-NEXT: [[ADDRSPACE_CAST:%[0-9]+]]:_(p0) = G_ADDRSPACE_CAST [[FRAME_INDEX]](p5)
674 ; SI-NEXT: $vgpr0_vgpr1 = COPY [[ADDRSPACE_CAST]](p0)
675 %0:_(p5) = G_FRAME_INDEX %stack.0
676 %1:_(p0) = G_ADDRSPACE_CAST %0
677 $vgpr0_vgpr1 = COPY %1