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 # (X + Y) == X --> Y == 0
6 # (X - Y) == X --> Y == 0
7 # (X ^ Y) == X --> Y == 0
8 # (X + Y) != X --> Y != 0
9 # (X - Y) != X --> Y != 0
10 # (X ^ Y) != X --> Y != 0
12 # And all commuted cases.
17 tracksRegLiveness: true
21 ; CHECK-LABEL: name: add_scalar_eq
22 ; CHECK: liveins: $w0, $w1
24 ; CHECK-NEXT: %y:_(s32) = COPY $w1
25 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
26 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
27 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
28 ; CHECK-NEXT: $w0 = COPY %ext(s32)
29 ; CHECK-NEXT: RET_ReallyLR implicit $w0
32 %op:_(s32) = G_ADD %x, %y
33 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
34 %ext:_(s32) = G_ZEXT %cmp(s1)
36 RET_ReallyLR implicit $w0
40 tracksRegLiveness: true
44 ; CHECK-LABEL: name: add_vector_eq
45 ; CHECK: liveins: $q0, $q1
47 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
48 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
49 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
50 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
51 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
52 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
53 ; CHECK-NEXT: RET_ReallyLR implicit $d0
54 %x:_(<4 x s32>) = COPY $q0
55 %y:_(<4 x s32>) = COPY $q1
56 %op:_(<4 x s32>) = G_ADD %x, %y
57 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
58 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
59 $d0 = COPY %ext(<4 x s16>)
60 RET_ReallyLR implicit $d0
63 name: add_scalar_eq_commuted_in_op
64 tracksRegLiveness: true
68 ; CHECK-LABEL: name: add_scalar_eq_commuted_in_op
69 ; CHECK: liveins: $w0, $w1
71 ; CHECK-NEXT: %y:_(s32) = COPY $w1
72 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
73 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
74 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
75 ; CHECK-NEXT: $w0 = COPY %ext(s32)
76 ; CHECK-NEXT: RET_ReallyLR implicit $w0
79 %op:_(s32) = G_ADD %y, %x
80 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
81 %ext:_(s32) = G_ZEXT %cmp(s1)
83 RET_ReallyLR implicit $w0
86 name: add_vector_eq_commuted_in_op
87 tracksRegLiveness: true
91 ; CHECK-LABEL: name: add_vector_eq_commuted_in_op
92 ; CHECK: liveins: $q0, $q1
94 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
95 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
96 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
97 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
98 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
99 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
100 ; CHECK-NEXT: RET_ReallyLR implicit $d0
101 %x:_(<4 x s32>) = COPY $q0
102 %y:_(<4 x s32>) = COPY $q1
103 %op:_(<4 x s32>) = G_ADD %y, %x
104 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
105 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
106 $d0 = COPY %ext(<4 x s16>)
107 RET_ReallyLR implicit $d0
110 name: add_scalar_eq_commuted_in_cmp
111 tracksRegLiveness: true
115 ; CHECK-LABEL: name: add_scalar_eq_commuted_in_cmp
116 ; CHECK: liveins: $w0, $w1
118 ; CHECK-NEXT: %y:_(s32) = COPY $w1
119 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
120 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
121 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
122 ; CHECK-NEXT: $w0 = COPY %ext(s32)
123 ; CHECK-NEXT: RET_ReallyLR implicit $w0
126 %op:_(s32) = G_ADD %x, %y
127 %cmp:_(s1) = G_ICMP intpred(eq), %x(s32), %op
128 %ext:_(s32) = G_ZEXT %cmp(s1)
130 RET_ReallyLR implicit $w0
133 name: add_vector_eq_commuted_in_cmp
134 tracksRegLiveness: true
138 ; CHECK-LABEL: name: add_vector_eq_commuted_in_cmp
139 ; CHECK: liveins: $q0, $q1
141 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
142 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
143 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
144 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
145 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
146 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
147 ; CHECK-NEXT: RET_ReallyLR implicit $d0
148 %x:_(<4 x s32>) = COPY $q0
149 %y:_(<4 x s32>) = COPY $q1
150 %op:_(<4 x s32>) = G_ADD %x, %y
151 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %x(<4 x s32>), %op
152 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
153 $d0 = COPY %ext(<4 x s16>)
154 RET_ReallyLR implicit $d0
158 tracksRegLiveness: true
162 ; CHECK-LABEL: name: xor_scalar_eq
163 ; CHECK: liveins: $w0, $w1
165 ; CHECK-NEXT: %y:_(s32) = COPY $w1
166 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
167 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
168 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
169 ; CHECK-NEXT: $w0 = COPY %ext(s32)
170 ; CHECK-NEXT: RET_ReallyLR implicit $w0
173 %op:_(s32) = G_XOR %x, %y
174 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
175 %ext:_(s32) = G_ZEXT %cmp(s1)
177 RET_ReallyLR implicit $w0
181 tracksRegLiveness: true
185 ; CHECK-LABEL: name: xor_vector_eq
186 ; CHECK: liveins: $q0, $q1
188 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
189 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
190 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
191 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
192 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
193 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
194 ; CHECK-NEXT: RET_ReallyLR implicit $d0
195 %x:_(<4 x s32>) = COPY $q0
196 %y:_(<4 x s32>) = COPY $q1
197 %op:_(<4 x s32>) = G_XOR %x, %y
198 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
199 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
200 $d0 = COPY %ext(<4 x s16>)
201 RET_ReallyLR implicit $d0
204 name: xor_scalar_eq_commuted_in_op
205 tracksRegLiveness: true
209 ; CHECK-LABEL: name: xor_scalar_eq_commuted_in_op
210 ; CHECK: liveins: $w0, $w1
212 ; CHECK-NEXT: %y:_(s32) = COPY $w1
213 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
214 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
215 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
216 ; CHECK-NEXT: $w0 = COPY %ext(s32)
217 ; CHECK-NEXT: RET_ReallyLR implicit $w0
220 %op:_(s32) = G_XOR %y, %x
221 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
222 %ext:_(s32) = G_ZEXT %cmp(s1)
224 RET_ReallyLR implicit $w0
227 name: xor_vector_eq_commuted_in_op
228 tracksRegLiveness: true
232 ; CHECK-LABEL: name: xor_vector_eq_commuted_in_op
233 ; CHECK: liveins: $q0, $q1
235 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
236 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
237 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
238 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
239 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
240 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
241 ; CHECK-NEXT: RET_ReallyLR implicit $d0
242 %x:_(<4 x s32>) = COPY $q0
243 %y:_(<4 x s32>) = COPY $q1
244 %op:_(<4 x s32>) = G_XOR %y, %x
245 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
246 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
247 $d0 = COPY %ext(<4 x s16>)
248 RET_ReallyLR implicit $d0
251 name: xor_scalar_eq_commuted_in_cmp
252 tracksRegLiveness: true
256 ; CHECK-LABEL: name: xor_scalar_eq_commuted_in_cmp
257 ; CHECK: liveins: $w0, $w1
259 ; CHECK-NEXT: %y:_(s32) = COPY $w1
260 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
261 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
262 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
263 ; CHECK-NEXT: $w0 = COPY %ext(s32)
264 ; CHECK-NEXT: RET_ReallyLR implicit $w0
267 %op:_(s32) = G_XOR %x, %y
268 %cmp:_(s1) = G_ICMP intpred(eq), %x(s32), %op
269 %ext:_(s32) = G_ZEXT %cmp(s1)
271 RET_ReallyLR implicit $w0
274 name: xor_vector_eq_commuted_in_cmp
275 tracksRegLiveness: true
279 ; CHECK-LABEL: name: xor_vector_eq_commuted_in_cmp
280 ; CHECK: liveins: $q0, $q1
282 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
283 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
284 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
285 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
286 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
287 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
288 ; CHECK-NEXT: RET_ReallyLR implicit $d0
289 %x:_(<4 x s32>) = COPY $q0
290 %y:_(<4 x s32>) = COPY $q1
291 %op:_(<4 x s32>) = G_XOR %x, %y
292 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %x(<4 x s32>), %op
293 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
294 $d0 = COPY %ext(<4 x s16>)
295 RET_ReallyLR implicit $d0
299 tracksRegLiveness: true
303 ; CHECK-LABEL: name: sub_scalar_eq
304 ; CHECK: liveins: $w0, $w1
306 ; CHECK-NEXT: %y:_(s32) = COPY $w1
307 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
308 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
309 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
310 ; CHECK-NEXT: $w0 = COPY %ext(s32)
311 ; CHECK-NEXT: RET_ReallyLR implicit $w0
314 %op:_(s32) = G_SUB %x, %y
315 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
316 %ext:_(s32) = G_ZEXT %cmp(s1)
318 RET_ReallyLR implicit $w0
322 tracksRegLiveness: true
326 ; CHECK-LABEL: name: sub_vector_eq
327 ; CHECK: liveins: $q0, $q1
329 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
330 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
331 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
332 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
333 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
334 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
335 ; CHECK-NEXT: RET_ReallyLR implicit $d0
336 %x:_(<4 x s32>) = COPY $q0
337 %y:_(<4 x s32>) = COPY $q1
338 %op:_(<4 x s32>) = G_SUB %x, %y
339 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
340 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
341 $d0 = COPY %ext(<4 x s16>)
342 RET_ReallyLR implicit $d0
345 name: sub_scalar_eq_commuted_in_cmp
346 tracksRegLiveness: true
350 ; CHECK-LABEL: name: sub_scalar_eq_commuted_in_cmp
351 ; CHECK: liveins: $w0, $w1
353 ; CHECK-NEXT: %y:_(s32) = COPY $w1
354 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
355 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %y(s32), [[C]]
356 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
357 ; CHECK-NEXT: $w0 = COPY %ext(s32)
358 ; CHECK-NEXT: RET_ReallyLR implicit $w0
361 %op:_(s32) = G_SUB %x, %y
362 %cmp:_(s1) = G_ICMP intpred(eq), %x(s32), %op
363 %ext:_(s32) = G_ZEXT %cmp(s1)
365 RET_ReallyLR implicit $w0
368 name: sub_vector_eq_commuted_in_cmp
369 tracksRegLiveness: true
373 ; CHECK-LABEL: name: sub_vector_eq_commuted_in_cmp
374 ; CHECK: liveins: $q0, $q1
376 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
377 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
378 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
379 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %y(<4 x s32>), [[BUILD_VECTOR]]
380 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
381 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
382 ; CHECK-NEXT: RET_ReallyLR implicit $d0
383 %x:_(<4 x s32>) = COPY $q0
384 %y:_(<4 x s32>) = COPY $q1
385 %op:_(<4 x s32>) = G_SUB %x, %y
386 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %x(<4 x s32>), %op
387 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
388 $d0 = COPY %ext(<4 x s16>)
389 RET_ReallyLR implicit $d0
393 tracksRegLiveness: true
397 ; CHECK-LABEL: name: add_scalar_ne
398 ; CHECK: liveins: $w0, $w1
400 ; CHECK-NEXT: %y:_(s32) = COPY $w1
401 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
402 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
403 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
404 ; CHECK-NEXT: $w0 = COPY %ext(s32)
405 ; CHECK-NEXT: RET_ReallyLR implicit $w0
408 %op:_(s32) = G_ADD %x, %y
409 %cmp:_(s1) = G_ICMP intpred(ne), %op(s32), %x
410 %ext:_(s32) = G_ZEXT %cmp(s1)
412 RET_ReallyLR implicit $w0
416 tracksRegLiveness: true
420 ; CHECK-LABEL: name: add_vector_ne
421 ; CHECK: liveins: $q0, $q1
423 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
424 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
425 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
426 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
427 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
428 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
429 ; CHECK-NEXT: RET_ReallyLR implicit $d0
430 %x:_(<4 x s32>) = COPY $q0
431 %y:_(<4 x s32>) = COPY $q1
432 %op:_(<4 x s32>) = G_ADD %x, %y
433 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %op(<4 x s32>), %x
434 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
435 $d0 = COPY %ext(<4 x s16>)
436 RET_ReallyLR implicit $d0
439 name: add_scalar_ne_commuted_in_op
440 tracksRegLiveness: true
444 ; CHECK-LABEL: name: add_scalar_ne_commuted_in_op
445 ; CHECK: liveins: $w0, $w1
447 ; CHECK-NEXT: %y:_(s32) = COPY $w1
448 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
449 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
450 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
451 ; CHECK-NEXT: $w0 = COPY %ext(s32)
452 ; CHECK-NEXT: RET_ReallyLR implicit $w0
455 %op:_(s32) = G_ADD %y, %x
456 %cmp:_(s1) = G_ICMP intpred(ne), %op(s32), %x
457 %ext:_(s32) = G_ZEXT %cmp(s1)
459 RET_ReallyLR implicit $w0
462 name: add_vector_ne_commuted_in_op
463 tracksRegLiveness: true
467 ; CHECK-LABEL: name: add_vector_ne_commuted_in_op
468 ; CHECK: liveins: $q0, $q1
470 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
471 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
472 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
473 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
474 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
475 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
476 ; CHECK-NEXT: RET_ReallyLR implicit $d0
477 %x:_(<4 x s32>) = COPY $q0
478 %y:_(<4 x s32>) = COPY $q1
479 %op:_(<4 x s32>) = G_ADD %y, %x
480 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %op(<4 x s32>), %x
481 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
482 $d0 = COPY %ext(<4 x s16>)
483 RET_ReallyLR implicit $d0
486 name: add_scalar_ne_commuted_in_cmp
487 tracksRegLiveness: true
491 ; CHECK-LABEL: name: add_scalar_ne_commuted_in_cmp
492 ; CHECK: liveins: $w0, $w1
494 ; CHECK-NEXT: %y:_(s32) = COPY $w1
495 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
496 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
497 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
498 ; CHECK-NEXT: $w0 = COPY %ext(s32)
499 ; CHECK-NEXT: RET_ReallyLR implicit $w0
502 %op:_(s32) = G_ADD %x, %y
503 %cmp:_(s1) = G_ICMP intpred(ne), %x(s32), %op
504 %ext:_(s32) = G_ZEXT %cmp(s1)
506 RET_ReallyLR implicit $w0
509 name: add_vector_ne_commuted_in_cmp
510 tracksRegLiveness: true
514 ; CHECK-LABEL: name: add_vector_ne_commuted_in_cmp
515 ; CHECK: liveins: $q0, $q1
517 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
518 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
519 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
520 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
521 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
522 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
523 ; CHECK-NEXT: RET_ReallyLR implicit $d0
524 %x:_(<4 x s32>) = COPY $q0
525 %y:_(<4 x s32>) = COPY $q1
526 %op:_(<4 x s32>) = G_ADD %x, %y
527 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %x(<4 x s32>), %op
528 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
529 $d0 = COPY %ext(<4 x s16>)
530 RET_ReallyLR implicit $d0
534 tracksRegLiveness: true
538 ; CHECK-LABEL: name: xor_scalar_ne
539 ; CHECK: liveins: $w0, $w1
541 ; CHECK-NEXT: %y:_(s32) = COPY $w1
542 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
543 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
544 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
545 ; CHECK-NEXT: $w0 = COPY %ext(s32)
546 ; CHECK-NEXT: RET_ReallyLR implicit $w0
549 %op:_(s32) = G_XOR %x, %y
550 %cmp:_(s1) = G_ICMP intpred(ne), %op(s32), %x
551 %ext:_(s32) = G_ZEXT %cmp(s1)
553 RET_ReallyLR implicit $w0
557 tracksRegLiveness: true
561 ; CHECK-LABEL: name: xor_vector_ne
562 ; CHECK: liveins: $q0, $q1
564 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
565 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
566 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
567 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
568 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
569 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
570 ; CHECK-NEXT: RET_ReallyLR implicit $d0
571 %x:_(<4 x s32>) = COPY $q0
572 %y:_(<4 x s32>) = COPY $q1
573 %op:_(<4 x s32>) = G_XOR %x, %y
574 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %op(<4 x s32>), %x
575 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
576 $d0 = COPY %ext(<4 x s16>)
577 RET_ReallyLR implicit $d0
580 name: xor_scalar_ne_commuted_in_op
581 tracksRegLiveness: true
585 ; CHECK-LABEL: name: xor_scalar_ne_commuted_in_op
586 ; CHECK: liveins: $w0, $w1
588 ; CHECK-NEXT: %y:_(s32) = COPY $w1
589 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
590 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
591 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
592 ; CHECK-NEXT: $w0 = COPY %ext(s32)
593 ; CHECK-NEXT: RET_ReallyLR implicit $w0
596 %op:_(s32) = G_XOR %y, %x
597 %cmp:_(s1) = G_ICMP intpred(ne), %op(s32), %x
598 %ext:_(s32) = G_ZEXT %cmp(s1)
600 RET_ReallyLR implicit $w0
603 name: xor_vector_ne_commuted_in_op
604 tracksRegLiveness: true
608 ; CHECK-LABEL: name: xor_vector_ne_commuted_in_op
609 ; CHECK: liveins: $q0, $q1
611 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
612 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
613 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
614 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
615 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
616 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
617 ; CHECK-NEXT: RET_ReallyLR implicit $d0
618 %x:_(<4 x s32>) = COPY $q0
619 %y:_(<4 x s32>) = COPY $q1
620 %op:_(<4 x s32>) = G_XOR %y, %x
621 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %op(<4 x s32>), %x
622 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
623 $d0 = COPY %ext(<4 x s16>)
624 RET_ReallyLR implicit $d0
627 name: xor_scalar_ne_commuted_in_cmp
628 tracksRegLiveness: true
632 ; CHECK-LABEL: name: xor_scalar_ne_commuted_in_cmp
633 ; CHECK: liveins: $w0, $w1
635 ; CHECK-NEXT: %y:_(s32) = COPY $w1
636 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
637 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
638 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
639 ; CHECK-NEXT: $w0 = COPY %ext(s32)
640 ; CHECK-NEXT: RET_ReallyLR implicit $w0
643 %op:_(s32) = G_XOR %x, %y
644 %cmp:_(s1) = G_ICMP intpred(ne), %x(s32), %op
645 %ext:_(s32) = G_ZEXT %cmp(s1)
647 RET_ReallyLR implicit $w0
650 name: xor_vector_ne_commuted_in_cmp
651 tracksRegLiveness: true
655 ; CHECK-LABEL: name: xor_vector_ne_commuted_in_cmp
656 ; CHECK: liveins: $q0, $q1
658 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
659 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
660 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
661 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
662 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
663 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
664 ; CHECK-NEXT: RET_ReallyLR implicit $d0
665 %x:_(<4 x s32>) = COPY $q0
666 %y:_(<4 x s32>) = COPY $q1
667 %op:_(<4 x s32>) = G_XOR %x, %y
668 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %x(<4 x s32>), %op
669 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
670 $d0 = COPY %ext(<4 x s16>)
671 RET_ReallyLR implicit $d0
675 tracksRegLiveness: true
679 ; CHECK-LABEL: name: sub_scalar_ne
680 ; CHECK: liveins: $w0, $w1
682 ; CHECK-NEXT: %y:_(s32) = COPY $w1
683 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
684 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
685 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
686 ; CHECK-NEXT: $w0 = COPY %ext(s32)
687 ; CHECK-NEXT: RET_ReallyLR implicit $w0
690 %op:_(s32) = G_SUB %x, %y
691 %cmp:_(s1) = G_ICMP intpred(ne), %op(s32), %x
692 %ext:_(s32) = G_ZEXT %cmp(s1)
694 RET_ReallyLR implicit $w0
698 tracksRegLiveness: true
702 ; CHECK-LABEL: name: sub_vector_ne
703 ; CHECK: liveins: $q0, $q1
705 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
706 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
707 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
708 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
709 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
710 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
711 ; CHECK-NEXT: RET_ReallyLR implicit $d0
712 %x:_(<4 x s32>) = COPY $q0
713 %y:_(<4 x s32>) = COPY $q1
714 %op:_(<4 x s32>) = G_SUB %x, %y
715 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %op(<4 x s32>), %x
716 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
717 $d0 = COPY %ext(<4 x s16>)
718 RET_ReallyLR implicit $d0
721 name: sub_scalar_ne_commuted_in_cmp
722 tracksRegLiveness: true
726 ; CHECK-LABEL: name: sub_scalar_ne_commuted_in_cmp
727 ; CHECK: liveins: $w0, $w1
729 ; CHECK-NEXT: %y:_(s32) = COPY $w1
730 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
731 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(ne), %y(s32), [[C]]
732 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
733 ; CHECK-NEXT: $w0 = COPY %ext(s32)
734 ; CHECK-NEXT: RET_ReallyLR implicit $w0
737 %op:_(s32) = G_SUB %x, %y
738 %cmp:_(s1) = G_ICMP intpred(ne), %x(s32), %op
739 %ext:_(s32) = G_ZEXT %cmp(s1)
741 RET_ReallyLR implicit $w0
744 name: sub_vector_ne_commuted_in_cmp
745 tracksRegLiveness: true
749 ; CHECK-LABEL: name: sub_vector_ne_commuted_in_cmp
750 ; CHECK: liveins: $q0, $q1
752 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
753 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
754 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
755 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %y(<4 x s32>), [[BUILD_VECTOR]]
756 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
757 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
758 ; CHECK-NEXT: RET_ReallyLR implicit $d0
759 %x:_(<4 x s32>) = COPY $q0
760 %y:_(<4 x s32>) = COPY $q1
761 %op:_(<4 x s32>) = G_SUB %x, %y
762 %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %x(<4 x s32>), %op
763 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
764 $d0 = COPY %ext(<4 x s16>)
765 RET_ReallyLR implicit $d0
768 name: dont_combine_sub_scalar_eq_commuted_in_op
769 tracksRegLiveness: true
773 ; CHECK-LABEL: name: dont_combine_sub_scalar_eq_commuted_in_op
774 ; CHECK: liveins: $w0, $w1
776 ; CHECK-NEXT: %x:_(s32) = COPY $w0
777 ; CHECK-NEXT: %y:_(s32) = COPY $w1
778 ; CHECK-NEXT: %op:_(s32) = G_SUB %y, %x
779 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
780 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
781 ; CHECK-NEXT: $w0 = COPY %ext(s32)
782 ; CHECK-NEXT: RET_ReallyLR implicit $w0
785 %op:_(s32) = G_SUB %y, %x
786 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %x
787 %ext:_(s32) = G_ZEXT %cmp(s1)
789 RET_ReallyLR implicit $w0
792 name: dont_combine_sub_vector_eq_commuted_in_op
793 tracksRegLiveness: true
797 ; CHECK-LABEL: name: dont_combine_sub_vector_eq_commuted_in_op
798 ; CHECK: liveins: $q0, $q1
800 ; CHECK-NEXT: %x:_(<4 x s32>) = COPY $q0
801 ; CHECK-NEXT: %y:_(<4 x s32>) = COPY $q1
802 ; CHECK-NEXT: %op:_(<4 x s32>) = G_SUB %y, %x
803 ; CHECK-NEXT: %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
804 ; CHECK-NEXT: %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
805 ; CHECK-NEXT: $d0 = COPY %ext(<4 x s16>)
806 ; CHECK-NEXT: RET_ReallyLR implicit $d0
807 %x:_(<4 x s32>) = COPY $q0
808 %y:_(<4 x s32>) = COPY $q1
809 %op:_(<4 x s32>) = G_SUB %y, %x
810 %cmp:_(<4 x s1>) = G_ICMP intpred(eq), %op(<4 x s32>), %x
811 %ext:_(<4 x s16>) = G_ANYEXT %cmp(<4 x s1>)
812 $d0 = COPY %ext(<4 x s16>)
813 RET_ReallyLR implicit $d0
816 name: dont_combine_not_equality
817 tracksRegLiveness: true
821 ; CHECK-LABEL: name: dont_combine_not_equality
822 ; CHECK: liveins: $w0, $w1
824 ; CHECK-NEXT: %x:_(s32) = COPY $w0
825 ; CHECK-NEXT: %y:_(s32) = COPY $w1
826 ; CHECK-NEXT: %op:_(s32) = G_ADD %x, %y
827 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(slt), %op(s32), %x
828 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
829 ; CHECK-NEXT: $w0 = COPY %ext(s32)
830 ; CHECK-NEXT: RET_ReallyLR implicit $w0
833 %op:_(s32) = G_ADD %x, %y
834 %cmp:_(s1) = G_ICMP intpred(slt), %op(s32), %x
835 %ext:_(s32) = G_ZEXT %cmp(s1)
837 RET_ReallyLR implicit $w0
840 name: dont_combine_unique_operands
841 tracksRegLiveness: true
844 liveins: $w0, $w1, $w2
845 ; CHECK-LABEL: name: dont_combine_unique_operands
846 ; CHECK: liveins: $w0, $w1, $w2
848 ; CHECK-NEXT: %x:_(s32) = COPY $w0
849 ; CHECK-NEXT: %y:_(s32) = COPY $w1
850 ; CHECK-NEXT: %z:_(s32) = COPY $w2
851 ; CHECK-NEXT: %op:_(s32) = G_ADD %x, %y
852 ; CHECK-NEXT: %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %z
853 ; CHECK-NEXT: %ext:_(s32) = G_ZEXT %cmp(s1)
854 ; CHECK-NEXT: $w0 = COPY %ext(s32)
855 ; CHECK-NEXT: RET_ReallyLR implicit $w0
859 %op:_(s32) = G_ADD %x, %y
860 %cmp:_(s1) = G_ICMP intpred(eq), %op(s32), %z
861 %ext:_(s32) = G_ZEXT %cmp(s1)
863 RET_ReallyLR implicit $w0