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
6 tracksRegLiveness: true
9 ; CHECK-LABEL: name: uitofp_to_zero
10 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
11 ; CHECK: $s0 = COPY [[C]](s32)
12 ; CHECK: RET_ReallyLR implicit $s0
13 %0:_(s32) = G_IMPLICIT_DEF
14 %1:_(s32) = G_UITOFP %0(s32)
16 RET_ReallyLR implicit $s0
22 tracksRegLiveness: true
25 ; CHECK-LABEL: name: sitofp_to_zero
26 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
27 ; CHECK-NEXT: $s0 = COPY [[C]](s32)
28 ; CHECK-NEXT: RET_ReallyLR implicit $s0
29 %0:_(s32) = G_IMPLICIT_DEF
30 %1:_(s32) = G_SITOFP %0(s32)
32 RET_ReallyLR implicit $s0
38 tracksRegLiveness: true
41 ; CHECK-LABEL: name: and_to_zero
42 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
43 ; CHECK-NEXT: $w0 = COPY [[C]](s32)
44 ; CHECK-NEXT: RET_ReallyLR implicit $w0
45 %0:_(s32) = G_CONSTANT i32 10
46 %1:_(s32) = G_IMPLICIT_DEF
47 %2:_(s32) = G_AND %0, %1
49 RET_ReallyLR implicit $w0
55 tracksRegLiveness: true
58 ; CHECK-LABEL: name: mul_to_zero
59 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
60 ; CHECK-NEXT: $w0 = COPY [[C]](s32)
61 ; CHECK-NEXT: RET_ReallyLR implicit $w0
62 %0:_(s32) = G_CONSTANT i32 10
63 %1:_(s32) = G_IMPLICIT_DEF
64 %2:_(s32) = G_MUL %0, %1
66 RET_ReallyLR implicit $w0
70 name: or_to_negative_one
72 tracksRegLiveness: true
75 ; CHECK-LABEL: name: or_to_negative_one
76 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
77 ; CHECK-NEXT: $w0 = COPY [[C]](s32)
78 ; CHECK-NEXT: RET_ReallyLR implicit $w0
79 %0:_(s32) = G_CONSTANT i32 10
80 %1:_(s32) = G_IMPLICIT_DEF
81 %2:_(s32) = G_OR %0, %1
83 RET_ReallyLR implicit $w0
89 tracksRegLiveness: true
92 ; CHECK-LABEL: name: xor_to_undef
93 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
94 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)
95 ; CHECK-NEXT: RET_ReallyLR implicit $w0
96 %0:_(s32) = G_CONSTANT i32 10
97 %1:_(s32) = G_IMPLICIT_DEF
98 %2:_(s32) = G_XOR %0, %1
100 RET_ReallyLR implicit $w0
106 tracksRegLiveness: true
109 ; CHECK-LABEL: name: add_to_undef
110 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
111 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)
112 ; CHECK-NEXT: RET_ReallyLR implicit $w0
113 %0:_(s32) = G_CONSTANT i32 10
114 %1:_(s32) = G_IMPLICIT_DEF
115 %2:_(s32) = G_ADD %0, %1
117 RET_ReallyLR implicit $w0
123 tracksRegLiveness: true
126 ; CHECK-LABEL: name: sub_to_undef
127 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
128 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)
129 ; CHECK-NEXT: RET_ReallyLR implicit $w0
130 %0:_(s32) = G_CONSTANT i32 10
131 %1:_(s32) = G_IMPLICIT_DEF
132 %2:_(s32) = G_SUB %0, %1
134 RET_ReallyLR implicit $w0
138 name: fptoui_to_undef
140 tracksRegLiveness: true
143 ; CHECK-LABEL: name: fptoui_to_undef
144 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
145 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)
146 ; CHECK-NEXT: RET_ReallyLR implicit $w0
147 %0:_(s32) = G_IMPLICIT_DEF
148 %1:_(s32) = G_FPTOUI %0(s32)
150 RET_ReallyLR implicit $w0
154 name: fptosi_to_undef
156 tracksRegLiveness: true
159 ; CHECK-LABEL: name: fptosi_to_undef
160 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
161 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)
162 ; CHECK-NEXT: RET_ReallyLR implicit $w0
163 %0:_(s32) = G_IMPLICIT_DEF
164 %1:_(s32) = G_FPTOSI %0(s32)
166 RET_ReallyLR implicit $w0
170 name: shufflevector_undef_ops_to_undef
172 tracksRegLiveness: true
175 ; CHECK-LABEL: name: shufflevector_undef_ops_to_undef
176 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s32>) = G_IMPLICIT_DEF
177 ; CHECK-NEXT: $d0 = COPY [[DEF]](<2 x s32>)
178 ; CHECK-NEXT: RET_ReallyLR implicit $d0
179 %1:_(<2 x s32>) = G_IMPLICIT_DEF
180 %2:_(<2 x s32>) = G_IMPLICIT_DEF
181 %0:_(<2 x s32>) = G_SHUFFLE_VECTOR %1(<2 x s32>), %2(<2 x s32>), shufflemask(0, 1)
182 $d0 = COPY %0(<2 x s32>)
183 RET_ReallyLR implicit $d0
187 name: shufflevector_undef_mask_to_undef
189 tracksRegLiveness: true
193 ; CHECK-LABEL: name: shufflevector_undef_mask_to_undef
194 ; CHECK: liveins: $d0, $d1
196 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<2 x s32>) = G_IMPLICIT_DEF
197 ; CHECK-NEXT: $d0 = COPY [[DEF]](<2 x s32>)
198 ; CHECK-NEXT: RET_ReallyLR implicit $d0
199 %0:_(<2 x s32>) = COPY $d0
200 %1:_(<2 x s32>) = COPY $d1
201 %2:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(undef, undef)
202 $d0 = COPY %2(<2 x s32>)
203 RET_ReallyLR implicit $d0
207 name: shufflevector_not_all_ops_undef
209 tracksRegLiveness: true
213 ; Show that we don't do the combine when one of the vectors is not a
216 ; CHECK-LABEL: name: shufflevector_not_all_ops_undef
217 ; CHECK: liveins: $d0
219 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<2 x s32>) = G_IMPLICIT_DEF
220 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
221 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<2 x s32>) = G_SHUFFLE_VECTOR [[DEF]](<2 x s32>), [[COPY]], shufflemask(0, 1)
222 ; CHECK-NEXT: $d0 = COPY [[SHUF]](<2 x s32>)
223 ; CHECK-NEXT: RET_ReallyLR implicit $d0
224 %1:_(<2 x s32>) = G_IMPLICIT_DEF
225 %2:_(<2 x s32>) = COPY $d0
226 %0:_(<2 x s32>) = G_SHUFFLE_VECTOR %1(<2 x s32>), %2(<2 x s32>), shufflemask(0, 1)
227 $d0 = COPY %0(<2 x s32>)
228 RET_ReallyLR implicit $d0
234 tracksRegLiveness: true
237 ; CHECK-LABEL: name: shl_undef_rhs
238 ; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
239 ; CHECK-NEXT: $x0 = COPY [[DEF]](s64)
240 ; CHECK-NEXT: RET_ReallyLR implicit $x0
241 %0:_(s64) = G_CONSTANT i64 10
242 %1:_(s64) = G_IMPLICIT_DEF
243 %2:_(s64) = G_SHL %0, %1
245 RET_ReallyLR implicit $x0
251 tracksRegLiveness: true
254 ; CHECK-LABEL: name: lshr_undef_rhs
255 ; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
256 ; CHECK-NEXT: $x0 = COPY [[DEF]](s64)
257 ; CHECK-NEXT: RET_ReallyLR implicit $x0
258 %0:_(s64) = G_CONSTANT i64 10
259 %1:_(s64) = G_IMPLICIT_DEF
260 %2:_(s64) = G_LSHR %0, %1
262 RET_ReallyLR implicit $x0
268 tracksRegLiveness: true
271 ; CHECK-LABEL: name: ashr_undef_rhs
272 ; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
273 ; CHECK-NEXT: $x0 = COPY [[DEF]](s64)
274 ; CHECK-NEXT: RET_ReallyLR implicit $x0
275 %0:_(s64) = G_CONSTANT i64 10
276 %1:_(s64) = G_IMPLICIT_DEF
277 %2:_(s64) = G_ASHR %0, %1
279 RET_ReallyLR implicit $x0
285 tracksRegLiveness: true
288 ; Optimize these to zero?
289 ; CHECK-LABEL: name: lshr_undef_lhs
290 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 10
291 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
292 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[DEF]], [[C]](s64)
293 ; CHECK-NEXT: $x0 = COPY [[LSHR]](s64)
294 ; CHECK-NEXT: RET_ReallyLR implicit $x0
295 %0:_(s64) = G_CONSTANT i64 10
296 %1:_(s64) = G_IMPLICIT_DEF
297 %2:_(s64) = G_LSHR %1, %0
299 RET_ReallyLR implicit $x0
305 tracksRegLiveness: true
308 ; Optimize these to zero?
309 ; CHECK-LABEL: name: ashr_undef_lhs
310 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 10
311 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
312 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[DEF]], [[C]](s64)
313 ; CHECK-NEXT: $x0 = COPY [[ASHR]](s64)
314 ; CHECK-NEXT: RET_ReallyLR implicit $x0
315 %0:_(s64) = G_CONSTANT i64 10
316 %1:_(s64) = G_IMPLICIT_DEF
317 %2:_(s64) = G_ASHR %1, %0
319 RET_ReallyLR implicit $x0