1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
3 # RUN: llc -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
7 # select (c, x, x) -> x
8 name: test_combine_select_same_res
12 ; CHECK-LABEL: name: test_combine_select_same_res
13 ; CHECK: liveins: $x0, $x1
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
16 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
19 %2:_(s64) = G_SELECT %1, %0, %0
23 # select (undef, x, y) -> y
24 name: test_combine_select_undef_res0_res1
28 ; CHECK-LABEL: name: test_combine_select_undef_res0_res1
29 ; CHECK: liveins: $x0, $x1
31 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1
32 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
35 %2:_(s1) = G_IMPLICIT_DEF
36 %3:_(s64) = G_SELECT %2, %0, %1
40 # select (false, x, y) -> y
41 name: test_combine_select_false_res0_res1
45 ; CHECK-LABEL: name: test_combine_select_false_res0_res1
46 ; CHECK: liveins: $x0, $x1
48 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1
49 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
52 %2:_(s1) = G_CONSTANT i1 false
53 %3:_(s64) = G_SELECT %2, %0, %1
57 # vector select (false, x, y) -> y
58 name: test_combine_vector_select_false_res0_res1
62 ; CHECK-LABEL: name: test_combine_vector_select_false_res0_res1
63 ; CHECK: liveins: $q0, $q1
65 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q1
66 ; CHECK-NEXT: $q0 = COPY [[COPY]](<4 x s32>)
67 %0:_(<4 x s32>) = COPY $q0
68 %1:_(<4 x s32>) = COPY $q1
69 %2:_(s1) = G_CONSTANT i1 false
70 %condvec:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2
71 %3:_(<4 x s32>) = G_SELECT %condvec, %0, %1
72 $q0 = COPY %3(<4 x s32>)
75 # select (true, x, y) -> x
76 name: test_combine_select_true_res0_res1
80 ; CHECK-LABEL: name: test_combine_select_true_res0_res1
81 ; CHECK: liveins: $x0, $x1
83 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
84 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
87 %2:_(s1) = G_CONSTANT i1 true
88 %3:_(s64) = G_SELECT %2, %0, %1
92 # vector select (true, x, y) -> x
93 name: test_combine_vector_select_true_res0_res1
97 ; CHECK-LABEL: name: test_combine_vector_select_true_res0_res1
98 ; CHECK: liveins: $q0, $q1
100 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
101 ; CHECK-NEXT: $q0 = COPY [[COPY]](<4 x s32>)
102 %0:_(<4 x s32>) = COPY $q0
103 %1:_(<4 x s32>) = COPY $q1
104 %2:_(s1) = G_CONSTANT i1 true
105 %condvec:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2
106 %3:_(<4 x s32>) = G_SELECT %condvec, %0, %1
107 $q0 = COPY %3(<4 x s32>)
110 # select Cond, Cond, F --> or Cond, F
111 name: bool_cond_cond_false
114 liveins: $x0, $x1, $x2
115 ; CHECK-LABEL: name: bool_cond_cond_false
116 ; CHECK: liveins: $x0, $x1, $x2
118 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
119 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2
120 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]]
121 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[FREEZE]]
122 ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[OR]](s64)
123 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1)
124 ; CHECK-NEXT: $w0 = COPY %ext(s32)
128 %c:_(s1) = G_TRUNC %0
129 %t:_(s1) = G_TRUNC %1
130 %f:_(s1) = G_TRUNC %2
131 %sel:_(s1) = G_SELECT %c, %c, %f
132 %ext:_(s32) = G_ANYEXT %sel
136 # select Cond, 1, F --> or Cond, F
137 name: bool_cond_one_false
140 liveins: $x0, $x1, $x2
141 ; CHECK-LABEL: name: bool_cond_one_false
142 ; CHECK: liveins: $x0, $x1, $x2
144 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
145 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2
146 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]]
147 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[FREEZE]]
148 ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[OR]](s64)
149 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1)
150 ; CHECK-NEXT: $w0 = COPY %ext(s32)
154 %c:_(s1) = G_TRUNC %0
155 %t:_(s1) = G_TRUNC %1
156 %f:_(s1) = G_TRUNC %2
157 %one:_(s1) = G_CONSTANT i1 1
158 %sel:_(s1) = G_SELECT %c, %one, %f
159 %ext:_(s32) = G_ANYEXT %sel
163 # select Cond, 1, F --> or Cond, F
164 name: bool_cond_one_false_vector
167 liveins: $d0, $d1, $d2
168 ; CHECK-LABEL: name: bool_cond_one_false_vector
169 ; CHECK: liveins: $d0, $d1, $d2
171 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
172 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d2
173 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(<2 x s32>) = G_FREEZE [[COPY1]]
174 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<2 x s32>) = G_OR [[COPY]], [[FREEZE]]
175 ; CHECK-NEXT: $d0 = COPY [[OR]](<2 x s32>)
176 %0:_(<2 x s32>) = COPY $d0
177 %1:_(<2 x s32>) = COPY $d1
178 %2:_(<2 x s32>) = COPY $d2
179 %c:_(<2 x s1>) = G_TRUNC %0
180 %t:_(<2 x s1>) = G_TRUNC %1
181 %f:_(<2 x s1>) = G_TRUNC %2
182 %one:_(s1) = G_CONSTANT i1 1
183 %one_vec:_(<2 x s1>) = G_BUILD_VECTOR %one, %one
184 %sel:_(<2 x s1>) = G_SELECT %c, %one_vec, %f
185 %ext:_(<2 x s32>) = G_ANYEXT %sel
186 $d0 = COPY %ext(<2 x s32>)
189 # select Cond, T, Cond --> and Cond, T
190 name: bool_cond_true_cond
193 liveins: $x0, $x1, $x2
194 ; CHECK-LABEL: name: bool_cond_true_cond
195 ; CHECK: liveins: $x0, $x1, $x2
197 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
198 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
199 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]]
200 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[FREEZE]]
201 ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[AND]](s64)
202 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1)
203 ; CHECK-NEXT: $w0 = COPY %ext(s32)
207 %c:_(s1) = G_TRUNC %0
208 %t:_(s1) = G_TRUNC %1
209 %f:_(s1) = G_TRUNC %2
210 %one:_(s1) = G_CONSTANT i1 1
211 %sel:_(s1) = G_SELECT %c, %t, %c
212 %ext:_(s32) = G_ANYEXT %sel
216 # select Cond, T, 0 --> and Cond, T
217 name: bool_cond_true_zero
220 liveins: $x0, $x1, $x2
221 ; CHECK-LABEL: name: bool_cond_true_zero
222 ; CHECK: liveins: $x0, $x1, $x2
224 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
225 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
226 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]]
227 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[FREEZE]]
228 ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[AND]](s64)
229 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1)
230 ; CHECK-NEXT: $w0 = COPY %ext(s32)
234 %c:_(s1) = G_TRUNC %0
235 %t:_(s1) = G_TRUNC %1
236 %f:_(s1) = G_TRUNC %2
237 %zero:_(s1) = G_CONSTANT i1 0
238 %sel:_(s1) = G_SELECT %c, %t, %zero
239 %ext:_(s32) = G_ANYEXT %sel
243 # select Cond, T, 1 --> or (not Cond), T
244 name: bool_cond_true_one
247 liveins: $x0, $x1, $x2
248 ; CHECK-LABEL: name: bool_cond_true_one
249 ; CHECK: liveins: $x0, $x1, $x2
251 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
252 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
253 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
254 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]]
255 ; CHECK-NEXT: %t:_(s1) = G_TRUNC [[FREEZE]](s64)
256 ; CHECK-NEXT: %one:_(s1) = G_CONSTANT i1 true
257 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, %one
258 ; CHECK-NEXT: %sel:_(s1) = G_OR [[XOR]], %t
259 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1)
260 ; CHECK-NEXT: $w0 = COPY %ext(s32)
264 %c:_(s1) = G_TRUNC %0
265 %t:_(s1) = G_TRUNC %1
266 %f:_(s1) = G_TRUNC %2
267 %one:_(s1) = G_CONSTANT i1 1
268 %sel:_(s1) = G_SELECT %c, %t, %one
269 %ext:_(s32) = G_ANYEXT %sel
273 # select Cond, 0, F --> and (not Cond), F
274 name: bool_cond_zero_false
277 liveins: $x0, $x1, $x2
278 ; CHECK-LABEL: name: bool_cond_zero_false
279 ; CHECK: liveins: $x0, $x1, $x2
281 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
282 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2
283 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
284 ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]]
285 ; CHECK-NEXT: %f:_(s1) = G_TRUNC [[FREEZE]](s64)
286 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true
287 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]]
288 ; CHECK-NEXT: %sel:_(s1) = G_AND [[XOR]], %f
289 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1)
290 ; CHECK-NEXT: $w0 = COPY %ext(s32)
294 %c:_(s1) = G_TRUNC %0
295 %t:_(s1) = G_TRUNC %1
296 %f:_(s1) = G_TRUNC %2
297 %zero:_(s1) = G_CONSTANT i1 0
298 %sel:_(s1) = G_SELECT %c, %zero, %f
299 %ext:_(s32) = G_ANYEXT %sel
303 # select cond, 1, 0 --> zext(Cond)
304 name: select_cond_1_0_to_zext_cond
307 liveins: $x0, $x1, $x2
308 ; CHECK-LABEL: name: select_cond_1_0_to_zext_cond
309 ; CHECK: liveins: $x0, $x1, $x2
311 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
312 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
313 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %c(s1)
314 ; CHECK-NEXT: $w0 = COPY %ext(s32)
318 %c:_(s1) = G_TRUNC %0
319 %t:_(s1) = G_TRUNC %1
320 %f:_(s1) = G_TRUNC %2
321 %zero:_(s1) = G_CONSTANT i1 0
322 %one:_(s1) = G_CONSTANT i1 1
323 %sel:_(s1) = G_SELECT %c, %one, %zero
324 %ext:_(s32) = G_ANYEXT %sel
328 # select cond, 0, 1 --> zext(!Cond)
329 name: select_cond_0_1_to_sext_not_cond
332 liveins: $x0, $x1, $x2
333 ; CHECK-LABEL: name: select_cond_0_1_to_sext_not_cond
334 ; CHECK: liveins: $x0, $x1, $x2
336 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
337 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
338 ; CHECK-NEXT: %one:_(s1) = G_CONSTANT i1 true
339 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, %one
340 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT [[XOR]](s1)
341 ; CHECK-NEXT: $w0 = COPY %ext(s32)
345 %c:_(s1) = G_TRUNC %0
346 %t:_(s1) = G_TRUNC %1
347 %f:_(s1) = G_TRUNC %2
348 %zero:_(s1) = G_CONSTANT i1 0
349 %one:_(s1) = G_CONSTANT i1 1
350 %sel:_(s1) = G_SELECT %c, %zero, %one
351 %ext:_(s32) = G_ANYEXT %sel
355 # select cond, 2, 1 --> and (zext Cond), false
356 name: select_cond_2_1_to_and_zext_cond_false
359 liveins: $x0, $x1, $x2
360 ; CHECK-LABEL: name: select_cond_2_1_to_and_zext_cond_false
361 ; CHECK: liveins: $x0, $x1, $x2
363 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
364 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
365 ; CHECK-NEXT: %one:_(s8) = G_CONSTANT i8 101
366 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT %c(s1)
367 ; CHECK-NEXT: %sel:_(s8) = G_ADD [[ZEXT]], %one
368 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8)
369 ; CHECK-NEXT: $w0 = COPY %ext(s32)
373 %c:_(s1) = G_TRUNC %0
374 %t:_(s1) = G_TRUNC %1
375 %f:_(s1) = G_TRUNC %2
376 %two:_(s8) = G_CONSTANT i8 102
377 %one:_(s8) = G_CONSTANT i8 101
378 %sel:_(s8) = G_SELECT %c, %two, %one
379 %ext:_(s32) = G_ANYEXT %sel
383 # select cond, 1, 2 --> and (ext Cond), false
384 name: select_cond_1_2_to_and_sext_cond_false
387 liveins: $x0, $x1, $x2
388 ; CHECK-LABEL: name: select_cond_1_2_to_and_sext_cond_false
389 ; CHECK: liveins: $x0, $x1, $x2
391 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
392 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
393 ; CHECK-NEXT: %one:_(s8) = G_CONSTANT i8 102
394 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s8) = G_SEXT %c(s1)
395 ; CHECK-NEXT: %sel:_(s8) = G_ADD [[SEXT]], %one
396 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8)
397 ; CHECK-NEXT: $w0 = COPY %ext(s32)
401 %c:_(s1) = G_TRUNC %0
402 %t:_(s1) = G_TRUNC %1
403 %f:_(s1) = G_TRUNC %2
404 %two:_(s8) = G_CONSTANT i8 101
405 %one:_(s8) = G_CONSTANT i8 102
406 %sel:_(s8) = G_SELECT %c, %two, %one
407 %ext:_(s32) = G_ANYEXT %sel
411 # select cond, 64, 0 --> (zext Cond) << log2(Pow2)
412 name: select_cond_64_0_to_shift
415 liveins: $x0, $x1, $x2
416 ; CHECK-LABEL: name: select_cond_64_0_to_shift
417 ; CHECK: liveins: $x0, $x1, $x2
419 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
420 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
421 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT %c(s1)
422 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 6
423 ; CHECK-NEXT: %sel:_(s8) = G_SHL [[ZEXT]], [[C]](s8)
424 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8)
425 ; CHECK-NEXT: $w0 = COPY %ext(s32)
429 %c:_(s1) = G_TRUNC %0
430 %t:_(s1) = G_TRUNC %1
431 %f:_(s1) = G_TRUNC %2
432 %two:_(s8) = G_CONSTANT i8 64
433 %one:_(s8) = G_CONSTANT i8 0
434 %sel:_(s8) = G_SELECT %c, %two, %one
435 %ext:_(s32) = G_ANYEXT %sel
439 # select cond, -1, 0 --> sext Cond
440 name: select_cond_minus_1_0_to_sext_cond
443 liveins: $x0, $x1, $x2
444 ; CHECK-LABEL: name: select_cond_minus_1_0_to_sext_cond
445 ; CHECK: liveins: $x0, $x1, $x2
447 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
448 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
449 ; CHECK-NEXT: %ext:_(s32) = G_SEXT %c(s1)
450 ; CHECK-NEXT: $w0 = COPY %ext(s32)
454 %c:_(s1) = G_TRUNC %0
455 %t:_(s1) = G_TRUNC %1
456 %f:_(s1) = G_TRUNC %2
457 %two:_(s8) = G_CONSTANT i8 255
458 %one:_(s8) = G_CONSTANT i8 0
459 %sel:_(s8) = G_SELECT %c, %two, %one
460 %ext:_(s32) = G_ANYEXT %sel
464 # select cond, 0, -1 --> sext (!Cond)
465 name: select_cond_0_minus_1_to_sext_not_cond
468 liveins: $x0, $x1, $x2
469 ; CHECK-LABEL: name: select_cond_0_minus_1_to_sext_not_cond
470 ; CHECK: liveins: $x0, $x1, $x2
472 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
473 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
474 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true
475 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]]
476 ; CHECK-NEXT: %ext:_(s32) = G_SEXT [[XOR]](s1)
477 ; CHECK-NEXT: $w0 = COPY %ext(s32)
481 %c:_(s1) = G_TRUNC %0
482 %t:_(s1) = G_TRUNC %1
483 %f:_(s1) = G_TRUNC %2
484 %two:_(s8) = G_CONSTANT i8 0
485 %one:_(s8) = G_CONSTANT i8 255
486 %sel:_(s8) = G_SELECT %c, %two, %one
487 %ext:_(s32) = G_ANYEXT %sel
491 # select cond, -1, 101 --> or (sext Cond), 101
492 name: select_cond_minus_1_101_to_or_sext_cond_101
495 liveins: $x0, $x1, $x2
496 ; CHECK-LABEL: name: select_cond_minus_1_101_to_or_sext_cond_101
497 ; CHECK: liveins: $x0, $x1, $x2
499 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
500 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
501 ; CHECK-NEXT: %one:_(s8) = G_CONSTANT i8 101
502 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s8) = G_SEXT %c(s1)
503 ; CHECK-NEXT: %sel:_(s8) = G_OR [[SEXT]], %one
504 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8)
505 ; CHECK-NEXT: $w0 = COPY %ext(s32)
509 %c:_(s1) = G_TRUNC %0
510 %t:_(s1) = G_TRUNC %1
511 %f:_(s1) = G_TRUNC %2
512 %two:_(s8) = G_CONSTANT i8 255
513 %one:_(s8) = G_CONSTANT i8 101
514 %sel:_(s8) = G_SELECT %c, %two, %one
515 %ext:_(s32) = G_ANYEXT %sel
519 # select cond, 101, -1 --> or (sext (not Cond), 101
520 name: select_cond_101_minus_1_to_or_sext_not_cond_101
523 liveins: $x0, $x1, $x2
524 ; CHECK-LABEL: name: select_cond_101_minus_1_to_or_sext_not_cond_101
525 ; CHECK: liveins: $x0, $x1, $x2
527 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
528 ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
529 ; CHECK-NEXT: %two:_(s8) = G_CONSTANT i8 101
530 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true
531 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]]
532 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s8) = G_SEXT [[XOR]](s1)
533 ; CHECK-NEXT: %sel:_(s8) = G_OR [[SEXT]], %two
534 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8)
535 ; CHECK-NEXT: $w0 = COPY %ext(s32)
539 %c:_(s1) = G_TRUNC %0
540 %t:_(s1) = G_TRUNC %1
541 %f:_(s1) = G_TRUNC %2
542 %two:_(s8) = G_CONSTANT i8 101
543 %one:_(s8) = G_CONSTANT i8 255
544 %sel:_(s8) = G_SELECT %c, %two, %one
545 %ext:_(s32) = G_ANYEXT %sel
549 # select test(failed,registers) select icmp_ugt t,f_t_f --> umax(t,f)
550 name: select_failed_icmp_ugt_t_f_t_f_umax_t_f
553 liveins: $x0, $x1, $x2
554 ; CHECK-LABEL: name: select_failed_icmp_ugt_t_f_t_f_umax_t_f
555 ; CHECK: liveins: $x0, $x1, $x2
557 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
558 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
559 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
560 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
561 ; CHECK-NEXT: %t:_(s8) = G_TRUNC [[COPY]](s64)
562 ; CHECK-NEXT: %f:_(s8) = G_TRUNC [[COPY1]](s64)
563 ; CHECK-NEXT: %y:_(s8) = G_TRUNC [[COPY2]](s64)
564 ; CHECK-NEXT: %z:_(s8) = G_TRUNC [[COPY3]](s64)
565 ; CHECK-NEXT: %c:_(s8) = G_ICMP intpred(ugt), %t(s8), %y
566 ; CHECK-NEXT: %sel:_(s8) = exact G_SELECT %c(s8), %f, %z
567 ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8)
568 ; CHECK-NEXT: $w0 = COPY %ext(s32)
574 %t:_(s8) = G_TRUNC %0
575 %f:_(s8) = G_TRUNC %1
576 %y:_(s8) = G_TRUNC %2
577 %z:_(s8) = G_TRUNC %3
578 %c:_(s8) = G_ICMP intpred(ugt), %t(s8), %y(s8)
579 %sel:_(s8) = exact G_SELECT %c, %f, %z
580 %ext:_(s32) = G_ANYEXT %sel
584 # test select icmp_ugt t,f_t_f --> umax(t,f)
585 name: select_icmp_ugt_t_f_t_f_umax_t_f
588 liveins: $x0, $x1, $x2
589 ; CHECK-LABEL: name: select_icmp_ugt_t_f_t_f_umax_t_f
590 ; CHECK: liveins: $x0, $x1, $x2
592 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
593 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
594 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
595 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
596 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
597 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
598 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMAX %t, %f
599 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
602 %t1:_(s32) = G_TRUNC %0
603 %f1:_(s32) = G_TRUNC %1
604 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
605 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
606 %c:_(<4 x s32>) = G_ICMP intpred(ugt), %t(<4 x s32>), %f(<4 x s32>)
607 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
608 $q0 = COPY %sel(<4 x s32>)
611 # test select icmp_uge t,f_t_f --> umax(t,f)
612 name: select_icmp_uge_t_f_t_f_umax_t_f
615 liveins: $x0, $x1, $x2
616 ; CHECK-LABEL: name: select_icmp_uge_t_f_t_f_umax_t_f
617 ; CHECK: liveins: $x0, $x1, $x2
619 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
620 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
621 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
622 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
623 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
624 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
625 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMAX %t, %f
626 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
629 %t1:_(s32) = G_TRUNC %0
630 %f1:_(s32) = G_TRUNC %1
631 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
632 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
633 %c:_(<4 x s32>) = G_ICMP intpred(uge), %t(<4 x s32>), %f(<4 x s32>)
634 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
635 $q0 = COPY %sel(<4 x s32>)
638 # test select icmp_sgt t,f_t_f --> smax(t,f)
639 name: select_icmp_sgt_t_f_t_f_smax_t_f
642 liveins: $x0, $x1, $x2
643 ; CHECK-LABEL: name: select_icmp_sgt_t_f_t_f_smax_t_f
644 ; CHECK: liveins: $x0, $x1, $x2
646 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
647 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
648 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
649 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
650 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
651 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
652 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMAX %t, %f
653 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
656 %t1:_(s32) = G_TRUNC %0
657 %f1:_(s32) = G_TRUNC %1
658 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
659 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
660 %c:_(<4 x s32>) = G_ICMP intpred(sgt), %t(<4 x s32>), %f(<4 x s32>)
661 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
662 $q0 = COPY %sel(<4 x s32>)
665 # test select icmp_sge t,f_t_f --> smax(t,f)
666 name: select_icmp_sge_t_f_t_f_smax_t_f
669 liveins: $x0, $x1, $x2
670 ; CHECK-LABEL: name: select_icmp_sge_t_f_t_f_smax_t_f
671 ; CHECK: liveins: $x0, $x1, $x2
673 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
674 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
675 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
676 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
677 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
678 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
679 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMAX %t, %f
680 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
683 %t1:_(s32) = G_TRUNC %0
684 %f1:_(s32) = G_TRUNC %1
685 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
686 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
687 %c:_(<4 x s32>) = G_ICMP intpred(sge), %t(<4 x s32>), %f(<4 x s32>)
688 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
689 $q0 = COPY %sel(<4 x s32>)
692 # test select icmp_ult t,f_t_f --> umin(t,f)
693 name: select_icmp_ult_t_f_t_f_umin_t_f
696 liveins: $x0, $x1, $x2
697 ; CHECK-LABEL: name: select_icmp_ult_t_f_t_f_umin_t_f
698 ; CHECK: liveins: $x0, $x1, $x2
700 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
701 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
702 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
703 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
704 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
705 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
706 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMIN %t, %f
707 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
710 %t1:_(s32) = G_TRUNC %0
711 %f1:_(s32) = G_TRUNC %1
712 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
713 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
714 %c:_(<4 x s32>) = G_ICMP intpred(ult), %t(<4 x s32>), %f(<4 x s32>)
715 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
716 $q0 = COPY %sel(<4 x s32>)
719 # test select icmp_ule t,f_t_f --> umin(t,f)
720 name: select_icmp_ule_t_f_t_f_umin_t_f
723 liveins: $x0, $x1, $x2
724 ; CHECK-LABEL: name: select_icmp_ule_t_f_t_f_umin_t_f
725 ; CHECK: liveins: $x0, $x1, $x2
727 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
728 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
729 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
730 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
731 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
732 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
733 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMIN %t, %f
734 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
737 %t1:_(s32) = G_TRUNC %0
738 %f1:_(s32) = G_TRUNC %1
739 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
740 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
741 %c:_(<4 x s32>) = G_ICMP intpred(ule), %t(<4 x s32>), %f(<4 x s32>)
742 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
743 $q0 = COPY %sel(<4 x s32>)
746 # test select icmp_slt t,f_t_f --> smin(t,f)
747 name: select_icmp_slt_t_f_t_f_smin_t_f
750 liveins: $x0, $x1, $x2
751 ; CHECK-LABEL: name: select_icmp_slt_t_f_t_f_smin_t_f
752 ; CHECK: liveins: $x0, $x1, $x2
754 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
755 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
756 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
757 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
758 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
759 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
760 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMIN %t, %f
761 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
764 %t1:_(s32) = G_TRUNC %0
765 %f1:_(s32) = G_TRUNC %1
766 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
767 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
768 %c:_(<4 x s32>) = G_ICMP intpred(slt), %t(<4 x s32>), %f(<4 x s32>)
769 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
770 $q0 = COPY %sel(<4 x s32>)
773 # test select icmp_sle t,f_t_f --> smin(t,f)
774 name: select_icmp_sle_t_f_t_f_smin_t_f
777 liveins: $x0, $x1, $x2
778 ; CHECK-LABEL: name: select_icmp_sle_t_f_t_f_smin_t_f
779 ; CHECK: liveins: $x0, $x1, $x2
781 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
782 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
783 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
784 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
785 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
786 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
787 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMIN %t, %f
788 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
791 %t1:_(s32) = G_TRUNC %0
792 %f1:_(s32) = G_TRUNC %1
793 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
794 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
795 %c:_(<4 x s32>) = G_ICMP intpred(sle), %t(<4 x s32>), %f(<4 x s32>)
796 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
797 $q0 = COPY %sel(<4 x s32>)
800 # multi use test select icmp_sle t,f_t_f --> smin(t,f) failed
801 name: multi_use_select_icmp_sle_t_f_t_f_smin_t_f_failed
804 liveins: $x0, $x1, $x2
805 ; CHECK-LABEL: name: multi_use_select_icmp_sle_t_f_t_f_smin_t_f_failed
806 ; CHECK: liveins: $x0, $x1, $x2
808 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
809 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
810 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
811 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
812 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
813 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
814 ; CHECK-NEXT: %c:_(<4 x s32>) = G_ICMP intpred(sle), %t(<4 x s32>), %f
815 ; CHECK-NEXT: $q1 = COPY %c(<4 x s32>)
816 ; CHECK-NEXT: %sel:_(<4 x s32>) = exact G_SELECT %c(<4 x s32>), %t, %f
817 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
820 %t1:_(s32) = G_TRUNC %0
821 %f1:_(s32) = G_TRUNC %1
822 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
823 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
824 %c:_(<4 x s32>) = G_ICMP intpred(sle), %t(<4 x s32>), %f(<4 x s32>)
825 $q1 = COPY %c(<4 x s32>)
826 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
827 $q0 = COPY %sel(<4 x s32>)
830 name: dont_combine_pointer_type
835 ; CHECK-LABEL: name: dont_combine_pointer_type
836 ; CHECK: liveins: $x0
838 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
839 ; CHECK-NEXT: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
840 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[C]](p0) :: (load (p0))
841 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[LOAD]](p0), [[C]]
842 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[LOAD]], [[C]]
843 ; CHECK-NEXT: G_STORE [[SELECT]](p0), [[COPY]](p0) :: (store (p0))
844 ; CHECK-NEXT: $x0 = COPY [[C]](p0)
845 ; CHECK-NEXT: RET_ReallyLR implicit $x0
847 %2:_(p0) = G_CONSTANT i64 0
848 %1:_(p0) = G_LOAD %2(p0) :: (load (p0))
849 %3:_(s1) = G_ICMP intpred(ugt), %1(p0), %2
850 %4:_(p0) = G_SELECT %3(s1), %1, %2
851 G_STORE %4(p0), %0(p0) :: (store (p0))
853 RET_ReallyLR implicit $x0
857 name: dont_combine_pointer_type_select_of_constant
866 ; CHECK-LABEL: name: dont_combine_pointer_type_select_of_constant
867 ; CHECK: liveins: $w0, $x1
869 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
870 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
871 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
872 ; CHECK-NEXT: [[ASSERT_ZEXT:%[0-9]+]]:_(s8) = G_ASSERT_ZEXT [[TRUNC]], 1
873 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ASSERT_ZEXT]](s8)
874 ; CHECK-NEXT: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
875 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
876 ; CHECK-NEXT: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[C1]](s64)
877 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[TRUNC1]](s1), [[C]], [[INTTOPTR]]
878 ; CHECK-NEXT: G_STORE [[SELECT]](p0), [[COPY1]](p0) :: (store (p0))
879 ; CHECK-NEXT: RET_ReallyLR
881 %2:_(s8) = G_TRUNC %3(s32)
883 %4:_(s8) = G_ASSERT_ZEXT %2, 1
884 %0:_(s1) = G_TRUNC %4(s8)
885 %6:_(p0) = G_CONSTANT i64 0
886 %8:_(s64) = G_CONSTANT i64 -1
887 %7:_(p0) = G_INTTOPTR %8(s64)
888 %5:_(p0) = G_SELECT %0(s1), %6, %7
889 G_STORE %5(p0), %1(p0) :: (store (p0))
894 # test failed select icmp_slef,t_t_f --> smin(t,f)
895 name: select_icmp_sle_f_t_t_f_smin_t_f
898 liveins: $x0, $x1, $x2
899 ; CHECK-LABEL: name: select_icmp_sle_f_t_t_f_smin_t_f
900 ; CHECK: liveins: $x0, $x1, $x2
902 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
903 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
904 ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64)
905 ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64)
906 ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32)
907 ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32)
908 ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMAX %t, %f
909 ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>)
912 %t1:_(s32) = G_TRUNC %0
913 %f1:_(s32) = G_TRUNC %1
914 %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1
915 %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1
916 %c:_(<4 x s32>) = G_ICMP intpred(sle), %f(<4 x s32>), %t(<4 x s32>)
917 %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f
918 $q0 = COPY %sel(<4 x s32>)