1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
5 tracksRegLiveness: true
10 ; CHECK-LABEL: name: cfb_lhs
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
14 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
15 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
16 ; CHECK-NEXT: %add:_(s32) = G_ADD [[COPY]], %cfb
17 ; CHECK-NEXT: $w0 = COPY %add(s32)
18 ; CHECK-NEXT: RET_ReallyLR
20 %cst:_(s32) = G_CONSTANT i32 1
21 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
22 %cst2:_(s32) = G_CONSTANT i32 2
23 %add:_(s32) = G_ADD %cfb, %0
29 name: cfb_lhs_cfb_already_rhs
30 tracksRegLiveness: true
35 ; CHECK-LABEL: name: cfb_lhs_cfb_already_rhs
38 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
39 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
40 ; CHECK-NEXT: %cst2:_(s32) = G_CONSTANT i32 2
41 ; CHECK-NEXT: %cfb2:_(s32) = G_CONSTANT_FOLD_BARRIER %cst2
42 ; CHECK-NEXT: %add:_(s32) = G_ADD %cfb, %cfb2
43 ; CHECK-NEXT: $w0 = COPY %add(s32)
44 ; CHECK-NEXT: RET_ReallyLR
46 %cst:_(s32) = G_CONSTANT i32 1
47 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
48 %cst2:_(s32) = G_CONSTANT i32 2
49 %cfb2:_(s32) = G_CONSTANT_FOLD_BARRIER %cst2
50 %add:_(s32) = G_ADD %cfb, %cfb2
56 name: cfb_lhs_cst_on_rhs
58 tracksRegLiveness: true
63 ; CHECK-LABEL: name: cfb_lhs_cst_on_rhs
66 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
67 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
68 ; CHECK-NEXT: %cst2:_(s32) = G_CONSTANT i32 2
69 ; CHECK-NEXT: %add:_(s32) = G_ADD %cfb, %cst2
70 ; CHECK-NEXT: $w0 = COPY %add(s32)
71 ; CHECK-NEXT: RET_ReallyLR
73 %cst:_(s32) = G_CONSTANT i32 1
74 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
75 %cst2:_(s32) = G_CONSTANT i32 2
76 %add:_(s32) = G_ADD %cfb, %cst2
83 tracksRegLiveness: true
88 ; CHECK-LABEL: name: cfb_lhs_smulo
91 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
92 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
93 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
94 ; CHECK-NEXT: %mul:_(s32), %overflow:_(s1) = G_SMULO [[COPY]], %cfb
95 ; CHECK-NEXT: %ret:_(s32) = G_ANYEXT %overflow(s1)
96 ; CHECK-NEXT: $w0 = COPY %ret(s32)
97 ; CHECK-NEXT: RET_ReallyLR
99 %cst:_(s32) = G_CONSTANT i32 1
100 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
101 %mul:_(s32), %overflow:_(s1) = G_SMULO %cfb, %0
102 %ret:_(s32) = G_ANYEXT %overflow
108 name: cfb_lhs_cfb_already_rhs_smulo
109 tracksRegLiveness: true
114 ; CHECK-LABEL: name: cfb_lhs_cfb_already_rhs_smulo
115 ; CHECK: liveins: $w0
117 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
118 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
119 ; CHECK-NEXT: %cst2:_(s32) = G_CONSTANT i32 6
120 ; CHECK-NEXT: %cfb2:_(s32) = G_CONSTANT_FOLD_BARRIER %cst2
121 ; CHECK-NEXT: %mul:_(s32), %overflow:_(s1) = G_SMULO %cfb, %cfb2
122 ; CHECK-NEXT: %ret:_(s32) = G_ANYEXT %overflow(s1)
123 ; CHECK-NEXT: $w0 = COPY %ret(s32)
124 ; CHECK-NEXT: RET_ReallyLR
126 %cst:_(s32) = G_CONSTANT i32 1
127 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
128 %cst2:_(s32) = G_CONSTANT i32 6
129 %cfb2:_(s32) = G_CONSTANT_FOLD_BARRIER %cst2
130 %mul:_(s32), %overflow:_(s1) = G_SMULO %cfb, %cfb2
131 %ret:_(s32) = G_ANYEXT %overflow
137 name: cfb_lhs_cst_on_rhs_smulo
139 tracksRegLiveness: true
144 ; CHECK-LABEL: name: cfb_lhs_cst_on_rhs_smulo
145 ; CHECK: liveins: $w0
147 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
148 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
149 ; CHECK-NEXT: %cst2:_(s32) = G_CONSTANT i32 6
150 ; CHECK-NEXT: %mul:_(s32), %overflow:_(s1) = G_SMULO %cfb, %cst2
151 ; CHECK-NEXT: %ret:_(s32) = G_ANYEXT %overflow(s1)
152 ; CHECK-NEXT: $w0 = COPY %ret(s32)
153 ; CHECK-NEXT: RET_ReallyLR
155 %cst:_(s32) = G_CONSTANT i32 1
156 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
157 %cst2:_(s32) = G_CONSTANT i32 6
158 %mul:_(s32), %overflow:_(s1) = G_SMULO %cfb, %cst2
159 %ret:_(s32) = G_ANYEXT %overflow
165 name: cfb_lhs_umulfixsat
166 tracksRegLiveness: true
171 ; CHECK-LABEL: name: cfb_lhs_umulfixsat
172 ; CHECK: liveins: $w0
174 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
175 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
176 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
177 ; CHECK-NEXT: %mul:_(s32) = G_UMULFIXSAT [[COPY]], %cfb, 7
178 ; CHECK-NEXT: $w0 = COPY %mul(s32)
179 ; CHECK-NEXT: RET_ReallyLR
181 %cst:_(s32) = G_CONSTANT i32 1
182 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
183 %mul:_(s32) = G_UMULFIXSAT %cfb, %0, 7
189 name: cfb_lhs_cfb_already_rhs_umulfixsat
190 tracksRegLiveness: true
195 ; CHECK-LABEL: name: cfb_lhs_cfb_already_rhs_umulfixsat
196 ; CHECK: liveins: $w0
198 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
199 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
200 ; CHECK-NEXT: %cst2:_(s32) = G_CONSTANT i32 2
201 ; CHECK-NEXT: %cfb2:_(s32) = G_CONSTANT_FOLD_BARRIER %cst2
202 ; CHECK-NEXT: %add:_(s32) = G_UMULFIXSAT %cfb, %cfb2, 7
203 ; CHECK-NEXT: $w0 = COPY %add(s32)
204 ; CHECK-NEXT: RET_ReallyLR
206 %cst:_(s32) = G_CONSTANT i32 1
207 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
208 %cst2:_(s32) = G_CONSTANT i32 2
209 %cfb2:_(s32) = G_CONSTANT_FOLD_BARRIER %cst2
210 %add:_(s32) = G_UMULFIXSAT %cfb, %cfb2, 7
216 name: cfb_lhs_cst_on_rhs_umulfixsat
218 tracksRegLiveness: true
223 ; CHECK-LABEL: name: cfb_lhs_cst_on_rhs_umulfixsat
224 ; CHECK: liveins: $w0
226 ; CHECK-NEXT: %cst:_(s32) = G_CONSTANT i32 1
227 ; CHECK-NEXT: %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
228 ; CHECK-NEXT: %cst2:_(s32) = G_CONSTANT i32 2
229 ; CHECK-NEXT: %add:_(s32) = G_UMULFIXSAT %cfb, %cst2, 7
230 ; CHECK-NEXT: $w0 = COPY %add(s32)
231 ; CHECK-NEXT: RET_ReallyLR
233 %cst:_(s32) = G_CONSTANT i32 1
234 %cfb:_(s32) = G_CONSTANT_FOLD_BARRIER %cst
235 %cst2:_(s32) = G_CONSTANT i32 2
236 %add:_(s32) = G_UMULFIXSAT %cfb, %cst2, 7