xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/postlegalizercombiner-select.mir (revision 2d87319f06ef936233ba6aaa612da9586c427d68)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
3---
4# select (c, x, x) -> x
5name:            test_combine_select_same_res
6legalized:       true
7body:             |
8  bb.1:
9    liveins: $x0, $x1
10    ; CHECK-LABEL: name: test_combine_select_same_res
11    ; CHECK: liveins: $x0, $x1
12    ; CHECK-NEXT: {{  $}}
13    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
14    ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
15    %0:_(s64) = COPY $x0
16    %1:_(s1) = G_TRUNC %0
17    %2:_(s64) = G_SELECT %1, %0, %0
18    $x0 = COPY %2(s64)
19...
20---
21# select (undef, x, y) -> y
22name:            test_combine_select_undef_res0_res1
23legalized:       true
24body:             |
25  bb.1:
26    liveins: $x0, $x1
27    ; CHECK-LABEL: name: test_combine_select_undef_res0_res1
28    ; CHECK: liveins: $x0, $x1
29    ; CHECK-NEXT: {{  $}}
30    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1
31    ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
32    %0:_(s64) = COPY $x0
33    %1:_(s64) = COPY $x1
34    %2:_(s1) = G_IMPLICIT_DEF
35    %3:_(s64) = G_SELECT %2, %0, %1
36    $x0 = COPY %3(s64)
37...
38---
39# select (false, x, y) -> y
40name:            test_combine_select_false_res0_res1
41legalized:       true
42body:             |
43  bb.1:
44    liveins: $x0, $x1
45    ; CHECK-LABEL: name: test_combine_select_false_res0_res1
46    ; CHECK: liveins: $x0, $x1
47    ; CHECK-NEXT: {{  $}}
48    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1
49    ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
50    %0:_(s64) = COPY $x0
51    %1:_(s64) = COPY $x1
52    %2:_(s1) = G_CONSTANT i1 false
53    %3:_(s64) = G_SELECT %2, %0, %1
54    $x0 = COPY %3(s64)
55...
56---
57# select (true, x, y) -> x
58name:            test_combine_select_true_res0_res1
59legalized:       true
60body:             |
61  bb.1:
62    liveins: $x0, $x1
63    ; CHECK-LABEL: name: test_combine_select_true_res0_res1
64    ; CHECK: liveins: $x0, $x1
65    ; CHECK-NEXT: {{  $}}
66    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
67    ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
68    %0:_(s64) = COPY $x0
69    %1:_(s64) = COPY $x1
70    %2:_(s1) = G_CONSTANT i1 true
71    %3:_(s64) = G_SELECT %2, %0, %1
72    $x0 = COPY %3(s64)
73...
74