# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py # RUN: llc -debugify-and-strip-all-safe -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombinerhelper-only-enable-rule="icmp_to_true_false_known_bits" -global-isel -verify-machineinstrs %s -o - | FileCheck %s # REQUIRES: asserts --- | define i1 @eq_true(i32* %ptr) { unreachable } define i1 @ne_true(i32* %ptr) { unreachable } define i1 @sge_true(i32* %ptr) { unreachable } define i1 @sgt_true(i32* %ptr) { unreachable } define i1 @sle_true(i32* %ptr) { unreachable } define i1 @slt_true(i32* %ptr) { unreachable } define i1 @uge_true(i32* %ptr) { unreachable } define i1 @ugt_true(i32* %ptr) { unreachable } define i1 @ule_true(i32* %ptr) { unreachable } define i1 @ult_true(i32* %ptr) { unreachable } define i1 @eq_false(i32* %ptr) { unreachable } define i1 @ne_false(i32* %ptr) { unreachable } define i1 @sge_false(i32* %ptr) { unreachable } define i1 @sgt_false(i32* %ptr) { unreachable } define i1 @sle_false(i32* %ptr) { unreachable } define i1 @slt_false(i32* %ptr) { unreachable } define i1 @uge_false(i32* %ptr) { unreachable } define i1 @ugt_false(i32* %ptr) { unreachable } define i1 @ule_false(i32* %ptr) { unreachable } define i1 @ult_false(i32* %ptr) { unreachable } define i1 @eq_unknown(i32* %ptr) { unreachable } define i1 @ne_unknown(i32* %ptr) { unreachable } define i1 @vector_true(i32* %ptr) { unreachable } define i1 @vector_false(i32* %ptr) { unreachable } !0 = !{i32 1, i32 2} !1 = !{i32 1, i32 3} ... --- name: eq_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: eq_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %cmp:_(s1) = G_ICMP intpred(eq), %cst(s32), %cst %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ne_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ne_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst_1:_(s32) = G_CONSTANT i32 1 %cst_2:_(s32) = G_CONSTANT i32 2 %cmp:_(s1) = G_ICMP intpred(ne), %cst_1(s32), %cst_2 %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: sge_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: sge_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 2 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(sge), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: sgt_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: sgt_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 3 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(sgt), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: sle_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: sle_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(sle), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: slt_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: slt_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 -1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(slt), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: uge_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: uge_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 2 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(uge), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ugt_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ugt_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 -1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(ugt), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ule_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ule_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(ule), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ult_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ult_true ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 0 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(ule), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: eq_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: eq_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 0 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(eq), %load_eq_1(s32), %cst %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ne_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ne_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst_1:_(s32) = G_CONSTANT i32 1 %cst_2:_(s32) = G_CONSTANT i32 1 %cmp:_(s1) = G_ICMP intpred(ne), %cst_1(s32), %cst_2 %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: sge_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: sge_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 -1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(sge), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: sgt_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: sgt_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(sgt), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: sle_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: sle_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 3 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(sle), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: slt_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: slt_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 2 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(slt), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: uge_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: uge_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 0 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(uge), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ugt_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ugt_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(ugt), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ule_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ule_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 -1 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(ule), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ult_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ult_false ; CHECK: liveins: $x0 ; CHECK: %cmp:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 2 %load_eq_1:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !0) %cmp:_(s1) = G_ICMP intpred(ule), %cst, %load_eq_1(s32) %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: eq_unknown tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: eq_unknown ; CHECK: liveins: $x0 ; CHECK: %ptr:_(p0) = COPY $x0 ; CHECK: %cst:_(s32) = G_CONSTANT i32 1 ; CHECK: %load_between_1_2:_(s32) = G_LOAD %ptr(p0) :: (load (s32), ; CHECK: %cmp:_(s1) = G_ICMP intpred(eq), %load_between_1_2(s32), %cst ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %load_between_1_2:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !1) %cmp:_(s1) = G_ICMP intpred(eq), %load_between_1_2(s32), %cst %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: ne_unknown tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: ne_unknown ; CHECK: liveins: $x0 ; CHECK: %ptr:_(p0) = COPY $x0 ; CHECK: %cst:_(s32) = G_CONSTANT i32 1 ; CHECK: %load_between_1_2:_(s32) = G_LOAD %ptr(p0) :: (load (s32), ; CHECK: %cmp:_(s1) = G_ICMP intpred(ne), %load_between_1_2(s32), %cst ; CHECK: %cmp_ext:_(s32) = G_ZEXT %cmp(s1) ; CHECK: $w0 = COPY %cmp_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %load_between_1_2:_(s32) = G_LOAD %ptr(p0) :: (load (s32), !range !1) %cmp:_(s1) = G_ICMP intpred(ne), %load_between_1_2(s32), %cst %cmp_ext:_(s32) = G_ZEXT %cmp(s1) $w0 = COPY %cmp_ext(s32) RET_ReallyLR implicit $w0 ... --- name: vector_true tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: vector_true ; CHECK: liveins: $x0 ; CHECK: %cst:_(s32) = G_CONSTANT i32 1 ; CHECK: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true ; CHECK: %cmp:_(<2 x s1>) = G_BUILD_VECTOR [[C]](s1), [[C]](s1) ; CHECK: %extract:_(s1) = G_EXTRACT_VECTOR_ELT %cmp(<2 x s1>), %cst(s32) ; CHECK: %extract_ext:_(s32) = G_ZEXT %extract(s1) ; CHECK: $w0 = COPY %extract_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %bv:_(<2 x s32>) = G_BUILD_VECTOR %cst, %cst %cmp:_(<2 x s1>) = G_ICMP intpred(eq), %bv(<2 x s32>), %bv %extract:_(s1) = G_EXTRACT_VECTOR_ELT %cmp(<2 x s1>), %cst(s32) %extract_ext:_(s32) = G_ZEXT %extract(s1) $w0 = COPY %extract_ext(s32) RET_ReallyLR implicit $w0 ... --- name: vector_false tracksRegLiveness: true body: | bb.0: liveins: $x0 ; CHECK-LABEL: name: vector_false ; CHECK: liveins: $x0 ; CHECK: %cst:_(s32) = G_CONSTANT i32 1 ; CHECK: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 false ; CHECK: %cmp:_(<2 x s1>) = G_BUILD_VECTOR [[C]](s1), [[C]](s1) ; CHECK: %extract:_(s1) = G_EXTRACT_VECTOR_ELT %cmp(<2 x s1>), %cst(s32) ; CHECK: %extract_ext:_(s32) = G_ZEXT %extract(s1) ; CHECK: $w0 = COPY %extract_ext(s32) ; CHECK: RET_ReallyLR implicit $w0 %ptr:_(p0) = COPY $x0 %cst:_(s32) = G_CONSTANT i32 1 %bv:_(<2 x s32>) = G_BUILD_VECTOR %cst, %cst %cmp:_(<2 x s1>) = G_ICMP intpred(ne), %bv(<2 x s32>), %bv %extract:_(s1) = G_EXTRACT_VECTOR_ELT %cmp(<2 x s1>), %cst(s32) %extract_ext:_(s32) = G_ZEXT %extract(s1) $w0 = COPY %extract_ext(s32) RET_ReallyLR implicit $w0