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-prefixes=GCN,SIVI %s
3 # RUN: llc -march=amdgcn -mcpu=tahiti -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefixes=GCN,SIVI %s
4 # RUN: llc -march=amdgcn -mcpu=gfx900 -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefixes=GCN,GFX9 %s
5 # RUN: llc -march=amdgcn -mcpu=gfx1010 -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefixes=GCN,GFX9 %s
6 # RUN: llc -march=amdgcn -mcpu=gfx1100 -O0 -run-pass=legalizer -o - %s | FileCheck -check-prefixes=GCN,GFX9 %s
9 name: test_addrspacecast_p0_to_p1
12 queuePtr: { reg: '$sgpr4_sgpr5' }
18 ; GCN-LABEL: name: test_addrspacecast_p0_to_p1
19 ; GCN: liveins: $vgpr0_vgpr1
21 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
22 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[COPY]](p0)
23 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p1)
24 %0:_(p0) = COPY $vgpr0_vgpr1
25 %1:_(p1) = G_ADDRSPACE_CAST %0
26 $vgpr0_vgpr1 = COPY %1
30 name: test_addrspacecast_p1_to_p0
33 queuePtr: { reg: '$sgpr4_sgpr5' }
39 ; GCN-LABEL: name: test_addrspacecast_p1_to_p0
40 ; GCN: liveins: $vgpr0_vgpr1
42 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
43 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p1)
44 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
45 %0:_(p1) = COPY $vgpr0_vgpr1
46 %1:_(p0) = G_ADDRSPACE_CAST %0
47 $vgpr0_vgpr1 = COPY %1
51 name: test_addrspacecast_p0_to_p4
54 queuePtr: { reg: '$sgpr4_sgpr5' }
59 ; GCN-LABEL: name: test_addrspacecast_p0_to_p4
60 ; GCN: liveins: $vgpr0_vgpr1
62 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
63 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p4) = G_BITCAST [[COPY]](p0)
64 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p4)
65 %0:_(p0) = COPY $vgpr0_vgpr1
66 %1:_(p4) = G_ADDRSPACE_CAST %0
67 $vgpr0_vgpr1 = COPY %1
71 name: test_addrspacecast_p4_to_p0
74 queuePtr: { reg: '$sgpr4_sgpr5' }
79 ; GCN-LABEL: name: test_addrspacecast_p4_to_p0
80 ; GCN: liveins: $vgpr0_vgpr1
82 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
83 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p4)
84 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
85 %0:_(p4) = COPY $vgpr0_vgpr1
86 %1:_(p0) = G_ADDRSPACE_CAST %0
87 $vgpr0_vgpr1 = COPY %1
91 name: test_addrspacecast_p0_to_p999
94 queuePtr: { reg: '$sgpr4_sgpr5' }
99 ; GCN-LABEL: name: test_addrspacecast_p0_to_p999
100 ; GCN: liveins: $vgpr0_vgpr1
102 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
103 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p999) = G_BITCAST [[COPY]](p0)
104 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p999)
105 %0:_(p0) = COPY $vgpr0_vgpr1
106 %1:_(p999) = G_ADDRSPACE_CAST %0
107 $vgpr0_vgpr1 = COPY %1
111 name: test_addrspacecast_p999_to_p0
114 queuePtr: { reg: '$sgpr4_sgpr5' }
117 liveins: $vgpr0_vgpr1
119 ; GCN-LABEL: name: test_addrspacecast_p999_to_p0
120 ; GCN: liveins: $vgpr0_vgpr1
122 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
123 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[COPY]](p999)
124 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BITCAST]](p0)
125 %0:_(p999) = COPY $vgpr0_vgpr1
126 %1:_(p0) = G_ADDRSPACE_CAST %0
127 $vgpr0_vgpr1 = COPY %1
131 name: test_addrspacecast_p5_to_p0
134 queuePtr: { reg: '$sgpr4_sgpr5' }
139 ; SIVI-LABEL: name: test_addrspacecast_p5_to_p0
140 ; SIVI: liveins: $vgpr0, $sgpr4_sgpr5
142 ; SIVI-NEXT: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
143 ; SIVI-NEXT: [[COPY1:%[0-9]+]]:_(p5) = COPY $vgpr0
144 ; SIVI-NEXT: [[COPY2:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
145 ; SIVI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 68
146 ; SIVI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY2]], [[C]](s64)
147 ; SIVI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), addrspace 4)
148 ; SIVI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p5)
149 ; SIVI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
150 ; SIVI-NEXT: [[C1:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
151 ; SIVI-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
152 ; SIVI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY1]](p5), [[C1]]
153 ; SIVI-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
154 ; SIVI-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
155 ; GFX9-LABEL: name: test_addrspacecast_p5_to_p0
156 ; GFX9: liveins: $vgpr0
158 ; GFX9-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
159 ; GFX9-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64(s64) = S_MOV_B64 $src_private_base
160 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[S_MOV_B64_]](s64)
161 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p5)
162 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[UV1]](s32)
163 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
164 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
165 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p5), [[C]]
166 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C1]]
167 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
168 %0:_(p5) = COPY $vgpr0
169 %1:_(p0) = G_ADDRSPACE_CAST %0
170 $vgpr0_vgpr1 = COPY %1
174 name: test_addrspacecast_p0_to_p5
177 queuePtr: { reg: '$sgpr4_sgpr5' }
180 liveins: $vgpr0_vgpr1
182 ; GCN-LABEL: name: test_addrspacecast_p0_to_p5
183 ; GCN: liveins: $vgpr0_vgpr1
185 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
186 ; GCN-NEXT: [[C:%[0-9]+]]:_(p5) = G_CONSTANT i32 -1
187 ; GCN-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
188 ; GCN-NEXT: [[EXTRACT:%[0-9]+]]:_(p5) = G_EXTRACT [[COPY]](p0), 0
189 ; GCN-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
190 ; GCN-NEXT: [[SELECT:%[0-9]+]]:_(p5) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
191 ; GCN-NEXT: $vgpr0 = COPY [[SELECT]](p5)
192 %0:_(p0) = COPY $vgpr0_vgpr1
193 %1:_(p5) = G_ADDRSPACE_CAST %0
198 name: test_addrspacecast_p3_to_p0
201 queuePtr: { reg: '$sgpr4_sgpr5' }
207 ; SIVI-LABEL: name: test_addrspacecast_p3_to_p0
208 ; SIVI: liveins: $vgpr0, $sgpr4_sgpr5
210 ; SIVI-NEXT: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
211 ; SIVI-NEXT: [[COPY1:%[0-9]+]]:_(p3) = COPY $vgpr0
212 ; SIVI-NEXT: [[COPY2:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
213 ; SIVI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
214 ; SIVI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY2]], [[C]](s64)
215 ; SIVI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), align 64, addrspace 4)
216 ; SIVI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY1]](p3)
217 ; SIVI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
218 ; SIVI-NEXT: [[C1:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
219 ; SIVI-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
220 ; SIVI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY1]](p3), [[C1]]
221 ; SIVI-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
222 ; SIVI-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
223 ; GFX9-LABEL: name: test_addrspacecast_p3_to_p0
224 ; GFX9: liveins: $vgpr0
226 ; GFX9-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
227 ; GFX9-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64(s64) = S_MOV_B64 $src_shared_base
228 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[S_MOV_B64_]](s64)
229 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
230 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[UV1]](s32)
231 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
232 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
233 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p3), [[C]]
234 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C1]]
235 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[SELECT]](p0)
236 %0:_(p3) = COPY $vgpr0
237 %1:_(p0) = G_ADDRSPACE_CAST %0
238 $vgpr0_vgpr1 = COPY %1
242 name: test_addrspacecast_p0_to_p3
245 queuePtr: { reg: '$sgpr4_sgpr5' }
248 liveins: $vgpr0_vgpr1
250 ; GCN-LABEL: name: test_addrspacecast_p0_to_p3
251 ; GCN: liveins: $vgpr0_vgpr1
253 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
254 ; GCN-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
255 ; GCN-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
256 ; GCN-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[COPY]](p0), 0
257 ; GCN-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](p0), [[C1]]
258 ; GCN-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
259 ; GCN-NEXT: $vgpr0 = COPY [[SELECT]](p3)
260 %0:_(p0) = COPY $vgpr0_vgpr1
261 %1:_(p3) = G_ADDRSPACE_CAST %0
266 name: test_addrspacecast_v2p0_to_v2p1
269 queuePtr: { reg: '$sgpr4_sgpr5' }
272 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
274 ; GCN-LABEL: name: test_addrspacecast_v2p0_to_v2p1
275 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
277 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
278 ; GCN-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
279 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p1) = G_BITCAST [[UV]](p0)
280 ; GCN-NEXT: [[BITCAST1:%[0-9]+]]:_(p1) = G_BITCAST [[UV1]](p0)
281 ; GCN-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p1>) = G_BUILD_VECTOR [[BITCAST]](p1), [[BITCAST1]](p1)
282 ; GCN-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p1>)
283 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
284 %1:_(<2 x p1>) = G_ADDRSPACE_CAST %0
285 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
289 name: test_addrspacecast_v2p1_to_v2p0
292 queuePtr: { reg: '$sgpr4_sgpr5' }
295 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
297 ; GCN-LABEL: name: test_addrspacecast_v2p1_to_v2p0
298 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
300 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
301 ; GCN-NEXT: [[UV:%[0-9]+]]:_(p1), [[UV1:%[0-9]+]]:_(p1) = G_UNMERGE_VALUES [[COPY]](<2 x p1>)
302 ; GCN-NEXT: [[BITCAST:%[0-9]+]]:_(p0) = G_BITCAST [[UV]](p1)
303 ; GCN-NEXT: [[BITCAST1:%[0-9]+]]:_(p0) = G_BITCAST [[UV1]](p1)
304 ; GCN-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[BITCAST]](p0), [[BITCAST1]](p0)
305 ; GCN-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
306 %0:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
307 %1:_(<2 x p0>) = G_ADDRSPACE_CAST %0
308 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
312 name: test_addrspacecast_v2p0_to_v2p3
315 queuePtr: { reg: '$sgpr4_sgpr5' }
318 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
320 ; GCN-LABEL: name: test_addrspacecast_v2p0_to_v2p3
321 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
323 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
324 ; GCN-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
325 ; GCN-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
326 ; GCN-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
327 ; GCN-NEXT: [[EXTRACT:%[0-9]+]]:_(p3) = G_EXTRACT [[UV]](p0), 0
328 ; GCN-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p0), [[C1]]
329 ; GCN-NEXT: [[SELECT:%[0-9]+]]:_(p3) = G_SELECT [[ICMP]](s1), [[EXTRACT]], [[C]]
330 ; GCN-NEXT: [[EXTRACT1:%[0-9]+]]:_(p3) = G_EXTRACT [[UV1]](p0), 0
331 ; GCN-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p0), [[C1]]
332 ; GCN-NEXT: [[SELECT1:%[0-9]+]]:_(p3) = G_SELECT [[ICMP1]](s1), [[EXTRACT1]], [[C]]
333 ; GCN-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p3>) = G_BUILD_VECTOR [[SELECT]](p3), [[SELECT1]](p3)
334 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x p3>)
335 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
336 %1:_(<2 x p3>) = G_ADDRSPACE_CAST %0
337 $vgpr0_vgpr1 = COPY %1
341 name: test_addrspacecast_v2p3_to_v2p0
344 queuePtr: { reg: '$sgpr4_sgpr5' }
347 liveins: $vgpr0_vgpr1
349 ; SIVI-LABEL: name: test_addrspacecast_v2p3_to_v2p0
350 ; SIVI: liveins: $vgpr0_vgpr1, $sgpr4_sgpr5
352 ; SIVI-NEXT: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
353 ; SIVI-NEXT: [[COPY1:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
354 ; SIVI-NEXT: [[UV:%[0-9]+]]:_(p3), [[UV1:%[0-9]+]]:_(p3) = G_UNMERGE_VALUES [[COPY1]](<2 x p3>)
355 ; SIVI-NEXT: [[COPY2:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
356 ; SIVI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
357 ; SIVI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY2]], [[C]](s64)
358 ; SIVI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), align 64, addrspace 4)
359 ; SIVI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV]](p3)
360 ; SIVI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
361 ; SIVI-NEXT: [[C1:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
362 ; SIVI-NEXT: [[C2:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
363 ; SIVI-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p3), [[C1]]
364 ; SIVI-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C2]]
365 ; SIVI-NEXT: [[COPY3:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
366 ; SIVI-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY3]], [[C]](s64)
367 ; SIVI-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD1]](p4) :: (dereferenceable invariant load (s32), align 64, addrspace 4)
368 ; SIVI-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV1]](p3)
369 ; SIVI-NEXT: [[MV1:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT1]](s32), [[LOAD1]](s32)
370 ; SIVI-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p3), [[C1]]
371 ; SIVI-NEXT: [[SELECT1:%[0-9]+]]:_(p0) = G_SELECT [[ICMP1]](s1), [[MV1]], [[C2]]
372 ; SIVI-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[SELECT]](p0), [[SELECT1]](p0)
373 ; SIVI-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
374 ; GFX9-LABEL: name: test_addrspacecast_v2p3_to_v2p0
375 ; GFX9: liveins: $vgpr0_vgpr1
377 ; GFX9-NEXT: [[COPY:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
378 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(p3), [[UV1:%[0-9]+]]:_(p3) = G_UNMERGE_VALUES [[COPY]](<2 x p3>)
379 ; GFX9-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64(s64) = S_MOV_B64 $src_shared_base
380 ; GFX9-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[S_MOV_B64_]](s64)
381 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV]](p3)
382 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[UV3]](s32)
383 ; GFX9-NEXT: [[C:%[0-9]+]]:_(p3) = G_CONSTANT i32 -1
384 ; GFX9-NEXT: [[C1:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
385 ; GFX9-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV]](p3), [[C]]
386 ; GFX9-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[MV]], [[C1]]
387 ; GFX9-NEXT: [[S_MOV_B64_1:%[0-9]+]]:sreg_64(s64) = S_MOV_B64 $src_shared_base
388 ; GFX9-NEXT: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[S_MOV_B64_1]](s64)
389 ; GFX9-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s32) = G_PTRTOINT [[UV1]](p3)
390 ; GFX9-NEXT: [[MV1:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT1]](s32), [[UV5]](s32)
391 ; GFX9-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[UV1]](p3), [[C]]
392 ; GFX9-NEXT: [[SELECT1:%[0-9]+]]:_(p0) = G_SELECT [[ICMP1]](s1), [[MV1]], [[C1]]
393 ; GFX9-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[SELECT]](p0), [[SELECT1]](p0)
394 ; GFX9-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p0>)
395 %0:_(<2 x p3>) = COPY $vgpr0_vgpr1
396 %1:_(<2 x p0>) = G_ADDRSPACE_CAST %0
397 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
401 name: test_addrspacecast_p4_to_p6
404 liveins: $vgpr0_vgpr1
406 ; GCN-LABEL: name: test_addrspacecast_p4_to_p6
407 ; GCN: liveins: $vgpr0_vgpr1
409 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
410 ; GCN-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p4), 0
411 ; GCN-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
412 %0:_(p4) = COPY $vgpr0_vgpr1
413 %1:_(p6) = G_ADDRSPACE_CAST %0
418 name: test_addrspacecast_p6_to_p4_0
423 ; GCN-LABEL: name: test_addrspacecast_p6_to_p4_0
424 ; GCN: liveins: $vgpr0
426 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
427 ; GCN-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p6)
428 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
429 ; GCN-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[PTRTOINT]](s32), [[C]](s32)
430 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
431 %0:_(p6) = COPY $vgpr0
432 %1:_(p4) = G_ADDRSPACE_CAST %0
433 $vgpr0_vgpr1 = COPY %1
437 name: test_addrspacecast_p6_to_p4_0xdeadbeef
439 highBitsOf32BitAddress: 0xdeadbeef
444 ; GCN-LABEL: name: test_addrspacecast_p6_to_p4_0xdeadbeef
445 ; GCN: liveins: $vgpr0
447 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
448 ; GCN-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p6)
449 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -559038737
450 ; GCN-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[PTRTOINT]](s32), [[C]](s32)
451 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p4)
452 %0:_(p6) = COPY $vgpr0
453 %1:_(p4) = G_ADDRSPACE_CAST %0
454 $vgpr0_vgpr1 = COPY %1
458 name: test_addrspacecast_p0_to_p6
461 liveins: $vgpr0_vgpr1
463 ; GCN-LABEL: name: test_addrspacecast_p0_to_p6
464 ; GCN: liveins: $vgpr0_vgpr1
466 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
467 ; GCN-NEXT: [[EXTRACT:%[0-9]+]]:_(p6) = G_EXTRACT [[COPY]](p0), 0
468 ; GCN-NEXT: $vgpr0 = COPY [[EXTRACT]](p6)
469 %0:_(p0) = COPY $vgpr0_vgpr1
470 %1:_(p6) = G_ADDRSPACE_CAST %0
475 name: test_addrspacecast_p6_to_p0
480 ; GCN-LABEL: name: test_addrspacecast_p6_to_p0
481 ; GCN: liveins: $vgpr0
483 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
484 ; GCN-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p6)
485 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
486 ; GCN-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[C]](s32)
487 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[MV]](p0)
488 %0:_(p6) = COPY $vgpr0
489 %1:_(p0) = G_ADDRSPACE_CAST %0
490 $vgpr0_vgpr1 = COPY %1
493 name: test_addrspacecast_p5_fi_to_p0
496 queuePtr: { reg: '$sgpr4_sgpr5' }
498 - { id: 0, size: 4, alignment: 4 }
501 ; SIVI-LABEL: name: test_addrspacecast_p5_fi_to_p0
502 ; SIVI: liveins: $sgpr4_sgpr5
504 ; SIVI-NEXT: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
505 ; SIVI-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p5) = G_FRAME_INDEX %stack.0
506 ; SIVI-NEXT: [[COPY1:%[0-9]+]]:_(p4) = COPY [[COPY]](p4)
507 ; SIVI-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 68
508 ; SIVI-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY1]], [[C]](s64)
509 ; SIVI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (dereferenceable invariant load (s32), addrspace 4)
510 ; SIVI-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[FRAME_INDEX]](p5)
511 ; SIVI-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[LOAD]](s32)
512 ; SIVI-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY [[MV]](p0)
513 ; SIVI-NEXT: $vgpr0_vgpr1 = COPY [[COPY2]](p0)
514 ; GFX9-LABEL: name: test_addrspacecast_p5_fi_to_p0
515 ; GFX9: [[FRAME_INDEX:%[0-9]+]]:_(p5) = G_FRAME_INDEX %stack.0
516 ; GFX9-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64(s64) = S_MOV_B64 $src_private_base
517 ; GFX9-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[S_MOV_B64_]](s64)
518 ; GFX9-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[FRAME_INDEX]](p5)
519 ; GFX9-NEXT: [[MV:%[0-9]+]]:_(p0) = G_MERGE_VALUES [[PTRTOINT]](s32), [[UV1]](s32)
520 ; GFX9-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY [[MV]](p0)
521 ; GFX9-NEXT: $vgpr0_vgpr1 = COPY [[COPY]](p0)
522 %0:_(p5) = G_FRAME_INDEX %stack.0
523 %1:_(p0) = G_ADDRSPACE_CAST %0
524 $vgpr0_vgpr1 = COPY %1