1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-mesa3d -mcpu=gfx900 -run-pass=amdgpu-regbank-combiner -verify-machineinstrs %s -o - | FileCheck %s
3 # RUN: llc -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1010 -run-pass=amdgpu-regbank-combiner -verify-machineinstrs %s -o - | FileCheck %s
6 name: test_min_max_ValK0_K1_i32
9 tracksRegLiveness: true
14 ; CHECK-LABEL: name: test_min_max_ValK0_K1_i32
15 ; CHECK: liveins: $vgpr0
17 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
18 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
19 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
20 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
21 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
22 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY1]], [[COPY2]]
23 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
24 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
25 %0:vgpr(s32) = COPY $vgpr0
26 %2:sgpr(s32) = G_CONSTANT i32 -12
27 %7:vgpr(s32) = COPY %2(s32)
28 %3:vgpr(s32) = G_SMAX %0, %7
29 %4:sgpr(s32) = G_CONSTANT i32 17
30 %8:vgpr(s32) = COPY %4(s32)
31 %5:vgpr(s32) = G_SMIN %3, %8
33 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
37 name: min_max_ValK0_K1_i32
40 tracksRegLiveness: true
45 ; CHECK-LABEL: name: min_max_ValK0_K1_i32
46 ; CHECK: liveins: $vgpr0
48 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
49 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
50 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
51 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
52 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
53 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY1]], [[COPY2]]
54 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
55 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
56 %0:vgpr(s32) = COPY $vgpr0
57 %2:sgpr(s32) = G_CONSTANT i32 -12
58 %7:vgpr(s32) = COPY %2(s32)
59 %3:vgpr(s32) = G_SMAX %7, %0
60 %4:sgpr(s32) = G_CONSTANT i32 17
61 %8:vgpr(s32) = COPY %4(s32)
62 %5:vgpr(s32) = G_SMIN %3, %8
64 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
68 name: test_min_K1max_ValK0__i32
71 tracksRegLiveness: true
76 ; CHECK-LABEL: name: test_min_K1max_ValK0__i32
77 ; CHECK: liveins: $vgpr0
79 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
80 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
81 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
82 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
83 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
84 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY1]], [[COPY2]]
85 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
86 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
87 %0:vgpr(s32) = COPY $vgpr0
88 %2:sgpr(s32) = G_CONSTANT i32 -12
89 %7:vgpr(s32) = COPY %2(s32)
90 %3:vgpr(s32) = G_SMAX %0, %7
91 %4:sgpr(s32) = G_CONSTANT i32 17
92 %8:vgpr(s32) = COPY %4(s32)
93 %5:vgpr(s32) = G_SMIN %8, %3
95 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
99 name: test_min_K1max_K0Val__i32
101 regBankSelected: true
102 tracksRegLiveness: true
107 ; CHECK-LABEL: name: test_min_K1max_K0Val__i32
108 ; CHECK: liveins: $vgpr0
110 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
111 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
112 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
113 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
114 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
115 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY1]], [[COPY2]]
116 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
117 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
118 %0:vgpr(s32) = COPY $vgpr0
119 %2:sgpr(s32) = G_CONSTANT i32 -12
120 %7:vgpr(s32) = COPY %2(s32)
121 %3:vgpr(s32) = G_SMAX %7, %0
122 %4:sgpr(s32) = G_CONSTANT i32 17
123 %8:vgpr(s32) = COPY %4(s32)
124 %5:vgpr(s32) = G_SMIN %8, %3
125 $vgpr0 = COPY %5(s32)
126 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
130 name: test_max_min_ValK1_K0_i32
132 regBankSelected: true
133 tracksRegLiveness: true
138 ; CHECK-LABEL: name: test_max_min_ValK1_K0_i32
139 ; CHECK: liveins: $vgpr0
141 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
142 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
143 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
144 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
145 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
146 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY2]], [[COPY1]]
147 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
148 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
149 %0:vgpr(s32) = COPY $vgpr0
150 %2:sgpr(s32) = G_CONSTANT i32 17
151 %7:vgpr(s32) = COPY %2(s32)
152 %3:vgpr(s32) = G_SMIN %0, %7
153 %4:sgpr(s32) = G_CONSTANT i32 -12
154 %8:vgpr(s32) = COPY %4(s32)
155 %5:vgpr(s32) = G_SMAX %3, %8
156 $vgpr0 = COPY %5(s32)
157 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
161 name: test_max_min_K1Val_K0_i32
163 regBankSelected: true
164 tracksRegLiveness: true
169 ; CHECK-LABEL: name: test_max_min_K1Val_K0_i32
170 ; CHECK: liveins: $vgpr0
172 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
173 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
174 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
175 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
176 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
177 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY2]], [[COPY1]]
178 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
179 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
180 %0:vgpr(s32) = COPY $vgpr0
181 %2:sgpr(s32) = G_CONSTANT i32 17
182 %7:vgpr(s32) = COPY %2(s32)
183 %3:vgpr(s32) = G_SMIN %7, %0
184 %4:sgpr(s32) = G_CONSTANT i32 -12
185 %8:vgpr(s32) = COPY %4(s32)
186 %5:vgpr(s32) = G_SMAX %3, %8
187 $vgpr0 = COPY %5(s32)
188 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
192 name: test_max_K0min_ValK1__i32
194 regBankSelected: true
195 tracksRegLiveness: true
200 ; CHECK-LABEL: name: test_max_K0min_ValK1__i32
201 ; CHECK: liveins: $vgpr0
203 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
204 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
205 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
206 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
207 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
208 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY2]], [[COPY1]]
209 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
210 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
211 %0:vgpr(s32) = COPY $vgpr0
212 %2:sgpr(s32) = G_CONSTANT i32 17
213 %7:vgpr(s32) = COPY %2(s32)
214 %3:vgpr(s32) = G_SMIN %0, %7
215 %4:sgpr(s32) = G_CONSTANT i32 -12
216 %8:vgpr(s32) = COPY %4(s32)
217 %5:vgpr(s32) = G_SMAX %8, %3
218 $vgpr0 = COPY %5(s32)
219 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
223 name: test_max_K0min_K1Val__i32
225 regBankSelected: true
226 tracksRegLiveness: true
231 ; CHECK-LABEL: name: test_max_K0min_K1Val__i32
232 ; CHECK: liveins: $vgpr0
234 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
235 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
236 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
237 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
238 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
239 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY2]], [[COPY1]]
240 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
241 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
242 %0:vgpr(s32) = COPY $vgpr0
243 %2:sgpr(s32) = G_CONSTANT i32 17
244 %7:vgpr(s32) = COPY %2(s32)
245 %3:vgpr(s32) = G_SMIN %7, %0
246 %4:sgpr(s32) = G_CONSTANT i32 -12
247 %8:vgpr(s32) = COPY %4(s32)
248 %5:vgpr(s32) = G_SMAX %8, %3
249 $vgpr0 = COPY %5(s32)
250 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
254 name: test_max_K0min_K1Val__v2i16
256 regBankSelected: true
257 tracksRegLiveness: true
262 ; CHECK-LABEL: name: test_max_K0min_K1Val__v2i16
263 ; CHECK: liveins: $vgpr0
265 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
266 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
267 ; CHECK-NEXT: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[C]](s32), [[C]](s32)
268 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
269 ; CHECK-NEXT: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[C1]](s32), [[C1]](s32)
270 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[BUILD_VECTOR_TRUNC]](<2 x s16>)
271 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_SMIN [[COPY1]], [[COPY]]
272 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[BUILD_VECTOR_TRUNC1]](<2 x s16>)
273 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_SMAX [[COPY2]], [[SMIN]]
274 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](<2 x s16>)
275 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
276 %0:vgpr(<2 x s16>) = COPY $vgpr0
277 %9:sgpr(s32) = G_CONSTANT i32 17
278 %2:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC %9(s32), %9(s32)
279 %10:sgpr(s32) = G_CONSTANT i32 -12
280 %5:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC %10(s32), %10(s32)
281 %11:vgpr(<2 x s16>) = COPY %2(<2 x s16>)
282 %4:vgpr(<2 x s16>) = G_SMIN %11, %0
283 %12:vgpr(<2 x s16>) = COPY %5(<2 x s16>)
284 %7:vgpr(<2 x s16>) = G_SMAX %12, %4
285 $vgpr0 = COPY %7(<2 x s16>)
286 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
290 name: test_uniform_min_max
292 regBankSelected: true
293 tracksRegLiveness: true
298 ; CHECK-LABEL: name: test_uniform_min_max
299 ; CHECK: liveins: $sgpr2
301 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
302 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
303 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:sgpr(s32) = G_SMAX [[COPY]], [[C]]
304 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 17
305 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:sgpr(s32) = G_SMIN [[SMAX]], [[C1]]
306 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[SMIN]](s32)
307 ; CHECK-NEXT: [[INT:%[0-9]+]]:sgpr(s32) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.readfirstlane), [[COPY1]](s32)
308 ; CHECK-NEXT: $sgpr0 = COPY [[INT]](s32)
309 ; CHECK-NEXT: SI_RETURN_TO_EPILOG implicit $sgpr0
310 %0:sgpr(s32) = COPY $sgpr2
311 %3:sgpr(s32) = G_CONSTANT i32 -12
312 %4:sgpr(s32) = G_SMAX %0, %3
313 %5:sgpr(s32) = G_CONSTANT i32 17
314 %6:sgpr(s32) = G_SMIN %4, %5
315 %8:vgpr(s32) = COPY %6(s32)
316 %7:sgpr(s32) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.readfirstlane), %8(s32)
317 $sgpr0 = COPY %7(s32)
318 SI_RETURN_TO_EPILOG implicit $sgpr0
322 name: test_non_inline_constant_i32
324 regBankSelected: true
325 tracksRegLiveness: true
330 ; CHECK-LABEL: name: test_non_inline_constant_i32
331 ; CHECK: liveins: $vgpr0
333 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
334 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 -12
335 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
336 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65
337 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
338 ; CHECK-NEXT: [[AMDGPU_SMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_SMED3 [[COPY]], [[COPY1]], [[COPY2]]
339 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_SMED3_]](s32)
340 ; CHECK-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0
341 %0:vgpr(s32) = COPY $vgpr0
342 %2:sgpr(s32) = G_CONSTANT i32 -12
343 %7:vgpr(s32) = COPY %2(s32)
344 %3:vgpr(s32) = G_SMAX %0, %7
345 %4:sgpr(s32) = G_CONSTANT i32 65
346 %8:vgpr(s32) = COPY %4(s32)
347 %5:vgpr(s32) = G_SMIN %3, %8
348 $vgpr0 = COPY %5(s32)
349 S_SETPC_B64_return undef $sgpr30_sgpr31, implicit $vgpr0