1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s
5 name: test_gep_global_i64_idx
8 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
10 ; CHECK-LABEL: name: test_gep_global_i64_idx
11 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
14 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
15 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
16 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p1)
17 %0:_(p1) = COPY $vgpr0_vgpr1
18 %1:_(s64) = COPY $vgpr2_vgpr3
19 %2:_(p1) = G_PTR_ADD %0, %1
21 $vgpr0_vgpr1 = COPY %2
25 name: test_gep_flat_i64_idx
28 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
30 ; CHECK-LABEL: name: test_gep_flat_i64_idx
31 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
33 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
34 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
35 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
36 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p0)
37 %0:_(p0) = COPY $vgpr0_vgpr1
38 %1:_(s64) = COPY $vgpr2_vgpr3
39 %2:_(p0) = G_PTR_ADD %0, %1
41 $vgpr0_vgpr1 = COPY %2
45 name: test_gep_constant_i64_idx
48 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
50 ; CHECK-LABEL: name: test_gep_constant_i64_idx
51 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
53 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
54 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
55 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
56 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p4)
57 %0:_(p4) = COPY $vgpr0_vgpr1
58 %1:_(s64) = COPY $vgpr2_vgpr3
59 %2:_(p4) = G_PTR_ADD %0, %1
61 $vgpr0_vgpr1 = COPY %2
65 name: test_gep_local_i32_idx
68 liveins: $vgpr0, $vgpr1
70 ; CHECK-LABEL: name: test_gep_local_i32_idx
71 ; CHECK: liveins: $vgpr0, $vgpr1
73 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
74 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
75 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p3) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
76 ; CHECK-NEXT: $vgpr0 = COPY [[PTR_ADD]](p3)
77 %0:_(p3) = COPY $vgpr0
78 %1:_(s32) = COPY $vgpr1
79 %2:_(p3) = G_PTR_ADD %0, %1
85 name: test_gep_private_i32_idx
88 liveins: $vgpr0, $vgpr1
90 ; CHECK-LABEL: name: test_gep_private_i32_idx
91 ; CHECK: liveins: $vgpr0, $vgpr1
93 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
94 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
95 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p5) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
96 ; CHECK-NEXT: $vgpr0 = COPY [[PTR_ADD]](p5)
97 %0:_(p5) = COPY $vgpr0
98 %1:_(s32) = COPY $vgpr1
99 %2:_(p5) = G_PTR_ADD %0, %1
105 name: test_gep_constant32_i32_idx
108 liveins: $sgpr0, $sgpr1
110 ; CHECK-LABEL: name: test_gep_constant32_i32_idx
111 ; CHECK: liveins: $sgpr0, $sgpr1
113 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p6) = COPY $sgpr0
114 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $sgpr1
115 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p6) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
116 ; CHECK-NEXT: $sgpr0 = COPY [[PTR_ADD]](p6)
117 %0:_(p6) = COPY $sgpr0
118 %1:_(s32) = COPY $sgpr1
119 %2:_(p6) = G_PTR_ADD %0, %1
125 name: test_gep_region_i32_idx
128 liveins: $vgpr0, $vgpr1
130 ; CHECK-LABEL: name: test_gep_region_i32_idx
131 ; CHECK: liveins: $vgpr0, $vgpr1
133 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p2) = COPY $vgpr0
134 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
135 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p2) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
136 ; CHECK-NEXT: $vgpr0 = COPY [[PTR_ADD]](p2)
137 %0:_(p2) = COPY $vgpr0
138 %1:_(s32) = COPY $vgpr1
139 %2:_(p2) = G_PTR_ADD %0, %1
145 name: test_gep_p999_i64_idx
148 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
150 ; CHECK-LABEL: name: test_gep_p999_i64_idx
151 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
153 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
154 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
155 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p999) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
156 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p999)
157 %0:_(p999) = COPY $vgpr0_vgpr1
158 %1:_(s64) = COPY $vgpr2_vgpr3
159 %2:_(p999) = G_PTR_ADD %0, %1
160 $vgpr0_vgpr1 = COPY %2
164 name: test_gep_v2p1_v2i64
167 liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7
169 ; CHECK-LABEL: name: test_gep_v2p1_v2i64
170 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6_vgpr7
172 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
173 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
174 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(p1), [[UV1:%[0-9]+]]:_(p1) = G_UNMERGE_VALUES [[COPY]](<2 x p1>)
175 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s64), [[UV3:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY1]](<2 x s64>)
176 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[UV]], [[UV2]](s64)
177 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p1) = G_PTR_ADD [[UV1]], [[UV3]](s64)
178 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p1>) = G_BUILD_VECTOR [[PTR_ADD]](p1), [[PTR_ADD1]](p1)
179 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x p1>)
180 %0:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
181 %1:_(<2 x s64>) = COPY $vgpr4_vgpr5_vgpr6_vgpr7
182 %2:_(<2 x p1>) = G_PTR_ADD %0, %1
183 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
187 name: test_gep_v2p3_v2s32
190 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
192 ; CHECK-LABEL: name: test_gep_v2p3_v2s32
193 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
195 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
196 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3
197 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(p3), [[UV1:%[0-9]+]]:_(p3) = G_UNMERGE_VALUES [[COPY]](<2 x p3>)
198 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>)
199 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p3) = G_PTR_ADD [[UV]], [[UV2]](s32)
200 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p3) = G_PTR_ADD [[UV1]], [[UV3]](s32)
201 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p3>) = G_BUILD_VECTOR [[PTR_ADD]](p3), [[PTR_ADD1]](p3)
202 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x p3>)
203 %0:_(<2 x p3>) = COPY $vgpr0_vgpr1
204 %1:_(<2 x s32>) = COPY $vgpr2_vgpr3
205 %2:_(<2 x p3>) = G_PTR_ADD %0, %1
206 $vgpr0_vgpr1 = COPY %2