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
4---
5# select (c, x, x) -> x
6name:            test_combine_select_same_res
7body:             |
8  bb.1:
9    liveins: $x0, $x1
10    ; CHECK-LABEL: name: test_combine_select_same_res
11    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
12    ; CHECK: $x0 = COPY [[COPY]](s64)
13    %0:_(s64) = COPY $x0
14    %1:_(s1) = G_TRUNC %0
15    %2:_(s64) = G_SELECT %1, %0, %0
16    $x0 = COPY %2(s64)
17...
18---
19# select (undef, x, y) -> y
20name:            test_combine_select_undef_res0_res1
21body:             |
22  bb.1:
23    liveins: $x0, $x1
24    ; CHECK-LABEL: name: test_combine_select_undef_res0_res1
25    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
26    ; CHECK: $x0 = COPY [[COPY]](s64)
27    %0:_(s64) = COPY $x0
28    %1:_(s64) = COPY $x1
29    %2:_(s1) = G_IMPLICIT_DEF
30    %3:_(s64) = G_SELECT %2, %0, %1
31    $x0 = COPY %3(s64)
32...
33---
34# select (false, x, y) -> y
35name:            test_combine_select_false_res0_res1
36body:             |
37  bb.1:
38    liveins: $x0, $x1
39    ; CHECK-LABEL: name: test_combine_select_false_res0_res1
40    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x1
41    ; CHECK: $x0 = COPY [[COPY]](s64)
42    %0:_(s64) = COPY $x0
43    %1:_(s64) = COPY $x1
44    %2:_(s1) = G_CONSTANT i1 false
45    %3:_(s64) = G_SELECT %2, %0, %1
46    $x0 = COPY %3(s64)
47...
48---
49# select (true, x, y) -> x
50name:            test_combine_select_true_res0_res1
51body:             |
52  bb.1:
53    liveins: $x0, $x1
54    ; CHECK-LABEL: name: test_combine_select_true_res0_res1
55    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
56    ; CHECK: $x0 = COPY [[COPY]](s64)
57    %0:_(s64) = COPY $x0
58    %1:_(s64) = COPY $x1
59    %2:_(s1) = G_CONSTANT i1 true
60    %3:_(s64) = G_SELECT %2, %0, %1
61    $x0 = COPY %3(s64)
62...
63