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
4 # Combins: (Opc (Opc X, C1), C2) -> (Opc X, (Opc C1, C2))
6 name: test1_add_move_inner_cst_to_fold
8 tracksRegLiveness: true
15 ; CHECK-LABEL: name: test1_add_move_inner_cst_to_fold
18 ; CHECK-NEXT: %x:_(s64) = COPY $x0
19 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 88
20 ; CHECK-NEXT: %add_outer:_(s64) = G_ADD %x, [[C]]
21 ; CHECK-NEXT: $x0 = COPY %add_outer(s64)
22 ; CHECK-NEXT: RET_ReallyLR implicit $x0
24 %C1:_(s64) = G_CONSTANT i64 64
25 %C2:_(s64) = G_CONSTANT i64 24
26 %add_inner:_(s64) = G_ADD %x, %C1
27 %add_outer:_(s64) = G_ADD %add_inner, %C2
29 RET_ReallyLR implicit $x0
33 # (op (op x, c1), y) -> (op (op x, y), c1)
35 name: test2_add_move_inner_cst_to_rhs
37 tracksRegLiveness: true
44 ; CHECK-LABEL: name: test2_add_move_inner_cst_to_rhs
45 ; CHECK: liveins: $x0, $x1
47 ; CHECK-NEXT: %x:_(s64) = COPY $x0
48 ; CHECK-NEXT: %C1:_(s64) = G_CONSTANT i64 64
49 ; CHECK-NEXT: %y:_(s64) = COPY $x1
50 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD %x, %y
51 ; CHECK-NEXT: %add_outer:_(s64) = G_ADD [[ADD]], %C1
52 ; CHECK-NEXT: $x0 = COPY %add_outer(s64)
53 ; CHECK-NEXT: RET_ReallyLR implicit $x0
55 %C1:_(s64) = G_CONSTANT i64 64
57 %add_inner:_(s64) = G_ADD %x, %C1
58 %add_outer:_(s64) = G_ADD %add_inner, %y
60 RET_ReallyLR implicit $x0
64 name: test2_add_move_inner_cst_to_rhs_multiuse
66 tracksRegLiveness: true
73 ; CHECK-LABEL: name: test2_add_move_inner_cst_to_rhs_multiuse
74 ; CHECK: liveins: $x0, $x1
76 ; CHECK-NEXT: %x:_(s64) = COPY $x0
77 ; CHECK-NEXT: %C1:_(s64) = G_CONSTANT i64 64
78 ; CHECK-NEXT: %y:_(s64) = COPY $x1
79 ; CHECK-NEXT: %add_inner:_(s64) = G_ADD %x, %C1
80 ; CHECK-NEXT: %add_outer:_(s64) = G_ADD %add_inner, %y
81 ; CHECK-NEXT: $x0 = COPY %add_outer(s64)
82 ; CHECK-NEXT: $x1 = COPY %add_inner(s64)
83 ; CHECK-NEXT: RET_ReallyLR implicit $x0
85 %C1:_(s64) = G_CONSTANT i64 64
87 %add_inner:_(s64) = G_ADD %x, %C1
88 %add_outer:_(s64) = G_ADD %add_inner, %y
91 RET_ReallyLR implicit $x0
95 name: test2_add_move_inner_cst_to_rhs_vector
97 tracksRegLiveness: true
104 ; CHECK-LABEL: name: test2_add_move_inner_cst_to_rhs_vector
105 ; CHECK: liveins: $q0, $q1
107 ; CHECK-NEXT: %x:_(<2 x s64>) = COPY $q0
108 ; CHECK-NEXT: %C1:_(s64) = G_CONSTANT i64 64
109 ; CHECK-NEXT: %VEC_C1:_(<2 x s64>) = G_BUILD_VECTOR %C1(s64), %C1(s64)
110 ; CHECK-NEXT: %y:_(<2 x s64>) = COPY $q1
111 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<2 x s64>) = G_ADD %x, %y
112 ; CHECK-NEXT: %add_outer:_(<2 x s64>) = G_ADD [[ADD]], %VEC_C1
113 ; CHECK-NEXT: $q0 = COPY %add_outer(<2 x s64>)
114 ; CHECK-NEXT: RET_ReallyLR implicit $q0
115 %x:_(<2 x s64>) = COPY $q0
116 %C1:_(s64) = G_CONSTANT i64 64
117 %VEC_C1:_(<2 x s64>) = G_BUILD_VECTOR %C1, %C1
118 %y:_(<2 x s64>) = COPY $q1
119 %add_inner:_(<2 x s64>) = G_ADD %x, %VEC_C1
120 %add_outer:_(<2 x s64>) = G_ADD %add_inner, %y
121 $q0 = COPY %add_outer
122 RET_ReallyLR implicit $q0