1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
5 tracksRegLiveness: true
11 ; CHECK-LABEL: name: or_same
13 ; CHECK: %copy:_(s64) = COPY $x0
14 ; CHECK: $x0 = COPY %copy(s64)
15 ; CHECK: RET_ReallyLR implicit $x0
16 %copy:_(s64) = COPY $x0
17 %or:_(s64) = G_OR %copy, %copy
19 RET_ReallyLR implicit $x0
24 tracksRegLiveness: true
31 ; CHECK-LABEL: name: and_same
34 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
35 ; CHECK-NEXT: $x0 = COPY %copy(s64)
36 ; CHECK-NEXT: RET_ReallyLR implicit $x0
37 %copy:_(s64) = COPY $x0
38 %and:_(s64) = G_AND %copy, %copy
40 RET_ReallyLR implicit $x0
45 tracksRegLiveness: true
50 ; We can fold when the LHS and RHS are guaranteed to be identical.
52 ; CHECK-LABEL: name: and_same2
53 ; CHECK: liveins: $x0, $x1
55 ; CHECK-NEXT: %copy1:_(s64) = COPY $x0
56 ; CHECK-NEXT: %copy2:_(s64) = COPY $x1
57 ; CHECK-NEXT: %or:_(s64) = G_OR %copy1, %copy2
58 ; CHECK-NEXT: $x0 = COPY %or(s64)
59 ; CHECK-NEXT: RET_ReallyLR implicit $x0
60 %copy1:_(s64) = COPY $x0
61 %copy2:_(s64) = COPY $x1
62 %or:_(s64) = G_OR %copy1, %copy2
63 %same_as_or:_(s64) = COPY %or(s64)
64 %and:_(s64) = G_AND %or, %same_as_or
66 RET_ReallyLR implicit $x0
71 tracksRegLiveness: true
74 liveins: $x0, $x1, $x2
76 ; None of the G_ORs or G_ANDs should be eliminated here, because their LHS
77 ; and RHS values are different.
79 ; CHECK-LABEL: name: or_and_not_same
80 ; CHECK: liveins: $x0, $x1, $x2
82 ; CHECK-NEXT: %copy1:_(s64) = COPY $x0
83 ; CHECK-NEXT: %copy2:_(s64) = COPY $x1
84 ; CHECK-NEXT: %copy3:_(s64) = COPY $x2
85 ; CHECK-NEXT: %or1:_(s64) = G_OR %copy1, %copy2
86 ; CHECK-NEXT: %or2:_(s64) = G_OR %copy1, %copy3
87 ; CHECK-NEXT: %and:_(s64) = G_AND %or1, %or2
88 ; CHECK-NEXT: $x0 = COPY %and(s64)
89 ; CHECK-NEXT: RET_ReallyLR implicit $x0
90 %copy1:_(s64) = COPY $x0
91 %copy2:_(s64) = COPY $x1
92 %copy3:_(s64) = COPY $x2
93 %or1:_(s64) = G_OR %copy1, %copy2
94 %or2:_(s64) = G_OR %copy1, %copy3
95 %and:_(s64) = G_AND %or1, %or2
97 RET_ReallyLR implicit $x0