diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp index f55e756e64104..b6c212e068f03 100644 --- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp +++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp @@ -85,5 +85,17 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) { .widenScalarToNextPow2(0) .clampScalar(0, XLenLLT, XLenLLT); + getActionDefinitionsBuilder(G_ICMP) + .legalFor({{XLenLLT, XLenLLT}}) + .widenScalarToNextPow2(1) + .clampScalar(1, XLenLLT, XLenLLT) + .clampScalar(0, XLenLLT, XLenLLT); + + getActionDefinitionsBuilder(G_SELECT) + .legalFor({{XLenLLT, XLenLLT}}) + .widenScalarToNextPow2(0) + .clampScalar(0, XLenLLT, XLenLLT) + .clampScalar(1, XLenLLT, XLenLLT); + getLegacyLegalizerInfo().computeTables(); } diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-icmp.mir b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-icmp.mir new file mode 100644 index 0000000000000..892063725f822 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-icmp.mir @@ -0,0 +1,1627 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \ +# RUN: | FileCheck %s +--- +name: cmp_sgt_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 7 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 7 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sgt), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sgt), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sgt), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(sgt), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xhi, [[C]](s32) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %xlo, [[C1]](s32) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %xhi, [[C2]](s32) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[SHL]], [[C3]](s32) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[OR]], [[C4]](s32) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[OR]], [[C3]](s32) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s32) = G_SHL %yhi, [[C5]](s32) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s32) = G_SHL %ylo, [[C6]](s32) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR %yhi, [[C7]](s32) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s32) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s32) = G_LSHR [[SHL3]], [[C8]](s32) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s32) = G_SHL [[OR2]], [[C9]](s32) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s32) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[OR2]], [[C8]](s32) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[OR1]](s32), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(sgt), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sgt), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(sgt), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 7 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 7 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(slt), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(slt), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(slt), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(slt), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xhi, [[C]](s32) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %xlo, [[C1]](s32) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %xhi, [[C2]](s32) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[SHL]], [[C3]](s32) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[OR]], [[C4]](s32) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[OR]], [[C3]](s32) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s32) = G_SHL %yhi, [[C5]](s32) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s32) = G_SHL %ylo, [[C6]](s32) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR %yhi, [[C7]](s32) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s32) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s32) = G_LSHR [[SHL3]], [[C8]](s32) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s32) = G_SHL [[OR2]], [[C9]](s32) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s32) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[OR2]], [[C8]](s32) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[OR1]](s32), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(slt), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(slt), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 7 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 7 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sge), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sge), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sge), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(sge), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xhi, [[C]](s32) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %xlo, [[C1]](s32) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %xhi, [[C2]](s32) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[SHL]], [[C3]](s32) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[OR]], [[C4]](s32) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[OR]], [[C3]](s32) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s32) = G_SHL %yhi, [[C5]](s32) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s32) = G_SHL %ylo, [[C6]](s32) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR %yhi, [[C7]](s32) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s32) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s32) = G_LSHR [[SHL3]], [[C8]](s32) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s32) = G_SHL [[OR2]], [[C9]](s32) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s32) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[OR2]], [[C8]](s32) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[OR1]](s32), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(sge), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(sge), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 7 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 7 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sle), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sle), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sle), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sle), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sle), [[SEXT_INREG]](s32), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(sle), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sle), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(sle), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xhi, [[C]](s32) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %xlo, [[C1]](s32) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %xhi, [[C2]](s32) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[SHL]], [[C3]](s32) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[OR]], [[C4]](s32) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[OR]], [[C3]](s32) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s32) = G_SHL %yhi, [[C5]](s32) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s32) = G_SHL %ylo, [[C6]](s32) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR %yhi, [[C7]](s32) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s32) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s32) = G_LSHR [[SHL3]], [[C8]](s32) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s32) = G_SHL [[OR2]], [[C9]](s32) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s32) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[OR2]], [[C8]](s32) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sle), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[ASHR]](s32), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[OR1]](s32), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(sle), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sle), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(sle), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ugt), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ugt), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ugt), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ugt), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[AND]](s32), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND4]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(ugt), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(ugt), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ult), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ult), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ult), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ult), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND]](s32), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND4]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(ult), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(sge), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(sge), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(uge), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(uge), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(uge), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(uge), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), [[AND]](s32), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND4]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(uge), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(uge), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(uge), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ule), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ule), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ule), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ule), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND1]](s32), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), [[AND]](s32), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND4]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(ule), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %xlo(s32), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ule), %xhi(s32), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(ule), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(eq), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(eq), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(eq), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(eq), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[AND]], [[AND2]] + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s32) = G_XOR [[AND1]], [[AND3]] + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[OR]](s32), [[C4]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(eq), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR %xhi, %yhi + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s32) = G_XOR %xlo, %ylo + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[OR]](s32), [[C]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(eq), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s7) = G_TRUNC %0(s32) + %3:_(s7) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ne), %2(s7), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s32) + %3:_(s8) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ne), %2(s8), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[AND]](s32), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s32) + %3:_(s16) = G_TRUNC %1(s32) + %4:_(s1) = G_ICMP intpred(ne), %2(s16), %3 + %5:_(s32) = G_ANYEXT %4(s1) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[COPY]](s32), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ne), %0(s32), %1 + %3:_(s32) = G_ANYEXT %2(s1) + $x10 = COPY %3(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[AND]], [[AND2]] + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s32) = G_XOR [[AND1]], [[AND3]] + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[OR]](s32), [[C4]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %z:_(s1) = G_ICMP intpred(ne), %x(s48), %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR %xhi, %yhi + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s32) = G_XOR %xlo, %ylo + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[OR]](s32), [[C]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %z:_(s1) = G_ICMP intpred(ne), %x, %y + %z0:_(s32) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s32) + PseudoRET implicit $x10 + +... diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-select.mir b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-select.mir new file mode 100644 index 0000000000000..b2da9fddd04a8 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-select.mir @@ -0,0 +1,201 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \ +# RUN: | FileCheck %s +--- +name: select_i7 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i7 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s7) = G_TRUNC %0(s32) + %4:_(s7) = G_TRUNC %1(s32) + %5:_(s1) = G_TRUNC %2(s32) + %6:_(s7) = G_SELECT %5(s1), %3(s7), %4 + %7:_(s32) = G_ANYEXT %6(s7) + $x10 = COPY %7(s32) + PseudoRET implicit $x10 + +... +--- +name: select_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s8) = G_TRUNC %0(s32) + %4:_(s8) = G_TRUNC %1(s32) + %5:_(s1) = G_TRUNC %2(s32) + %6:_(s8) = G_SELECT %5(s1), %3(s8), %4 + %7:_(s32) = G_ANYEXT %6(s8) + $x10 = COPY %7(s32) + PseudoRET implicit $x10 + +... +--- +name: select_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s16) = G_TRUNC %0(s32) + %4:_(s16) = G_TRUNC %1(s32) + %5:_(s1) = G_TRUNC %2(s32) + %6:_(s16) = G_SELECT %5(s1), %3(s16), %4 + %7:_(s32) = G_ANYEXT %6(s16) + $x10 = COPY %7(s32) + PseudoRET implicit $x10 + +... +--- +name: select_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s1) = G_TRUNC %2(s32) + %4:_(s32) = G_SELECT %3(s1), %0(s32), %1(s32) + $x10 = COPY %4(s32) + PseudoRET implicit $x10 + +... +--- +name: select_i48 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i48 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: %c0:_(s32) = COPY $x14 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %c0, [[C1]] + ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), %xlo, %ylo + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %c0:_(s32) = COPY $x14 + %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %x:_(s48) = G_TRUNC %x0(s64) + %y:_(s48) = G_TRUNC %y0(s64) + %c:_(s1) = G_TRUNC %c0(s32) + %z:_(s48) = G_SELECT %c(s1), %x(s48), %y + %z0:_(s64) = G_ANYEXT %z(s48) + %zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z0(s64) + $x10 = COPY %zhi(s32) + $x11 = COPY %zlo(s32) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: select_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i64 + ; CHECK: %xhi:_(s32) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 + ; CHECK-NEXT: %c0:_(s32) = COPY $x14 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %c0, [[C1]] + ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), %xlo, %ylo + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) + ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32) + ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 + %xhi:_(s32) = COPY $x10 + %xlo:_(s32) = COPY $x11 + %yhi:_(s32) = COPY $x12 + %ylo:_(s32) = COPY $x13 + %c0:_(s32) = COPY $x14 + %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) + %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) + %c:_(s1) = G_TRUNC %c0(s32) + %z:_(s64) = G_SELECT %c(s1), %x(s64), %y + %zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z(s64) + $x10 = COPY %zhi(s32) + $x11 = COPY %zlo(s32) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: select_i96 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i96 + ; CHECK: %yhi:_(s32) = COPY $x13 + ; CHECK-NEXT: %ymid:_(s32) = COPY $x14 + ; CHECK-NEXT: %ylo:_(s32) = COPY $x15 + ; CHECK-NEXT: $x10 = COPY %yhi(s32) + ; CHECK-NEXT: $x11 = COPY %ymid(s32) + ; CHECK-NEXT: $x12 = COPY %ylo(s32) + ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12 + %xhi:_(s32) = COPY $x10 + %xmid:_(s32) = COPY $x11 + %xlo:_(s32) = COPY $x12 + %yhi:_(s32) = COPY $x13 + %ymid:_(s32) = COPY $x14 + %ylo:_(s32) = COPY $x15 + %c0:_(s32) = COPY $x16 + %x:_(s96) = G_MERGE_VALUES %xhi(s32), %xmid(s32), %xlo(s32) + %y:_(s96) = G_MERGE_VALUES %yhi(s32), %ymid(s32), %ylo(s32) + %c:_(s1) = G_TRUNC %c0(s32) + %z:_(s96) = G_SELECT %c(s1), %x(s96), %y + %zhi:_(s32), %zmid:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %y(s96) + $x10 = COPY %zhi(s32) + $x11 = COPY %zmid(s32) + $x12 = COPY %zlo(s32) + PseudoRET implicit $x10, implicit $x11, implicit $x12 + +... diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv64/legalize-icmp.mir b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv64/legalize-icmp.mir new file mode 100644 index 0000000000000..b5e81e68b9f69 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv64/legalize-icmp.mir @@ -0,0 +1,1859 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \ +# RUN: | FileCheck %s +--- +name: cmp_sgt_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sgt), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 15 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 15 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sgt), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sgt), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sgt), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(sgt), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %xlo, [[C1]](s64) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR %xhi, [[C2]](s64) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[SHL]], [[C3]](s64) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[OR]], [[C4]](s64) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[OR]], [[C3]](s64) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C5]](s64) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s64) = G_SHL %ylo, [[C6]](s64) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR %yhi, [[C7]](s64) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s64) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s64) = G_LSHR [[SHL3]], [[C8]](s64) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s64) = G_SHL [[OR2]], [[C9]](s64) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s64) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[OR2]], [[C8]](s64) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[OR1]](s64), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(sgt), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sgt_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sgt_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sgt), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(sgt), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(slt), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 15 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 15 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(slt), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(slt), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(slt), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(slt), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %xlo, [[C1]](s64) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR %xhi, [[C2]](s64) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[SHL]], [[C3]](s64) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[OR]], [[C4]](s64) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[OR]], [[C3]](s64) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C5]](s64) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s64) = G_SHL %ylo, [[C6]](s64) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR %yhi, [[C7]](s64) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s64) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s64) = G_LSHR [[SHL3]], [[C8]](s64) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s64) = G_SHL [[OR2]], [[C9]](s64) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s64) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[OR2]], [[C8]](s64) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[OR1]](s64), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(sge), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_slt_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_slt_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(slt), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(slt), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sge), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 15 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 15 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sge), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sge), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sge), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(sge), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %xlo, [[C1]](s64) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR %xhi, [[C2]](s64) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[SHL]], [[C3]](s64) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[OR]], [[C4]](s64) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[OR]], [[C3]](s64) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C5]](s64) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s64) = G_SHL %ylo, [[C6]](s64) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR %yhi, [[C7]](s64) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s64) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s64) = G_LSHR [[SHL3]], [[C8]](s64) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s64) = G_SHL [[OR2]], [[C9]](s64) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s64) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[OR2]], [[C8]](s64) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[OR1]](s64), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(sge), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sge_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sge_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(sge), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 8 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sle), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 15 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 15 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sle), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 16 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 16 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sle), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32 + ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), [[SEXT_INREG]](s64), [[SEXT_INREG1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(sle), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(sle), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64) + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %xlo, [[C1]](s64) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR %xhi, [[C2]](s64) + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]] + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[SHL]], [[C3]](s64) + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[OR]], [[C4]](s64) + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL2]] + ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[OR]], [[C3]](s64) + ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C5]](s64) + ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s64) = G_SHL %ylo, [[C6]](s64) + ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR %yhi, [[C7]](s64) + ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s64) = G_OR [[SHL4]], [[LSHR2]] + ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 56 + ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s64) = G_LSHR [[SHL3]], [[C8]](s64) + ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 8 + ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s64) = G_SHL [[OR2]], [[C9]](s64) + ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s64) = G_OR [[LSHR3]], [[SHL5]] + ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[OR2]], [[C8]](s64) + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[ASHR]](s64), [[ASHR1]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[OR1]](s64), [[OR3]] + ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C10]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(sle), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_sle_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_sle_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sle), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(sle), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ugt), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ugt), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ugt), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ugt), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ugt), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[AND]](s64), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND4]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(ugt), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ugt_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ugt_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(ugt), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ult), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ult), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ult), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ult), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ult), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[AND]](s64), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND4]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(ult), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ult_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ult_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(sge), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(sge), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(uge), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(uge), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(uge), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(uge), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(uge), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), [[AND]](s64), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND4]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(uge), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_uge_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_uge_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(uge), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(uge), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ule), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ule), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ule), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ule), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ule), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND1]](s64), [[AND3]] + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), [[AND]](s64), [[AND2]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C4]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND4]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(ule), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ule_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ule_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), %xlo(s64), %ylo + ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(ule), %xhi(s64), %yhi + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP1]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[ICMP2]], [[ICMP]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(ule), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(eq), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(eq), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(eq), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(eq), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(eq), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[AND]], [[AND2]] + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s64) = G_XOR [[AND1]], [[AND3]] + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[OR]](s64), [[C4]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(eq), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_eq_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_eq_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR %xhi, %yhi + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s64) = G_XOR %xlo, %ylo + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[OR]](s64), [[C]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(eq), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s8) = G_TRUNC %0(s64) + %3:_(s8) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ne), %2(s8), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s15) = G_TRUNC %0(s64) + %3:_(s15) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ne), %2(s15), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s16) = G_TRUNC %0(s64) + %3:_(s16) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ne), %2(s16), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[AND]](s64), [[AND1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s32) = G_TRUNC %0(s64) + %3:_(s32) = G_TRUNC %1(s64) + %4:_(s1) = G_ICMP intpred(ne), %2(s32), %3 + %5:_(s64) = G_ANYEXT %4(s1) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[COPY]](s64), [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s1) = G_ICMP intpred(ne), %0(s64), %1 + %3:_(s64) = G_ANYEXT %2(s1) + $x10 = COPY %3(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xhi, [[C]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xlo, [[C1]] + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255 + ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %yhi, [[C2]] + ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %ylo, [[C3]] + ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[AND]], [[AND2]] + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s64) = G_XOR [[AND1]], [[AND3]] + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[OR]](s64), [[C4]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %z:_(s1) = G_ICMP intpred(ne), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... +--- +name: cmp_ne_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: cmp_ne_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR %xhi, %yhi + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s64) = G_XOR %xlo, %ylo + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[XOR]], [[XOR1]] + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ne), [[OR]](s64), [[C]] + ; CHECK-NEXT: $x10 = COPY [[ICMP]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %z:_(s1) = G_ICMP intpred(ne), %x, %y + %z0:_(s64) = G_ANYEXT %z(s1) + $x10 = COPY %z0(s64) + PseudoRET implicit $x10 + +... diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv64/legalize-select.mir b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv64/legalize-select.mir new file mode 100644 index 0000000000000..c5f53df25e78c --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv64/legalize-select.mir @@ -0,0 +1,226 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \ +# RUN: | FileCheck %s +--- +name: select_i8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i8 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s8) = G_TRUNC %0(s64) + %4:_(s8) = G_TRUNC %1(s64) + %5:_(s1) = G_TRUNC %2(s64) + %6:_(s8) = G_SELECT %5(s1), %3(s8), %4 + %7:_(s64) = G_ANYEXT %6(s8) + $x10 = COPY %7(s64) + PseudoRET implicit $x10 + +... +--- +name: select_i15 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i15 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s15) = G_TRUNC %0(s64) + %4:_(s15) = G_TRUNC %1(s64) + %5:_(s1) = G_TRUNC %2(s64) + %6:_(s15) = G_SELECT %5(s1), %3(s15), %4 + %7:_(s64) = G_ANYEXT %6(s15) + $x10 = COPY %7(s64) + PseudoRET implicit $x10 + +... +--- +name: select_i16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i16 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s16) = G_TRUNC %0(s64) + %4:_(s16) = G_TRUNC %1(s64) + %5:_(s1) = G_TRUNC %2(s64) + %6:_(s16) = G_SELECT %5(s1), %3(s16), %4 + %7:_(s64) = G_ANYEXT %6(s16) + $x10 = COPY %7(s64) + PseudoRET implicit $x10 + +... +--- +name: select_i32 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i32 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s32) = G_TRUNC %0(s64) + %4:_(s32) = G_TRUNC %1(s64) + %5:_(s1) = G_TRUNC %2(s64) + %6:_(s32) = G_SELECT %5(s1), %3(s32), %4 + %7:_(s64) = G_ANYEXT %6(s32) + $x10 = COPY %7(s64) + PseudoRET implicit $x10 + +... +--- +name: select_i64 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i64 + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]] + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s1) = G_TRUNC %2(s64) + %4:_(s64) = G_SELECT %3(s1), %0(s64), %1(s64) + $x10 = COPY %4(s64) + PseudoRET implicit $x10 + +... +--- +name: select_i72 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i72 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: %c0:_(s64) = COPY $x14 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %c0, [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xhi, %yhi + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %c0, [[C1]] + ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s64), %xlo, %ylo + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %c0:_(s64) = COPY $x14 + %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %x:_(s72) = G_TRUNC %x0(s128) + %y:_(s72) = G_TRUNC %y0(s128) + %c:_(s1) = G_TRUNC %c0(s64) + %z:_(s72) = G_SELECT %c(s1), %x(s72), %y + %z0:_(s128) = G_ANYEXT %z(s72) + %zhi:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %z0(s128) + $x10 = COPY %zhi(s64) + $x11 = COPY %zlo(s64) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: select_i128 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i128 + ; CHECK: %xhi:_(s64) = COPY $x10 + ; CHECK-NEXT: %xlo:_(s64) = COPY $x11 + ; CHECK-NEXT: %yhi:_(s64) = COPY $x12 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x13 + ; CHECK-NEXT: %c0:_(s64) = COPY $x14 + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %c0, [[C]] + ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xhi, %yhi + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %c0, [[C1]] + ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s64), %xlo, %ylo + ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64) + ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s64) + ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 + %xhi:_(s64) = COPY $x10 + %xlo:_(s64) = COPY $x11 + %yhi:_(s64) = COPY $x12 + %ylo:_(s64) = COPY $x13 + %c0:_(s64) = COPY $x14 + %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64) + %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64) + %c:_(s1) = G_TRUNC %c0(s64) + %z:_(s128) = G_SELECT %c(s1), %x(s128), %y + %zhi:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %z(s128) + $x10 = COPY %zhi(s64) + $x11 = COPY %zlo(s64) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: select_i192 +body: | + bb.0.entry: + ; CHECK-LABEL: name: select_i192 + ; CHECK: %yhi:_(s64) = COPY $x13 + ; CHECK-NEXT: %ymid:_(s64) = COPY $x14 + ; CHECK-NEXT: %ylo:_(s64) = COPY $x15 + ; CHECK-NEXT: $x10 = COPY %yhi(s64) + ; CHECK-NEXT: $x11 = COPY %ymid(s64) + ; CHECK-NEXT: $x12 = COPY %ylo(s64) + ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12 + %xhi:_(s64) = COPY $x10 + %xmid:_(s64) = COPY $x11 + %xlo:_(s64) = COPY $x12 + %yhi:_(s64) = COPY $x13 + %ymid:_(s64) = COPY $x14 + %ylo:_(s64) = COPY $x15 + %c0:_(s64) = COPY $x16 + %x:_(s192) = G_MERGE_VALUES %xhi(s64), %xmid(s64), %xlo(s64) + %y:_(s192) = G_MERGE_VALUES %yhi(s64), %ymid(s64), %ylo(s64) + %c:_(s1) = G_TRUNC %c0(s64) + %z:_(s192) = G_SELECT %c(s1), %x(s192), %y + %zhi:_(s64), %zmid:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %y(s192) + $x10 = COPY %zhi(s64) + $x11 = COPY %zmid(s64) + $x12 = COPY %zlo(s64) + PseudoRET implicit $x10, implicit $x11, implicit $x12 + +...