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
33 ; CHECK: %copy:_(s64) = COPY $x0
34 ; CHECK: $x0 = COPY %copy(s64)
35 ; CHECK: RET_ReallyLR implicit $x0
36 %copy:_(s64) = COPY $x0
37 %and:_(s64) = G_AND %copy, %copy
39 RET_ReallyLR implicit $x0
44 tracksRegLiveness: true
49 ; We can fold when the LHS and RHS are guaranteed to be identical.
51 ; CHECK-LABEL: name: and_same2
52 ; CHECK: liveins: $x0, $x1
53 ; CHECK: %copy1:_(s64) = COPY $x0
54 ; CHECK: %copy2:_(s64) = COPY $x1
55 ; CHECK: %or:_(s64) = G_OR %copy1, %copy2
56 ; CHECK: $x0 = COPY %or(s64)
57 ; CHECK: RET_ReallyLR implicit $x0
58 %copy1:_(s64) = COPY $x0
59 %copy2:_(s64) = COPY $x1
60 %or:_(s64) = G_OR %copy1, %copy2
61 %same_as_or:_(s64) = COPY %or(s64)
62 %and:_(s64) = G_AND %or, %same_as_or
64 RET_ReallyLR implicit $x0
69 tracksRegLiveness: true
72 liveins: $x0, $x1, $x2
74 ; None of the G_ORs or G_ANDs should be eliminated here, because their LHS
75 ; and RHS values are different.
77 ; CHECK-LABEL: name: or_and_not_same
78 ; CHECK: liveins: $x0, $x1, $x2
79 ; CHECK: %copy1:_(s64) = COPY $x0
80 ; CHECK: %copy2:_(s64) = COPY $x1
81 ; CHECK: %copy3:_(s64) = COPY $x2
82 ; CHECK: %or1:_(s64) = G_OR %copy1, %copy2
83 ; CHECK: %or2:_(s64) = G_OR %copy1, %copy3
84 ; CHECK: %and:_(s64) = G_AND %or1, %or2
85 ; CHECK: $x0 = COPY %and(s64)
86 ; CHECK: RET_ReallyLR implicit $x0
87 %copy1:_(s64) = COPY $x0
88 %copy2:_(s64) = COPY $x1
89 %copy3:_(s64) = COPY $x2
90 %or1:_(s64) = G_OR %copy1, %copy2
91 %or2:_(s64) = G_OR %copy1, %copy3
92 %and:_(s64) = G_AND %or1, %or2
94 RET_ReallyLR implicit $x0