diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -23469,6 +23469,37 @@ } if (Op0.getSimpleValueType().isInteger()) { + // Attempt to canonicalize SGT/UGT or SLT/ULT compares with constants to use + // SGE/UGE or SLE/ULE instead - which reduces the number of EFLAGs reads. + // NOTE: Only do this if incrementing the constant doesn't increase the bit + // encoding size - so it must stay either an i8 or i32 immediate. + // TODO: Can we move this to TranslateX86CC to handle jumps/branches too? + if (auto *Op1C = dyn_cast(Op1)) { + const APInt &Op1Val = Op1C->getAPIntValue(); + if (!Op1Val.isNullValue()) { + // Ensure the constant +/-1 doesn't overflow. + if ((CC == ISD::CondCode::SETGT && !Op1Val.isMaxSignedValue()) || + (CC == ISD::CondCode::SETUGT && !Op1Val.isMaxValue())) { + APInt Op1ValPlusOne = Op1Val + 1; + if ((Op1Val.isSignedIntN(8) == Op1ValPlusOne.isSignedIntN(8)) && + (Op1Val.isSignedIntN(32) == Op1ValPlusOne.isSignedIntN(32))) { + Op1 = DAG.getConstant(Op1ValPlusOne, dl, Op0.getValueType()); + CC = CC == ISD::CondCode::SETGT ? ISD::CondCode::SETGE + : ISD::CondCode::SETUGE; + } + } else if ((CC == ISD::CondCode::SETLT && !Op1Val.isMinSignedValue()) || + (CC == ISD::CondCode::SETULT && !Op1Val.isMinValue())) { + APInt Op1ValMinusOne = Op1Val - 1; + if ((Op1Val.isSignedIntN(8) == Op1ValMinusOne.isSignedIntN(8)) && + (Op1Val.isSignedIntN(32) == Op1ValMinusOne.isSignedIntN(32))) { + Op1 = DAG.getConstant(Op1ValMinusOne, dl, Op0.getValueType()); + CC = CC == ISD::CondCode::SETLT ? ISD::CondCode::SETLE + : ISD::CondCode::SETULE; + } + } + } + } + SDValue X86CC; SDValue EFLAGS = emitFlagsForSetcc(Op0, Op1, CC, dl, DAG, X86CC); SDValue Res = DAG.getNode(X86ISD::SETCC, dl, MVT::i8, X86CC, EFLAGS); @@ -41835,6 +41866,37 @@ return DAG.getSelect(DL, VT, Cond, LHS, RHS); } } + + // Similar to DAGCombine's select(or(CC0,CC1),X,Y) fold but for legal types. + // fold eq + gt/lt nested selects into ge/le selects + // select (cmpeq Cond0, Cond1), LHS, (select (cmpugt Cond0, Cond1), LHS, Y) + // --> (select (cmpuge Cond0, Cond1), LHS, Y) + // select (cmpslt Cond0, Cond1), LHS, (select (cmpeq Cond0, Cond1), LHS, Y) + // --> (select (cmpsle Cond0, Cond1), LHS, Y) + // .. etc .. + // TODO: Generalize this further to cover more permutations/commutations. + if (RHS.getOpcode() == ISD::SELECT && RHS.getOperand(1) == LHS && + RHS.getOperand(0).getOpcode() == ISD::SETCC) { + SDValue InnerSetCC = RHS.getOperand(0); + ISD::CondCode InnerCC = + cast(InnerSetCC.getOperand(2))->get(); + if ((CC == ISD::SETEQ || InnerCC == ISD::SETEQ) && + Cond0 == InnerSetCC.getOperand(0) && + Cond1 == InnerSetCC.getOperand(1)) { + ISD::CondCode NewCC; + switch (CC == ISD::SETEQ ? InnerCC : CC) { + case ISD::SETGT: NewCC = ISD::SETGE; break; + case ISD::SETLT: NewCC = ISD::SETLE; break; + case ISD::SETUGT: NewCC = ISD::SETUGE; break; + case ISD::SETULT: NewCC = ISD::SETULE; break; + default: NewCC = ISD::SETCC_INVALID; break; + } + if (NewCC != ISD::SETCC_INVALID) { + Cond = DAG.getSetCC(DL, CondVT, Cond0, Cond1, NewCC); + return DAG.getSelect(DL, VT, Cond, LHS, RHS.getOperand(2)); + } + } + } } // Check if the first operand is all zeros and Cond type is vXi1. @@ -42021,6 +42083,31 @@ APInt Comparison = CmpRHSC->getAPIntValue(); APInt NegAddend = -Addend; + // See if we can adjust the CC to make the comparison match the negated + // addend. + if (Comparison != NegAddend) { + APInt IncComparison = Comparison + 1; + if (IncComparison == NegAddend) { + if (CC == X86::COND_A && !Comparison.isMaxValue()) { + Comparison = IncComparison; + CC = X86::COND_AE; + } else if (CC == X86::COND_LE && !Comparison.isMaxSignedValue()) { + Comparison = IncComparison; + CC = X86::COND_L; + } + } + APInt DecComparison = Comparison - 1; + if (DecComparison == NegAddend) { + if (CC == X86::COND_AE && !Comparison.isNullValue()) { + Comparison = DecComparison; + CC = X86::COND_A; + } else if (CC == X86::COND_L && !Comparison.isMinSignedValue()) { + Comparison = DecComparison; + CC = X86::COND_LE; + } + } + } + // If the addend is the negation of the comparison value, then we can do // a full comparison by emitting the atomic arithmetic as a locked sub. if (Comparison == NegAddend) { diff --git a/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll b/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll --- a/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll +++ b/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll @@ -13,8 +13,8 @@ ; SOURCE-SCHED-NEXT: movl g_5, %eax ; SOURCE-SCHED-NEXT: sarl %eax ; SOURCE-SCHED-NEXT: xorl %ecx, %ecx -; SOURCE-SCHED-NEXT: cmpl $1, %eax -; SOURCE-SCHED-NEXT: setg %cl +; SOURCE-SCHED-NEXT: cmpl $2, %eax +; SOURCE-SCHED-NEXT: setge %cl ; SOURCE-SCHED-NEXT: movb g_73, %dl ; SOURCE-SCHED-NEXT: xorl %eax, %eax ; SOURCE-SCHED-NEXT: subb {{[0-9]+}}(%esp), %al diff --git a/llvm/test/CodeGen/X86/atomic-eflags-reuse.ll b/llvm/test/CodeGen/X86/atomic-eflags-reuse.ll --- a/llvm/test/CodeGen/X86/atomic-eflags-reuse.ll +++ b/llvm/test/CodeGen/X86/atomic-eflags-reuse.ll @@ -55,7 +55,7 @@ ; SLOWINCDEC-LABEL: test_sub_1_cmov_sle: ; SLOWINCDEC: # %bb.0: # %entry ; SLOWINCDEC-NEXT: movl %esi, %eax -; SLOWINCDEC-NEXT: lock addq $-1, (%rdi) +; SLOWINCDEC-NEXT: lock subq $1, (%rdi) ; SLOWINCDEC-NEXT: cmovgel %edx, %eax ; SLOWINCDEC-NEXT: retq entry: @@ -298,16 +298,18 @@ ret i8 %tmp2 } -; FIXME: This test canonicalizes in a way that hides the fact that the -; comparison can be folded into the atomic subtract. define i8 @test_sub_1_cmp_1_setcc_sle(i64* %p) #0 { -; CHECK-LABEL: test_sub_1_cmp_1_setcc_sle: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: movq $-1, %rax -; CHECK-NEXT: lock xaddq %rax, (%rdi) -; CHECK-NEXT: cmpq $2, %rax -; CHECK-NEXT: setl %al -; CHECK-NEXT: retq +; FASTINCDEC-LABEL: test_sub_1_cmp_1_setcc_sle: +; FASTINCDEC: # %bb.0: # %entry +; FASTINCDEC-NEXT: lock decq (%rdi) +; FASTINCDEC-NEXT: setle %al +; FASTINCDEC-NEXT: retq +; +; SLOWINCDEC-LABEL: test_sub_1_cmp_1_setcc_sle: +; SLOWINCDEC: # %bb.0: # %entry +; SLOWINCDEC-NEXT: lock subq $1, (%rdi) +; SLOWINCDEC-NEXT: setle %al +; SLOWINCDEC-NEXT: retq entry: %tmp0 = atomicrmw sub i64* %p, i64 1 seq_cst %tmp1 = icmp sle i64 %tmp0, 1 @@ -328,15 +330,11 @@ ret i8 %tmp2 } -; FIXME: This test canonicalizes in a way that hides the fact that the -; comparison can be folded into the atomic subtract. define i8 @test_sub_3_cmp_3_setcc_uge(i64* %p) #0 { ; CHECK-LABEL: test_sub_3_cmp_3_setcc_uge: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: movq $-3, %rax -; CHECK-NEXT: lock xaddq %rax, (%rdi) -; CHECK-NEXT: cmpq $2, %rax -; CHECK-NEXT: seta %al +; CHECK-NEXT: lock subq $3, (%rdi) +; CHECK-NEXT: setae %al ; CHECK-NEXT: retq entry: %tmp0 = atomicrmw sub i64* %p, i64 3 seq_cst diff --git a/llvm/test/CodeGen/X86/cmov.ll b/llvm/test/CodeGen/X86/cmov.ll --- a/llvm/test/CodeGen/X86/cmov.ll +++ b/llvm/test/CodeGen/X86/cmov.ll @@ -159,8 +159,8 @@ ; CHECK-LABEL: test5: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $41, (%rdi) -; CHECK-NEXT: setg %al +; CHECK-NEXT: cmpl $42, (%rdi) +; CHECK-NEXT: setge %al ; CHECK-NEXT: orl $-2, %eax ; CHECK-NEXT: retq entry: @@ -174,8 +174,8 @@ ; CHECK-LABEL: test6: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $42, (%rdi) -; CHECK-NEXT: setl %al +; CHECK-NEXT: cmpl $41, (%rdi) +; CHECK-NEXT: setle %al ; CHECK-NEXT: leal 4(%rax,%rax,8), %eax ; CHECK-NEXT: retq entry: diff --git a/llvm/test/CodeGen/X86/cmp.ll b/llvm/test/CodeGen/X86/cmp.ll --- a/llvm/test/CodeGen/X86/cmp.ll +++ b/llvm/test/CodeGen/X86/cmp.ll @@ -184,8 +184,8 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: shrq $32, %rdi # encoding: [0x48,0xc1,0xef,0x20] ; CHECK-NEXT: xorl %eax, %eax # encoding: [0x31,0xc0] -; CHECK-NEXT: cmpl $3, %edi # encoding: [0x83,0xff,0x03] -; CHECK-NEXT: setb %al # encoding: [0x0f,0x92,0xc0] +; CHECK-NEXT: cmpl $2, %edi # encoding: [0x83,0xff,0x02] +; CHECK-NEXT: setbe %al # encoding: [0x0f,0x96,0xc0] ; CHECK-NEXT: retq # encoding: [0xc3] entry: %lnot = icmp ult i64 %res, 12884901888 diff --git a/llvm/test/CodeGen/X86/codegen-prepare-uaddo.ll b/llvm/test/CodeGen/X86/codegen-prepare-uaddo.ll --- a/llvm/test/CodeGen/X86/codegen-prepare-uaddo.ll +++ b/llvm/test/CodeGen/X86/codegen-prepare-uaddo.ll @@ -253,8 +253,8 @@ ; CHECK-NEXT: movl %edi, %eax ; CHECK-NEXT: shrl $16, %eax ; CHECK-NEXT: movb %al, 2(%rsi) -; CHECK-NEXT: cmpl $29, %edi -; CHECK-NEXT: setb %al +; CHECK-NEXT: cmpl $28, %edi +; CHECK-NEXT: setbe %al ; CHECK-NEXT: retq %a = add i17 %x, 29 store i17 %a, i17* %p diff --git a/llvm/test/CodeGen/X86/ctpop-combine.ll b/llvm/test/CodeGen/X86/ctpop-combine.ll --- a/llvm/test/CodeGen/X86/ctpop-combine.ll +++ b/llvm/test/CodeGen/X86/ctpop-combine.ll @@ -41,8 +41,8 @@ ; POPCOUNT-NEXT: popcntq %rdi, %rcx ; POPCOUNT-NEXT: andb $63, %cl ; POPCOUNT-NEXT: xorl %eax, %eax -; POPCOUNT-NEXT: cmpb $2, %cl -; POPCOUNT-NEXT: setb %al +; POPCOUNT-NEXT: cmpb $1, %cl +; POPCOUNT-NEXT: setbe %al ; POPCOUNT-NEXT: retq ; ; NO-POPCOUNT-LABEL: test3: @@ -68,8 +68,8 @@ ; NO-POPCOUNT-NEXT: shrq $56, %rdx ; NO-POPCOUNT-NEXT: andb $63, %dl ; NO-POPCOUNT-NEXT: xorl %eax, %eax -; NO-POPCOUNT-NEXT: cmpb $2, %dl -; NO-POPCOUNT-NEXT: setb %al +; NO-POPCOUNT-NEXT: cmpb $1, %dl +; NO-POPCOUNT-NEXT: setbe %al ; NO-POPCOUNT-NEXT: retq %count = tail call i64 @llvm.ctpop.i64(i64 %x) %cast = trunc i64 %count to i6 ; Too small for 0-64 diff --git a/llvm/test/CodeGen/X86/dagcombine-select.ll b/llvm/test/CodeGen/X86/dagcombine-select.ll --- a/llvm/test/CodeGen/X86/dagcombine-select.ll +++ b/llvm/test/CodeGen/X86/dagcombine-select.ll @@ -6,8 +6,8 @@ ; CHECK-LABEL: select_and1: ; CHECK: # %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $11, %edi -; CHECK-NEXT: cmovgel %esi, %eax +; CHECK-NEXT: cmpl $10, %edi +; CHECK-NEXT: cmovgl %esi, %eax ; CHECK-NEXT: retq %c = icmp slt i32 %x, 11 %s = select i1 %c, i32 0, i32 -1 @@ -19,8 +19,8 @@ ; CHECK-LABEL: select_and2: ; CHECK: # %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $11, %edi -; CHECK-NEXT: cmovgel %esi, %eax +; CHECK-NEXT: cmpl $10, %edi +; CHECK-NEXT: cmovgl %esi, %eax ; CHECK-NEXT: retq %c = icmp slt i32 %x, 11 %s = select i1 %c, i32 0, i32 -1 @@ -32,8 +32,8 @@ ; CHECK-LABEL: select_and3: ; CHECK: # %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $11, %edi -; CHECK-NEXT: cmovll %esi, %eax +; CHECK-NEXT: cmpl $10, %edi +; CHECK-NEXT: cmovlel %esi, %eax ; CHECK-NEXT: retq %c = icmp slt i32 %x, 11 %s = select i1 %c, i32 -1, i32 0 @@ -44,9 +44,9 @@ define <4 x i32> @select_and_v4(i32 %x, <4 x i32> %y) { ; CHECK-LABEL: select_and_v4: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $11, %edi +; CHECK-NEXT: cmpl $10, %edi ; CHECK-NEXT: xorps %xmm1, %xmm1 -; CHECK-NEXT: jl .LBB3_2 +; CHECK-NEXT: jle .LBB3_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: movaps %xmm0, %xmm1 ; CHECK-NEXT: .LBB3_2: @@ -61,9 +61,9 @@ define i32 @select_or1(i32 %x, i32 %y) { ; CHECK-LABEL: select_or1: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $11, %edi +; CHECK-NEXT: cmpl $10, %edi ; CHECK-NEXT: movl $-1, %eax -; CHECK-NEXT: cmovll %esi, %eax +; CHECK-NEXT: cmovlel %esi, %eax ; CHECK-NEXT: retq %c = icmp slt i32 %x, 11 %s = select i1 %c, i32 0, i32 -1 @@ -74,9 +74,9 @@ define i32 @select_or2(i32 %x, i32 %y) { ; CHECK-LABEL: select_or2: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $11, %edi +; CHECK-NEXT: cmpl $10, %edi ; CHECK-NEXT: movl $-1, %eax -; CHECK-NEXT: cmovll %esi, %eax +; CHECK-NEXT: cmovlel %esi, %eax ; CHECK-NEXT: retq %c = icmp slt i32 %x, 11 %s = select i1 %c, i32 0, i32 -1 @@ -87,9 +87,9 @@ define i32 @select_or3(i32 %x, i32 %y) { ; CHECK-LABEL: select_or3: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $11, %edi +; CHECK-NEXT: cmpl $10, %edi ; CHECK-NEXT: movl $-1, %eax -; CHECK-NEXT: cmovgel %esi, %eax +; CHECK-NEXT: cmovgl %esi, %eax ; CHECK-NEXT: retq %c = icmp slt i32 %x, 11 %s = select i1 %c, i32 -1, i32 0 @@ -100,8 +100,8 @@ define <4 x i32> @select_or_v4(i32 %x, <4 x i32> %y) { ; CHECK-LABEL: select_or_v4: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $11, %edi -; CHECK-NEXT: jl .LBB7_2 +; CHECK-NEXT: cmpl $10, %edi +; CHECK-NEXT: jle .LBB7_2 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0 ; CHECK-NEXT: .LBB7_2: diff --git a/llvm/test/CodeGen/X86/lack-of-signed-truncation-check.ll b/llvm/test/CodeGen/X86/lack-of-signed-truncation-check.ll --- a/llvm/test/CodeGen/X86/lack-of-signed-truncation-check.ll +++ b/llvm/test/CodeGen/X86/lack-of-signed-truncation-check.ll @@ -465,16 +465,16 @@ ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax ; X86-NEXT: addw {{[0-9]+}}(%esp), %ax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $255, %eax -; X86-NEXT: seta %al +; X86-NEXT: cmpl $256, %eax # imm = 0x100 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: add_ugecmp_bad_i16_i8_add: ; X64: # %bb.0: ; X64-NEXT: addl %esi, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $255, %eax -; X64-NEXT: seta %al +; X64-NEXT: cmpl $256, %eax # imm = 0x100 +; X64-NEXT: setae %al ; X64-NEXT: retq %tmp0 = add i16 %x, %y %tmp1 = icmp uge i16 %tmp0, 256 ; 1U << 8 @@ -530,16 +530,16 @@ ; X86-NEXT: movl $192, %eax ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $255, %eax -; X86-NEXT: seta %al +; X86-NEXT: cmpl $256, %eax # imm = 0x100 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: add_ugecmp_bad_i16_i8_c0notpoweroftwo: ; X64: # %bb.0: ; X64-NEXT: addl $192, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $255, %eax -; X64-NEXT: seta %al +; X64-NEXT: cmpl $256, %eax # imm = 0x100 +; X64-NEXT: setae %al ; X64-NEXT: retq %tmp0 = add i16 %x, 192 ; (1U << (8-1)) + (1U << (8-1-1)) %tmp1 = icmp uge i16 %tmp0, 256 ; 1U << 8 @@ -553,16 +553,16 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: subl $-128, %eax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $767, %eax # imm = 0x2FF -; X86-NEXT: seta %al +; X86-NEXT: cmpl $768, %eax # imm = 0x300 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: add_ugecmp_bad_i16_i8_c1notpoweroftwo: ; X64: # %bb.0: ; X64-NEXT: subl $-128, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $767, %eax # imm = 0x2FF -; X64-NEXT: seta %al +; X64-NEXT: cmpl $768, %eax # imm = 0x300 +; X64-NEXT: setae %al ; X64-NEXT: retq %tmp0 = add i16 %x, 128 ; 1U << (8-1) %tmp1 = icmp uge i16 %tmp0, 768 ; (1U << 8)) + (1U << (8+1)) @@ -576,16 +576,16 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: addl $64, %eax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $255, %eax -; X86-NEXT: seta %al +; X86-NEXT: cmpl $256, %eax # imm = 0x100 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: add_ugecmp_bad_i16_i8_magic: ; X64: # %bb.0: ; X64-NEXT: addl $64, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $255, %eax -; X64-NEXT: seta %al +; X64-NEXT: cmpl $256, %eax # imm = 0x100 +; X64-NEXT: setae %al ; X64-NEXT: retq %tmp0 = add i16 %x, 64 ; 1U << (8-1-1) %tmp1 = icmp uge i16 %tmp0, 256 ; 1U << 8 @@ -598,15 +598,15 @@ ; X86: # %bb.0: ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: addl $8, %eax -; X86-NEXT: cmpw $15, %ax -; X86-NEXT: seta %al +; X86-NEXT: cmpw $16, %ax +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: add_ugecmp_bad_i16_i4: ; X64: # %bb.0: ; X64-NEXT: addl $8, %edi -; X64-NEXT: cmpw $15, %di -; X64-NEXT: seta %al +; X64-NEXT: cmpw $16, %di +; X64-NEXT: setae %al ; X64-NEXT: retq %tmp0 = add i16 %x, 8 ; 1U << (4-1) %tmp1 = icmp uge i16 %tmp0, 16 ; 1U << 4 @@ -620,16 +620,16 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: subl $-128, %eax ; X86-NEXT: andl $16777215, %eax # imm = 0xFFFFFF -; X86-NEXT: cmpl $255, %eax -; X86-NEXT: seta %al +; X86-NEXT: cmpl $256, %eax # imm = 0x100 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: add_ugecmp_bad_i24_i8: ; X64: # %bb.0: ; X64-NEXT: subl $-128, %edi ; X64-NEXT: andl $16777215, %edi # imm = 0xFFFFFF -; X64-NEXT: cmpl $255, %edi -; X64-NEXT: seta %al +; X64-NEXT: cmpl $256, %edi # imm = 0x100 +; X64-NEXT: setae %al ; X64-NEXT: retq %tmp0 = add i24 %x, 128 ; 1U << (8-1) %tmp1 = icmp uge i24 %tmp0, 256 ; 1U << 8 diff --git a/llvm/test/CodeGen/X86/mul-constant-result.ll b/llvm/test/CodeGen/X86/mul-constant-result.ll --- a/llvm/test/CodeGen/X86/mul-constant-result.ll +++ b/llvm/test/CodeGen/X86/mul-constant-result.ll @@ -13,10 +13,10 @@ ; X86-NEXT: .cfi_def_cfa_offset 8 ; X86-NEXT: .cfi_offset %esi, -8 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx -; X86-NEXT: cmpl $1, %edx +; X86-NEXT: cmpl $2, %edx ; X86-NEXT: movl $1, %eax ; X86-NEXT: movl $1, %esi -; X86-NEXT: jg .LBB0_2 +; X86-NEXT: jge .LBB0_2 ; X86-NEXT: # %bb.1: ; X86-NEXT: movl %edx, %esi ; X86-NEXT: .LBB0_2: @@ -188,10 +188,10 @@ ; X64-HSW-LABEL: mult: ; X64-HSW: # %bb.0: ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi -; X64-HSW-NEXT: cmpl $1, %esi +; X64-HSW-NEXT: cmpl $2, %esi ; X64-HSW-NEXT: movl $1, %ecx ; X64-HSW-NEXT: movl %esi, %eax -; X64-HSW-NEXT: cmovgl %ecx, %eax +; X64-HSW-NEXT: cmovgel %ecx, %eax ; X64-HSW-NEXT: testl %esi, %esi ; X64-HSW-NEXT: cmovel %ecx, %eax ; X64-HSW-NEXT: decl %edi diff --git a/llvm/test/CodeGen/X86/omit-urem-of-power-of-two-or-zero-when-comparing-with-zero.ll b/llvm/test/CodeGen/X86/omit-urem-of-power-of-two-or-zero-when-comparing-with-zero.ll --- a/llvm/test/CodeGen/X86/omit-urem-of-power-of-two-or-zero-when-comparing-with-zero.ll +++ b/llvm/test/CodeGen/X86/omit-urem-of-power-of-two-or-zero-when-comparing-with-zero.ll @@ -46,8 +46,8 @@ ; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx ; CHECK-NEXT: shll %cl, %edi ; CHECK-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB -; CHECK-NEXT: cmpl $1431655766, %eax # imm = 0x55555556 -; CHECK-NEXT: setb %al +; CHECK-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 +; CHECK-NEXT: setbe %al ; CHECK-NEXT: retq %t0 = and i32 %x, 1 ; clearly a power-of-two or zero %t1 = shl i32 %t0, %y ; will still be a power-of-two or zero with any %y @@ -64,8 +64,8 @@ ; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx ; CHECK-NEXT: shll %cl, %edi ; CHECK-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB -; CHECK-NEXT: cmpl $1431655766, %eax # imm = 0x55555556 -; CHECK-NEXT: setb %al +; CHECK-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 +; CHECK-NEXT: setbe %al ; CHECK-NEXT: retq %t0 = and i32 %x, 2 ; clearly a power-of-two or zero %t1 = shl i32 %t0, %y ; will still be a power-of-two or zero with any %y @@ -366,8 +366,8 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: andl $3, %edi ; CHECK-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB -; CHECK-NEXT: cmpl $1431655766, %eax # imm = 0x55555556 -; CHECK-NEXT: setb %al +; CHECK-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 +; CHECK-NEXT: setbe %al ; CHECK-NEXT: retq %t0 = and i32 %x, 3 ; up to two bits set, not power-of-two %t1 = urem i32 %t0, 3 diff --git a/llvm/test/CodeGen/X86/or-branch.ll b/llvm/test/CodeGen/X86/or-branch.ll --- a/llvm/test/CodeGen/X86/or-branch.ll +++ b/llvm/test/CodeGen/X86/or-branch.ll @@ -19,8 +19,8 @@ ; JUMP1: # %bb.0: # %entry ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp) ; JUMP1-NEXT: setne %al -; JUMP1-NEXT: cmpl $4, {{[0-9]+}}(%esp) -; JUMP1-NEXT: setg %cl +; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp) +; JUMP1-NEXT: setge %cl ; JUMP1-NEXT: testb %al, %cl ; JUMP1-NEXT: jne .LBB0_1 ; JUMP1-NEXT: # %bb.2: # %cond_true @@ -49,8 +49,8 @@ ; JUMP2: # %bb.0: # %entry ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp) ; JUMP2-NEXT: setne %al -; JUMP2-NEXT: cmpl $4, {{[0-9]+}}(%esp) -; JUMP2-NEXT: setg %cl +; JUMP2-NEXT: cmpl $5, {{[0-9]+}}(%esp) +; JUMP2-NEXT: setge %cl ; JUMP2-NEXT: testb %al, %cl ; JUMP2-NEXT: jne .LBB1_1 ; JUMP2-NEXT: # %bb.2: # %cond_true @@ -62,8 +62,8 @@ ; JUMP1: # %bb.0: # %entry ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp) ; JUMP1-NEXT: setne %al -; JUMP1-NEXT: cmpl $4, {{[0-9]+}}(%esp) -; JUMP1-NEXT: setg %cl +; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp) +; JUMP1-NEXT: setge %cl ; JUMP1-NEXT: testb %al, %cl ; JUMP1-NEXT: jne .LBB1_1 ; JUMP1-NEXT: # %bb.2: # %cond_true diff --git a/llvm/test/CodeGen/X86/pr34080-2.ll b/llvm/test/CodeGen/X86/pr34080-2.ll --- a/llvm/test/CodeGen/X86/pr34080-2.ll +++ b/llvm/test/CodeGen/X86/pr34080-2.ll @@ -16,8 +16,8 @@ ; CHECK-NEXT: movl 8(%ebp), %ebx ; CHECK-NEXT: movl 8(%ebx), %esi ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $3, 12(%ebx) -; CHECK-NEXT: setl %al +; CHECK-NEXT: cmpl $2, 12(%ebx) +; CHECK-NEXT: setle %al ; CHECK-NEXT: subl %eax, %esi ; CHECK-NEXT: movl $-1374389535, %ecx # imm = 0xAE147AE1 ; CHECK-NEXT: movl %esi, %eax diff --git a/llvm/test/CodeGen/X86/pr45995-2.ll b/llvm/test/CodeGen/X86/pr45995-2.ll --- a/llvm/test/CodeGen/X86/pr45995-2.ll +++ b/llvm/test/CodeGen/X86/pr45995-2.ll @@ -5,8 +5,8 @@ ; CHECK-LABEL: selecter: ; CHECK: # %bb.0: ; CHECK-NEXT: xor eax, eax -; CHECK-NEXT: cmp rdi, 1 -; CHECK-NEXT: setg al +; CHECK-NEXT: cmp rdi, 2 +; CHECK-NEXT: setge al ; CHECK-NEXT: lea eax, [rax + 2*rax] ; CHECK-NEXT: kmovd k0, eax ; CHECK-NEXT: vpmovm2d xmm0, k0 diff --git a/llvm/test/CodeGen/X86/pr5145.ll b/llvm/test/CodeGen/X86/pr5145.ll --- a/llvm/test/CodeGen/X86/pr5145.ll +++ b/llvm/test/CodeGen/X86/pr5145.ll @@ -9,10 +9,10 @@ ; CHECK-NEXT: .p2align 4, 0x90 ; CHECK-NEXT: .LBB0_1: # %atomicrmw.start ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: cmpb $5, %al +; CHECK-NEXT: cmpb $6, %al ; CHECK-NEXT: movzbl %al, %eax ; CHECK-NEXT: movl $5, %ecx -; CHECK-NEXT: cmovgl %eax, %ecx +; CHECK-NEXT: cmovgel %eax, %ecx ; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip) ; CHECK-NEXT: jne .LBB0_1 @@ -21,10 +21,10 @@ ; CHECK-NEXT: .p2align 4, 0x90 ; CHECK-NEXT: .LBB0_3: # %atomicrmw.start2 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: cmpb $7, %al +; CHECK-NEXT: cmpb $6, %al ; CHECK-NEXT: movzbl %al, %eax ; CHECK-NEXT: movl $6, %ecx -; CHECK-NEXT: cmovll %eax, %ecx +; CHECK-NEXT: cmovlel %eax, %ecx ; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip) ; CHECK-NEXT: jne .LBB0_3 @@ -33,10 +33,10 @@ ; CHECK-NEXT: .p2align 4, 0x90 ; CHECK-NEXT: .LBB0_5: # %atomicrmw.start8 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: cmpb $7, %al +; CHECK-NEXT: cmpb $8, %al ; CHECK-NEXT: movzbl %al, %eax ; CHECK-NEXT: movl $7, %ecx -; CHECK-NEXT: cmoval %eax, %ecx +; CHECK-NEXT: cmovael %eax, %ecx ; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip) ; CHECK-NEXT: jne .LBB0_5 @@ -45,10 +45,10 @@ ; CHECK-NEXT: .p2align 4, 0x90 ; CHECK-NEXT: .LBB0_7: # %atomicrmw.start14 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: cmpb $9, %al +; CHECK-NEXT: cmpb $8, %al ; CHECK-NEXT: movzbl %al, %eax ; CHECK-NEXT: movl $8, %ecx -; CHECK-NEXT: cmovbl %eax, %ecx +; CHECK-NEXT: cmovbel %eax, %ecx ; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip) ; CHECK-NEXT: jne .LBB0_7 diff --git a/llvm/test/CodeGen/X86/sadd_sat.ll b/llvm/test/CodeGen/X86/sadd_sat.ll --- a/llvm/test/CodeGen/X86/sadd_sat.ll +++ b/llvm/test/CodeGen/X86/sadd_sat.ll @@ -148,12 +148,12 @@ ; X86-NEXT: movb {{[0-9]+}}(%esp), %al ; X86-NEXT: addb {{[0-9]+}}(%esp), %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $7, %al +; X86-NEXT: cmpb $6, %al ; X86-NEXT: movl $7, %eax -; X86-NEXT: cmovll %ecx, %eax -; X86-NEXT: cmpb $-8, %al +; X86-NEXT: cmovlel %ecx, %eax +; X86-NEXT: cmpb $-7, %al ; X86-NEXT: movl $248, %ecx -; X86-NEXT: cmovgl %eax, %ecx +; X86-NEXT: cmovgel %eax, %ecx ; X86-NEXT: movsbl %cl, %eax ; X86-NEXT: retl ; @@ -161,12 +161,12 @@ ; X64: # %bb.0: ; X64-NEXT: addb %sil, %dil ; X64-NEXT: movzbl %dil, %eax -; X64-NEXT: cmpb $7, %al +; X64-NEXT: cmpb $6, %al ; X64-NEXT: movl $7, %ecx -; X64-NEXT: cmovll %eax, %ecx -; X64-NEXT: cmpb $-8, %cl +; X64-NEXT: cmovlel %eax, %ecx +; X64-NEXT: cmpb $-7, %cl ; X64-NEXT: movl $248, %eax -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: movsbl %al, %eax ; X64-NEXT: retq %tmp = call i4 @llvm.sadd.sat.i4(i4 %x, i4 %y); diff --git a/llvm/test/CodeGen/X86/sadd_sat_plus.ll b/llvm/test/CodeGen/X86/sadd_sat_plus.ll --- a/llvm/test/CodeGen/X86/sadd_sat_plus.ll +++ b/llvm/test/CodeGen/X86/sadd_sat_plus.ll @@ -162,12 +162,12 @@ ; X86-NEXT: sarb $4, %al ; X86-NEXT: addb {{[0-9]+}}(%esp), %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $7, %al +; X86-NEXT: cmpb $6, %al ; X86-NEXT: movl $7, %eax -; X86-NEXT: cmovll %ecx, %eax -; X86-NEXT: cmpb $-8, %al +; X86-NEXT: cmovlel %ecx, %eax +; X86-NEXT: cmpb $-7, %al ; X86-NEXT: movl $248, %ecx -; X86-NEXT: cmovgl %eax, %ecx +; X86-NEXT: cmovgel %eax, %ecx ; X86-NEXT: movsbl %cl, %eax ; X86-NEXT: retl ; @@ -180,12 +180,12 @@ ; X64-NEXT: sarb $4, %al ; X64-NEXT: addb %dil, %al ; X64-NEXT: movzbl %al, %eax -; X64-NEXT: cmpb $7, %al +; X64-NEXT: cmpb $6, %al ; X64-NEXT: movl $7, %ecx -; X64-NEXT: cmovll %eax, %ecx -; X64-NEXT: cmpb $-8, %cl +; X64-NEXT: cmovlel %eax, %ecx +; X64-NEXT: cmpb $-7, %cl ; X64-NEXT: movl $248, %eax -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: movsbl %al, %eax ; X64-NEXT: retq %a = mul i4 %y, %z diff --git a/llvm/test/CodeGen/X86/sat-add.ll b/llvm/test/CodeGen/X86/sat-add.ll --- a/llvm/test/CodeGen/X86/sat-add.ll +++ b/llvm/test/CodeGen/X86/sat-add.ll @@ -13,9 +13,9 @@ define i8 @unsigned_sat_constant_i8_using_min(i8 %x) { ; ANY-LABEL: unsigned_sat_constant_i8_using_min: ; ANY: # %bb.0: -; ANY-NEXT: cmpb $-43, %dil +; ANY-NEXT: cmpb $-44, %dil ; ANY-NEXT: movl $213, %eax -; ANY-NEXT: cmovbl %edi, %eax +; ANY-NEXT: cmovbel %edi, %eax ; ANY-NEXT: addb $42, %al ; ANY-NEXT: # kill: def $al killed $al killed $eax ; ANY-NEXT: retq @@ -58,9 +58,9 @@ define i16 @unsigned_sat_constant_i16_using_min(i16 %x) { ; ANY-LABEL: unsigned_sat_constant_i16_using_min: ; ANY: # %bb.0: -; ANY-NEXT: cmpw $-43, %di +; ANY-NEXT: cmpw $-44, %di ; ANY-NEXT: movl $65493, %eax # imm = 0xFFD5 -; ANY-NEXT: cmovbl %edi, %eax +; ANY-NEXT: cmovbel %edi, %eax ; ANY-NEXT: addl $42, %eax ; ANY-NEXT: # kill: def $ax killed $ax killed $eax ; ANY-NEXT: retq @@ -101,9 +101,9 @@ define i32 @unsigned_sat_constant_i32_using_min(i32 %x) { ; ANY-LABEL: unsigned_sat_constant_i32_using_min: ; ANY: # %bb.0: -; ANY-NEXT: cmpl $-43, %edi +; ANY-NEXT: cmpl $-44, %edi ; ANY-NEXT: movl $-43, %eax -; ANY-NEXT: cmovbl %edi, %eax +; ANY-NEXT: cmovbel %edi, %eax ; ANY-NEXT: addl $42, %eax ; ANY-NEXT: retq %c = icmp ult i32 %x, -43 @@ -141,9 +141,9 @@ define i64 @unsigned_sat_constant_i64_using_min(i64 %x) { ; ANY-LABEL: unsigned_sat_constant_i64_using_min: ; ANY: # %bb.0: -; ANY-NEXT: cmpq $-43, %rdi +; ANY-NEXT: cmpq $-44, %rdi ; ANY-NEXT: movq $-43, %rax -; ANY-NEXT: cmovbq %rdi, %rax +; ANY-NEXT: cmovbeq %rdi, %rax ; ANY-NEXT: addq $42, %rax ; ANY-NEXT: retq %c = icmp ult i64 %x, -43 diff --git a/llvm/test/CodeGen/X86/sdiv_fix_sat.ll b/llvm/test/CodeGen/X86/sdiv_fix_sat.ll --- a/llvm/test/CodeGen/X86/sdiv_fix_sat.ll +++ b/llvm/test/CodeGen/X86/sdiv_fix_sat.ll @@ -30,12 +30,12 @@ ; X64-NEXT: setne %dl ; X64-NEXT: testb %cl, %dl ; X64-NEXT: cmovel %eax, %edi -; X64-NEXT: cmpl $65535, %edi # imm = 0xFFFF +; X64-NEXT: cmpl $65534, %edi # imm = 0xFFFE ; X64-NEXT: movl $65535, %ecx # imm = 0xFFFF -; X64-NEXT: cmovll %edi, %ecx -; X64-NEXT: cmpl $-65536, %ecx # imm = 0xFFFF0000 +; X64-NEXT: cmovlel %edi, %ecx +; X64-NEXT: cmpl $-65535, %ecx # imm = 0xFFFF0001 ; X64-NEXT: movl $-65536, %eax # imm = 0xFFFF0000 -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: shrl %eax ; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq @@ -61,12 +61,12 @@ ; X86-NEXT: setne %dl ; X86-NEXT: testb %cl, %dl ; X86-NEXT: cmovel %eax, %edi -; X86-NEXT: cmpl $65535, %edi # imm = 0xFFFF +; X86-NEXT: cmpl $65534, %edi # imm = 0xFFFE ; X86-NEXT: movl $65535, %ecx # imm = 0xFFFF -; X86-NEXT: cmovll %edi, %ecx -; X86-NEXT: cmpl $-65536, %ecx # imm = 0xFFFF0000 +; X86-NEXT: cmovlel %edi, %ecx +; X86-NEXT: cmpl $-65535, %ecx # imm = 0xFFFF0001 ; X86-NEXT: movl $-65536, %eax # imm = 0xFFFF0000 -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: shrl %eax ; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: popl %esi @@ -100,12 +100,12 @@ ; X64-NEXT: setne %dl ; X64-NEXT: testb %cl, %dl ; X64-NEXT: cmovel %eax, %edi -; X64-NEXT: cmpl $16383, %edi # imm = 0x3FFF +; X64-NEXT: cmpl $16382, %edi # imm = 0x3FFE ; X64-NEXT: movl $16383, %ecx # imm = 0x3FFF -; X64-NEXT: cmovll %edi, %ecx -; X64-NEXT: cmpl $-16384, %ecx # imm = 0xC000 +; X64-NEXT: cmovlel %edi, %ecx +; X64-NEXT: cmpl $-16383, %ecx # imm = 0xC001 ; X64-NEXT: movl $-16384, %eax # imm = 0xC000 -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq ; @@ -130,12 +130,12 @@ ; X86-NEXT: setne %dl ; X86-NEXT: testb %cl, %dl ; X86-NEXT: cmovel %eax, %edi -; X86-NEXT: cmpl $16383, %edi # imm = 0x3FFF +; X86-NEXT: cmpl $16382, %edi # imm = 0x3FFE ; X86-NEXT: movl $16383, %ecx # imm = 0x3FFF -; X86-NEXT: cmovll %edi, %ecx -; X86-NEXT: cmpl $-16384, %ecx # imm = 0xC000 +; X86-NEXT: cmovlel %edi, %ecx +; X86-NEXT: cmpl $-16383, %ecx # imm = 0xC001 ; X86-NEXT: movl $-16384, %eax # imm = 0xC000 -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: popl %esi ; X86-NEXT: popl %edi @@ -171,13 +171,13 @@ ; X64-NEXT: testb %cl, %dl ; X64-NEXT: cmovel %eax, %esi ; X64-NEXT: movswl %si, %eax -; X64-NEXT: cmpl $16383, %eax # imm = 0x3FFF +; X64-NEXT: cmpl $16382, %eax # imm = 0x3FFE ; X64-NEXT: movl $16383, %ecx # imm = 0x3FFF -; X64-NEXT: cmovll %esi, %ecx +; X64-NEXT: cmovlel %esi, %ecx ; X64-NEXT: movswl %cx, %eax -; X64-NEXT: cmpl $-16384, %eax # imm = 0xC000 +; X64-NEXT: cmpl $-16383, %eax # imm = 0xC001 ; X64-NEXT: movl $49152, %eax # imm = 0xC000 -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq ; @@ -206,13 +206,13 @@ ; X86-NEXT: testb %ch, %cl ; X86-NEXT: cmovel %eax, %edi ; X86-NEXT: movswl %di, %eax -; X86-NEXT: cmpl $16383, %eax # imm = 0x3FFF +; X86-NEXT: cmpl $16382, %eax # imm = 0x3FFE ; X86-NEXT: movl $16383, %ecx # imm = 0x3FFF -; X86-NEXT: cmovll %edi, %ecx +; X86-NEXT: cmovlel %edi, %ecx ; X86-NEXT: movswl %cx, %eax -; X86-NEXT: cmpl $-16384, %eax # imm = 0xC000 +; X86-NEXT: cmpl $-16383, %eax # imm = 0xC001 ; X86-NEXT: movl $49152, %eax # imm = 0xC000 -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: popl %esi ; X86-NEXT: popl %edi @@ -250,12 +250,12 @@ ; X64-NEXT: setne %dl ; X64-NEXT: testb %cl, %dl ; X64-NEXT: cmovel %eax, %edi -; X64-NEXT: cmpb $7, %dil +; X64-NEXT: cmpb $6, %dil ; X64-NEXT: movl $7, %ecx -; X64-NEXT: cmovll %edi, %ecx -; X64-NEXT: cmpb $-8, %cl +; X64-NEXT: cmovlel %edi, %ecx +; X64-NEXT: cmpb $-7, %cl ; X64-NEXT: movl $248, %eax -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: popq %rbx ; X64-NEXT: retq @@ -285,12 +285,12 @@ ; X86-NEXT: setne %cl ; X86-NEXT: testb %dh, %cl ; X86-NEXT: cmovel %esi, %eax -; X86-NEXT: cmpb $7, %al +; X86-NEXT: cmpb $6, %al ; X86-NEXT: movl $7, %ecx -; X86-NEXT: cmovll %eax, %ecx -; X86-NEXT: cmpb $-8, %cl +; X86-NEXT: cmovlel %eax, %ecx +; X86-NEXT: cmpb $-7, %cl ; X86-NEXT: movl $248, %eax -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: popl %esi ; X86-NEXT: retl @@ -313,50 +313,48 @@ ; X64-NEXT: movq %rsi, (%rsp) # 8-byte Spill ; X64-NEXT: movq %rdi, %r15 ; X64-NEXT: leaq (%rdi,%rdi), %rax -; X64-NEXT: movq %rdi, %rbx -; X64-NEXT: sarq $63, %rbx -; X64-NEXT: shldq $31, %rax, %rbx -; X64-NEXT: shlq $32, %r15 -; X64-NEXT: movq %rsi, %r12 +; X64-NEXT: movq %rdi, %r12 ; X64-NEXT: sarq $63, %r12 +; X64-NEXT: shldq $31, %rax, %r12 +; X64-NEXT: shlq $32, %r15 +; X64-NEXT: movq %rsi, %r13 +; X64-NEXT: sarq $63, %r13 ; X64-NEXT: movq %r15, %rdi -; X64-NEXT: movq %rbx, %rsi -; X64-NEXT: movq %r12, %rcx +; X64-NEXT: movq %r12, %rsi +; X64-NEXT: movq %r13, %rcx ; X64-NEXT: callq __divti3@PLT -; X64-NEXT: movq %rax, %r13 +; X64-NEXT: movq %rax, %rbx ; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill ; X64-NEXT: movq %rdx, %rbp ; X64-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill -; X64-NEXT: subq $1, %r13 +; X64-NEXT: subq $1, %rbx ; X64-NEXT: sbbq $0, %rbp -; X64-NEXT: testq %rbx, %rbx -; X64-NEXT: sets %al ; X64-NEXT: testq %r12, %r12 +; X64-NEXT: sets %al +; X64-NEXT: testq %r13, %r13 ; X64-NEXT: sets %r14b ; X64-NEXT: xorb %al, %r14b ; X64-NEXT: movq %r15, %rdi -; X64-NEXT: movq %rbx, %rsi +; X64-NEXT: movq %r12, %rsi ; X64-NEXT: movq (%rsp), %rdx # 8-byte Reload -; X64-NEXT: movq %r12, %rcx +; X64-NEXT: movq %r13, %rcx ; X64-NEXT: callq __modti3@PLT ; X64-NEXT: orq %rax, %rdx ; X64-NEXT: setne %al ; X64-NEXT: testb %r14b, %al ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %rbp # 8-byte Folded Reload -; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r13 # 8-byte Folded Reload +; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Folded Reload ; X64-NEXT: xorl %eax, %eax ; X64-NEXT: testq %rbp, %rbp -; X64-NEXT: movq $-1, %rcx -; X64-NEXT: movq $-1, %rdx -; X64-NEXT: cmovsq %r13, %rdx -; X64-NEXT: cmoveq %r13, %rdx ; X64-NEXT: cmovnsq %rax, %rbp +; X64-NEXT: movq $-1, %rcx +; X64-NEXT: cmovgq %rcx, %rbx ; X64-NEXT: testq %rbp, %rbp ; X64-NEXT: cmovnsq %rbp, %rcx -; X64-NEXT: cmovnsq %rdx, %rax ; X64-NEXT: cmpq $-1, %rbp -; X64-NEXT: cmoveq %rdx, %rax -; X64-NEXT: shrdq $1, %rcx, %rax +; X64-NEXT: cmovlq %rax, %rbx +; X64-NEXT: shrdq $1, %rcx, %rbx +; X64-NEXT: movq %rbx, %rax ; X64-NEXT: addq $24, %rsp ; X64-NEXT: popq %rbx ; X64-NEXT: popq %r12 @@ -402,18 +400,19 @@ ; X86-NEXT: pushl %eax ; X86-NEXT: calll __divti3 ; X86-NEXT: addl $32, %esp -; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi ; X86-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: subl $1, %eax -; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: sbbl $0, %esi +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; X86-NEXT: subl $1, %esi ; X86-NEXT: movl %ecx, %eax ; X86-NEXT: sbbl $0, %eax ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; X86-NEXT: movl %edx, %eax +; X86-NEXT: sbbl $0, %eax +; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx ; X86-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; X86-NEXT: sbbl $0, %ebx @@ -446,51 +445,50 @@ ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload ; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload ; X86-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload -; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Folded Reload +; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload +; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Folded Reload ; X86-NEXT: cmovel {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Folded Reload ; X86-NEXT: testl %ebx, %ebx -; X86-NEXT: movl $0, %edx -; X86-NEXT: cmovsl %ebx, %edx -; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF -; X86-NEXT: cmovsl %esi, %edx -; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: movl $-1, %edx -; X86-NEXT: cmovsl %eax, %edx +; X86-NEXT: movl $0, %eax +; X86-NEXT: cmovsl %ebx, %eax +; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; X86-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF +; X86-NEXT: cmovsl %edx, %eax +; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; X86-NEXT: movl $-1, %eax +; X86-NEXT: cmovsl %esi, %eax ; X86-NEXT: movl %ebx, %edi ; X86-NEXT: sarl $31, %edi ; X86-NEXT: andl %ecx, %edi ; X86-NEXT: testl %ebx, %ebx ; X86-NEXT: cmovel %ebx, %edi -; X86-NEXT: cmpl $2147483647, %esi # imm = 0x7FFFFFFF -; X86-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF -; X86-NEXT: cmovael %eax, %esi -; X86-NEXT: movl $-1, %eax -; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload -; X86-NEXT: cmovbl %ecx, %eax -; X86-NEXT: cmovel %ecx, %eax +; X86-NEXT: movl %edx, %ecx +; X86-NEXT: cmpl $2147483646, %edx # imm = 0x7FFFFFFE +; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF +; X86-NEXT: cmovbel %ecx, %edx +; X86-NEXT: testl %ecx, %ecx +; X86-NEXT: movl $-1, %ecx +; X86-NEXT: cmovsl %ecx, %esi ; X86-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Folded Reload -; X86-NEXT: cmovnel %edx, %eax -; X86-NEXT: cmovnel {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Folded Reload -; X86-NEXT: cmpl $-2147483648, %esi # imm = 0x80000000 -; X86-NEXT: movl $0, %ecx -; X86-NEXT: cmoval %eax, %ecx -; X86-NEXT: cmovel %eax, %ecx -; X86-NEXT: movl $-2147483648, %edx # imm = 0x80000000 -; X86-NEXT: cmoval %esi, %edx +; X86-NEXT: cmovnel %eax, %esi +; X86-NEXT: cmovnel {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Folded Reload +; X86-NEXT: cmpl $-2147483647, %edx # imm = 0x80000001 +; X86-NEXT: movl $-2147483648, %eax # imm = 0x80000000 +; X86-NEXT: cmovael %edx, %eax +; X86-NEXT: movl %edx, %ecx +; X86-NEXT: sarl $31, %ecx +; X86-NEXT: andl %esi, %ecx ; X86-NEXT: cmpl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload -; X86-NEXT: movl $0, %ebx -; X86-NEXT: cmovsl %ebx, %eax ; X86-NEXT: movl $-2147483648, %ebx # imm = 0x80000000 +; X86-NEXT: cmovsl %ebx, %edx +; X86-NEXT: movl $0, %ebx ; X86-NEXT: cmovsl %ebx, %esi ; X86-NEXT: andl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Folded Reload ; X86-NEXT: cmpl $-1, %edi -; X86-NEXT: cmovel %edx, %esi -; X86-NEXT: cmovel %ecx, %eax -; X86-NEXT: movl %esi, %edx +; X86-NEXT: cmovel %ecx, %esi +; X86-NEXT: cmovel %eax, %edx +; X86-NEXT: movl %esi, %eax ; X86-NEXT: leal -12(%ebp), %esp ; X86-NEXT: popl %esi ; X86-NEXT: popl %edi @@ -522,12 +520,12 @@ ; X64-NEXT: setne %dl ; X64-NEXT: testb %cl, %dl ; X64-NEXT: cmovel %eax, %edi -; X64-NEXT: cmpl $131071, %edi # imm = 0x1FFFF +; X64-NEXT: cmpl $131070, %edi # imm = 0x1FFFE ; X64-NEXT: movl $131071, %ecx # imm = 0x1FFFF -; X64-NEXT: cmovll %edi, %ecx -; X64-NEXT: cmpl $-131072, %ecx # imm = 0xFFFE0000 +; X64-NEXT: cmovlel %edi, %ecx +; X64-NEXT: cmpl $-131071, %ecx # imm = 0xFFFE0001 ; X64-NEXT: movl $-131072, %eax # imm = 0xFFFE0000 -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: retq ; ; X86-LABEL: func6: @@ -551,12 +549,12 @@ ; X86-NEXT: setne %dl ; X86-NEXT: testb %cl, %dl ; X86-NEXT: cmovel %eax, %edi -; X86-NEXT: cmpl $131071, %edi # imm = 0x1FFFF +; X86-NEXT: cmpl $131070, %edi # imm = 0x1FFFE ; X86-NEXT: movl $131071, %ecx # imm = 0x1FFFF -; X86-NEXT: cmovll %edi, %ecx -; X86-NEXT: cmpl $-131072, %ecx # imm = 0xFFFE0000 +; X86-NEXT: cmovlel %edi, %ecx +; X86-NEXT: cmpl $-131071, %ecx # imm = 0xFFFE0001 ; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE0000 -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: popl %esi ; X86-NEXT: popl %edi ; X86-NEXT: popl %ebx @@ -586,9 +584,9 @@ ; X64-NEXT: paddq %xmm0, %xmm0 ; X64-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill ; X64-NEXT: movq %xmm0, %rbx -; X64-NEXT: movq %rbx, %rbp -; X64-NEXT: sarq $63, %rbp -; X64-NEXT: shldq $31, %rbx, %rbp +; X64-NEXT: movq %rbx, %r14 +; X64-NEXT: sarq $63, %r14 +; X64-NEXT: shldq $31, %rbx, %r14 ; X64-NEXT: pxor %xmm0, %xmm0 ; X64-NEXT: pcmpgtd %xmm1, %xmm0 ; X64-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] @@ -600,43 +598,45 @@ ; X64-NEXT: movq %rbx, %r12 ; X64-NEXT: shlq $31, %r12 ; X64-NEXT: movq %r12, %rdi -; X64-NEXT: movq %rbp, %rsi +; X64-NEXT: movq %r14, %rsi ; X64-NEXT: movq %r15, %rcx ; X64-NEXT: callq __divti3@PLT ; X64-NEXT: movq %rax, %r13 ; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill -; X64-NEXT: movq %rdx, %r14 +; X64-NEXT: movq %rdx, %rbp ; X64-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill ; X64-NEXT: subq $1, %r13 -; X64-NEXT: sbbq $0, %r14 +; X64-NEXT: sbbq $0, %rbp ; X64-NEXT: shrq $63, %rbx ; X64-NEXT: xorl %r15d, %ebx ; X64-NEXT: movq %r12, %rdi -; X64-NEXT: movq %rbp, %rsi +; X64-NEXT: movq %r14, %rsi ; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload ; X64-NEXT: movq %r15, %rcx ; X64-NEXT: callq __modti3@PLT ; X64-NEXT: orq %rax, %rdx ; X64-NEXT: setne %al ; X64-NEXT: testb %bl, %al -; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r14 # 8-byte Folded Reload +; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %rbp # 8-byte Folded Reload ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r13 # 8-byte Folded Reload +; X64-NEXT: movl $4294967294, %eax # imm = 0xFFFFFFFE +; X64-NEXT: cmpq %rax, %r13 ; X64-NEXT: movl $4294967295, %edx # imm = 0xFFFFFFFF -; X64-NEXT: cmpq %rdx, %r13 ; X64-NEXT: movl $4294967295, %eax # imm = 0xFFFFFFFF -; X64-NEXT: cmovbq %r13, %rax +; X64-NEXT: cmovbeq %r13, %rax ; X64-NEXT: xorl %ecx, %ecx -; X64-NEXT: testq %r14, %r14 +; X64-NEXT: testq %rbp, %rbp ; X64-NEXT: cmovnsq %rdx, %r13 ; X64-NEXT: cmoveq %rax, %r13 -; X64-NEXT: cmovnsq %rcx, %r14 +; X64-NEXT: cmovnsq %rcx, %rbp +; X64-NEXT: movabsq $-4294967295, %rax # imm = 0xFFFFFFFF00000001 +; X64-NEXT: cmpq %rax, %r13 ; X64-NEXT: movabsq $-4294967296, %rcx # imm = 0xFFFFFFFF00000000 -; X64-NEXT: cmpq %rcx, %r13 ; X64-NEXT: movq %rcx, %rax -; X64-NEXT: cmovaq %r13, %rax -; X64-NEXT: testq %r14, %r14 +; X64-NEXT: cmovaeq %r13, %rax +; X64-NEXT: testq %rbp, %rbp ; X64-NEXT: cmovsq %rcx, %r13 -; X64-NEXT: cmpq $-1, %r14 +; X64-NEXT: cmpq $-1, %rbp ; X64-NEXT: cmoveq %rax, %r13 ; X64-NEXT: movq %r13, %xmm0 ; X64-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill @@ -676,19 +676,21 @@ ; X64-NEXT: testb %bl, %al ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r14 # 8-byte Folded Reload ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r12 # 8-byte Folded Reload -; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF -; X64-NEXT: cmpq %rcx, %r12 +; X64-NEXT: movl $4294967294, %eax # imm = 0xFFFFFFFE +; X64-NEXT: cmpq %rax, %r12 ; X64-NEXT: movl $4294967295, %eax # imm = 0xFFFFFFFF -; X64-NEXT: cmovbq %r12, %rax +; X64-NEXT: cmovbeq %r12, %rax ; X64-NEXT: testq %r14, %r14 +; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF ; X64-NEXT: cmovnsq %rcx, %r12 ; X64-NEXT: cmoveq %rax, %r12 ; X64-NEXT: movl $0, %eax ; X64-NEXT: cmovnsq %rax, %r14 +; X64-NEXT: movabsq $-4294967295, %rax # imm = 0xFFFFFFFF00000001 +; X64-NEXT: cmpq %rax, %r12 ; X64-NEXT: movabsq $-4294967296, %rcx # imm = 0xFFFFFFFF00000000 -; X64-NEXT: cmpq %rcx, %r12 ; X64-NEXT: movq %rcx, %rax -; X64-NEXT: cmovaq %r12, %rax +; X64-NEXT: cmovaeq %r12, %rax ; X64-NEXT: testq %r14, %r14 ; X64-NEXT: cmovsq %rcx, %r12 ; X64-NEXT: cmpq $-1, %r14 @@ -743,19 +745,21 @@ ; X64-NEXT: testb %bl, %al ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r14 # 8-byte Folded Reload ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r13 # 8-byte Folded Reload -; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF -; X64-NEXT: cmpq %rcx, %r13 +; X64-NEXT: movl $4294967294, %eax # imm = 0xFFFFFFFE +; X64-NEXT: cmpq %rax, %r13 ; X64-NEXT: movl $4294967295, %eax # imm = 0xFFFFFFFF -; X64-NEXT: cmovbq %r13, %rax +; X64-NEXT: cmovbeq %r13, %rax ; X64-NEXT: testq %r14, %r14 +; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF ; X64-NEXT: cmovnsq %rcx, %r13 ; X64-NEXT: cmoveq %rax, %r13 ; X64-NEXT: movl $0, %eax ; X64-NEXT: cmovnsq %rax, %r14 +; X64-NEXT: movabsq $-4294967295, %rax # imm = 0xFFFFFFFF00000001 +; X64-NEXT: cmpq %rax, %r13 ; X64-NEXT: movabsq $-4294967296, %rcx # imm = 0xFFFFFFFF00000000 -; X64-NEXT: cmpq %rcx, %r13 ; X64-NEXT: movq %rcx, %rax -; X64-NEXT: cmovaq %r13, %rax +; X64-NEXT: cmovaeq %r13, %rax ; X64-NEXT: testq %r14, %r14 ; X64-NEXT: cmovsq %rcx, %r13 ; X64-NEXT: cmpq $-1, %r14 @@ -798,19 +802,21 @@ ; X64-NEXT: testb %bl, %al ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r14 # 8-byte Folded Reload ; X64-NEXT: cmoveq {{[-0-9]+}}(%r{{[sb]}}p), %r12 # 8-byte Folded Reload -; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF -; X64-NEXT: cmpq %rcx, %r12 +; X64-NEXT: movl $4294967294, %eax # imm = 0xFFFFFFFE +; X64-NEXT: cmpq %rax, %r12 ; X64-NEXT: movl $4294967295, %eax # imm = 0xFFFFFFFF -; X64-NEXT: cmovbq %r12, %rax +; X64-NEXT: cmovbeq %r12, %rax ; X64-NEXT: testq %r14, %r14 +; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF ; X64-NEXT: cmovnsq %rcx, %r12 ; X64-NEXT: cmoveq %rax, %r12 ; X64-NEXT: movl $0, %eax ; X64-NEXT: cmovnsq %rax, %r14 +; X64-NEXT: movabsq $-4294967295, %rax # imm = 0xFFFFFFFF00000001 +; X64-NEXT: cmpq %rax, %r12 ; X64-NEXT: movabsq $-4294967296, %rcx # imm = 0xFFFFFFFF00000000 -; X64-NEXT: cmpq %rcx, %r12 ; X64-NEXT: movq %rcx, %rax -; X64-NEXT: cmovaq %r12, %rax +; X64-NEXT: cmovaeq %r12, %rax ; X64-NEXT: testq %r14, %r14 ; X64-NEXT: cmovsq %rcx, %r12 ; X64-NEXT: cmpq $-1, %r14 diff --git a/llvm/test/CodeGen/X86/select.ll b/llvm/test/CodeGen/X86/select.ll --- a/llvm/test/CodeGen/X86/select.ll +++ b/llvm/test/CodeGen/X86/select.ll @@ -1057,16 +1057,16 @@ ; GENERIC-LABEL: test18: ; GENERIC: ## %bb.0: ; GENERIC-NEXT: movl %esi, %eax -; GENERIC-NEXT: cmpl $15, %edi -; GENERIC-NEXT: cmovgel %edx, %eax +; GENERIC-NEXT: cmpl $14, %edi +; GENERIC-NEXT: cmovgl %edx, %eax ; GENERIC-NEXT: ## kill: def $al killed $al killed $eax ; GENERIC-NEXT: retq ; ; ATOM-LABEL: test18: ; ATOM: ## %bb.0: ; ATOM-NEXT: movl %esi, %eax -; ATOM-NEXT: cmpl $15, %edi -; ATOM-NEXT: cmovgel %edx, %eax +; ATOM-NEXT: cmpl $14, %edi +; ATOM-NEXT: cmovgl %edx, %eax ; ATOM-NEXT: ## kill: def $al killed $al killed $eax ; ATOM-NEXT: nop ; ATOM-NEXT: nop @@ -1074,17 +1074,17 @@ ; ; ATHLON-LABEL: test18: ; ATHLON: ## %bb.0: -; ATHLON-NEXT: cmpl $15, {{[0-9]+}}(%esp) +; ATHLON-NEXT: cmpl $14, {{[0-9]+}}(%esp) ; ATHLON-NEXT: leal {{[0-9]+}}(%esp), %eax ; ATHLON-NEXT: leal {{[0-9]+}}(%esp), %ecx -; ATHLON-NEXT: cmovll %eax, %ecx +; ATHLON-NEXT: cmovlel %eax, %ecx ; ATHLON-NEXT: movb (%ecx), %al ; ATHLON-NEXT: retl ; ; MCU-LABEL: test18: ; MCU: # %bb.0: -; MCU-NEXT: cmpl $15, %eax -; MCU-NEXT: jl .LBB19_2 +; MCU-NEXT: cmpl $14, %eax +; MCU-NEXT: jle .LBB19_2 ; MCU-NEXT: # %bb.1: ; MCU-NEXT: movl %ecx, %edx ; MCU-NEXT: .LBB19_2: @@ -1202,23 +1202,23 @@ define void @clamp(i32 %src, i16* %dst) { ; GENERIC-LABEL: clamp: ; GENERIC: ## %bb.0: -; GENERIC-NEXT: cmpl $32767, %edi ## imm = 0x7FFF +; GENERIC-NEXT: cmpl $32768, %edi ## imm = 0x8000 ; GENERIC-NEXT: movl $32767, %eax ## imm = 0x7FFF -; GENERIC-NEXT: cmovlel %edi, %eax -; GENERIC-NEXT: cmpl $-32768, %eax ## imm = 0x8000 +; GENERIC-NEXT: cmovll %edi, %eax +; GENERIC-NEXT: cmpl $-32769, %eax ## imm = 0xFFFF7FFF ; GENERIC-NEXT: movl $32768, %ecx ## imm = 0x8000 -; GENERIC-NEXT: cmovgel %eax, %ecx +; GENERIC-NEXT: cmovgl %eax, %ecx ; GENERIC-NEXT: movw %cx, (%rsi) ; GENERIC-NEXT: retq ; ; ATOM-LABEL: clamp: ; ATOM: ## %bb.0: -; ATOM-NEXT: cmpl $32767, %edi ## imm = 0x7FFF +; ATOM-NEXT: cmpl $32768, %edi ## imm = 0x8000 ; ATOM-NEXT: movl $32767, %eax ## imm = 0x7FFF ; ATOM-NEXT: movl $32768, %ecx ## imm = 0x8000 -; ATOM-NEXT: cmovlel %edi, %eax -; ATOM-NEXT: cmpl $-32768, %eax ## imm = 0x8000 -; ATOM-NEXT: cmovgel %eax, %ecx +; ATOM-NEXT: cmovll %edi, %eax +; ATOM-NEXT: cmpl $-32769, %eax ## imm = 0xFFFF7FFF +; ATOM-NEXT: cmovgl %eax, %ecx ; ATOM-NEXT: movw %cx, (%rsi) ; ATOM-NEXT: retq ; @@ -1226,26 +1226,26 @@ ; ATHLON: ## %bb.0: ; ATHLON-NEXT: movl {{[0-9]+}}(%esp), %eax ; ATHLON-NEXT: movl {{[0-9]+}}(%esp), %ecx -; ATHLON-NEXT: cmpl $32767, %ecx ## imm = 0x7FFF +; ATHLON-NEXT: cmpl $32768, %ecx ## imm = 0x8000 ; ATHLON-NEXT: movl $32767, %edx ## imm = 0x7FFF -; ATHLON-NEXT: cmovlel %ecx, %edx -; ATHLON-NEXT: cmpl $-32768, %edx ## imm = 0x8000 +; ATHLON-NEXT: cmovll %ecx, %edx +; ATHLON-NEXT: cmpl $-32769, %edx ## imm = 0xFFFF7FFF ; ATHLON-NEXT: movl $32768, %ecx ## imm = 0x8000 -; ATHLON-NEXT: cmovgel %edx, %ecx +; ATHLON-NEXT: cmovgl %edx, %ecx ; ATHLON-NEXT: movw %cx, (%eax) ; ATHLON-NEXT: retl ; ; MCU-LABEL: clamp: ; MCU: # %bb.0: -; MCU-NEXT: cmpl $32767, %eax # imm = 0x7FFF +; MCU-NEXT: cmpl $32768, %eax # imm = 0x8000 ; MCU-NEXT: movl $32767, %ecx # imm = 0x7FFF -; MCU-NEXT: jg .LBB22_2 +; MCU-NEXT: jge .LBB22_2 ; MCU-NEXT: # %bb.1: ; MCU-NEXT: movl %eax, %ecx ; MCU-NEXT: .LBB22_2: -; MCU-NEXT: cmpl $-32768, %ecx # imm = 0x8000 +; MCU-NEXT: cmpl $-32769, %ecx # imm = 0xFFFF7FFF ; MCU-NEXT: movl $32768, %eax # imm = 0x8000 -; MCU-NEXT: jl .LBB22_4 +; MCU-NEXT: jle .LBB22_4 ; MCU-NEXT: # %bb.3: ; MCU-NEXT: movl %ecx, %eax ; MCU-NEXT: .LBB22_4: diff --git a/llvm/test/CodeGen/X86/select_const.ll b/llvm/test/CodeGen/X86/select_const.ll --- a/llvm/test/CodeGen/X86/select_const.ll +++ b/llvm/test/CodeGen/X86/select_const.ll @@ -252,8 +252,10 @@ define i64 @sel_1_2(i64 %x, i64 %y) { ; CHECK-LABEL: sel_1_2: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpq $42, %rdi -; CHECK-NEXT: sbbq $0, %rsi +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: cmpq $41, %rdi +; CHECK-NEXT: setbe %al +; CHECK-NEXT: subq %rax, %rsi ; CHECK-NEXT: leaq 2(%rsi), %rax ; CHECK-NEXT: retq %cmp = icmp ult i64 %x, 42 @@ -267,8 +269,8 @@ define i8 @sel_1_neg1(i32 %x) { ; CHECK-LABEL: sel_1_neg1: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $42, %edi -; CHECK-NEXT: setg %al +; CHECK-NEXT: cmpl $43, %edi +; CHECK-NEXT: setge %al ; CHECK-NEXT: shlb $2, %al ; CHECK-NEXT: decb %al ; CHECK-NEXT: retq @@ -283,8 +285,8 @@ ; CHECK-LABEL: sel_neg1_1: ; CHECK: # %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $43, %edi -; CHECK-NEXT: setl %al +; CHECK-NEXT: cmpl $42, %edi +; CHECK-NEXT: setle %al ; CHECK-NEXT: leal -1(,%rax,4), %eax ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax ; CHECK-NEXT: retq @@ -299,8 +301,8 @@ ; CHECK-LABEL: sel_1_neg1_32: ; CHECK: # %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $42, %edi -; CHECK-NEXT: setg %al +; CHECK-NEXT: cmpl $43, %edi +; CHECK-NEXT: setge %al ; CHECK-NEXT: leal -1(%rax,%rax,8), %eax ; CHECK-NEXT: retq %cmp = icmp sgt i32 %x, 42 @@ -312,8 +314,8 @@ ; CHECK-LABEL: sel_neg1_1_32: ; CHECK: # %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpl $43, %edi -; CHECK-NEXT: setl %al +; CHECK-NEXT: cmpl $42, %edi +; CHECK-NEXT: setle %al ; CHECK-NEXT: leal -7(%rax,%rax,8), %eax ; CHECK-NEXT: retq %cmp = icmp sgt i32 %x, 42 @@ -378,10 +380,10 @@ define i8 @sel_67_neg125(i32 %x) { ; CHECK-LABEL: sel_67_neg125: ; CHECK: # %bb.0: -; CHECK-NEXT: cmpl $42, %edi +; CHECK-NEXT: cmpl $43, %edi ; CHECK-NEXT: movl $67, %ecx ; CHECK-NEXT: movl $131, %eax -; CHECK-NEXT: cmovgl %ecx, %eax +; CHECK-NEXT: cmovgel %ecx, %eax ; CHECK-NEXT: # kill: def $al killed $al killed $eax ; CHECK-NEXT: retq %cmp = icmp sgt i32 %x, 42 diff --git a/llvm/test/CodeGen/X86/setcc-logic.ll b/llvm/test/CodeGen/X86/setcc-logic.ll --- a/llvm/test/CodeGen/X86/setcc-logic.ll +++ b/llvm/test/CodeGen/X86/setcc-logic.ll @@ -456,8 +456,8 @@ ; CHECK-LABEL: ne_neg1_and_ne_zero: ; CHECK: # %bb.0: ; CHECK-NEXT: incq %rdi -; CHECK-NEXT: cmpq $1, %rdi -; CHECK-NEXT: seta %al +; CHECK-NEXT: cmpq $2, %rdi +; CHECK-NEXT: setae %al ; CHECK-NEXT: retq %cmp1 = icmp ne i64 %x, -1 %cmp2 = icmp ne i64 %x, 0 @@ -580,8 +580,8 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: cmpl $43, %edi ; CHECK-NEXT: sete %cl -; CHECK-NEXT: cmpl $45, %edi -; CHECK-NEXT: setl %al +; CHECK-NEXT: cmpl $44, %edi +; CHECK-NEXT: setle %al ; CHECK-NEXT: orb %cl, %al ; CHECK-NEXT: retq %a = icmp eq i32 %x, 43 diff --git a/llvm/test/CodeGen/X86/setcc-lowering.ll b/llvm/test/CodeGen/X86/setcc-lowering.ll --- a/llvm/test/CodeGen/X86/setcc-lowering.ll +++ b/llvm/test/CodeGen/X86/setcc-lowering.ll @@ -46,8 +46,8 @@ ; AVX-NEXT: .LBB1_1: # %for_loop599 ; AVX-NEXT: # =>This Inner Loop Header: Depth=1 ; AVX-NEXT: xorl %eax, %eax -; AVX-NEXT: cmpq $65536, %rdi # imm = 0x10000 -; AVX-NEXT: setl %al +; AVX-NEXT: cmpq $65535, %rdi # imm = 0xFFFF +; AVX-NEXT: setle %al ; AVX-NEXT: vmovd %eax, %xmm2 ; AVX-NEXT: vpshufb %xmm1, %xmm2, %xmm2 ; AVX-NEXT: vpand %xmm0, %xmm2, %xmm2 diff --git a/llvm/test/CodeGen/X86/setcc.ll b/llvm/test/CodeGen/X86/setcc.ll --- a/llvm/test/CodeGen/X86/setcc.ll +++ b/llvm/test/CodeGen/X86/setcc.ll @@ -6,8 +6,8 @@ ; CHECK-LABEL: t1: ; CHECK: ## %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpw $26, %di -; CHECK-NEXT: seta %al +; CHECK-NEXT: cmpw $27, %di +; CHECK-NEXT: setae %al ; CHECK-NEXT: shll $5, %eax ; CHECK-NEXT: retq %t0 = icmp ugt i16 %x, 26 @@ -19,8 +19,8 @@ ; CHECK-LABEL: t2: ; CHECK: ## %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpw $26, %di -; CHECK-NEXT: setb %al +; CHECK-NEXT: cmpw $25, %di +; CHECK-NEXT: setbe %al ; CHECK-NEXT: shll $5, %eax ; CHECK-NEXT: retq %t0 = icmp ult i16 %x, 26 @@ -32,8 +32,8 @@ ; CHECK-LABEL: t3: ; CHECK: ## %bb.0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: cmpq $18, %rdi -; CHECK-NEXT: setb %al +; CHECK-NEXT: cmpq $17, %rdi +; CHECK-NEXT: setbe %al ; CHECK-NEXT: shlq $6, %rax ; CHECK-NEXT: retq %t0 = icmp ult i64 %x, 18 diff --git a/llvm/test/CodeGen/X86/shift-i128.ll b/llvm/test/CodeGen/X86/shift-i128.ll --- a/llvm/test/CodeGen/X86/shift-i128.ll +++ b/llvm/test/CodeGen/X86/shift-i128.ll @@ -13,112 +13,88 @@ ; i686-NEXT: pushl %ebx ; i686-NEXT: pushl %edi ; i686-NEXT: pushl %esi -; i686-NEXT: subl $20, %esp +; i686-NEXT: subl $8, %esp +; i686-NEXT: movl {{[0-9]+}}(%esp), %eax ; i686-NEXT: movl {{[0-9]+}}(%esp), %edx -; i686-NEXT: movb {{[0-9]+}}(%esp), %al -; i686-NEXT: movl {{[0-9]+}}(%esp), %edi -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebp -; i686-NEXT: movl %ebp, %esi -; i686-NEXT: movl %eax, %ecx -; i686-NEXT: shrdl %cl, %edi, %esi -; i686-NEXT: shrl %cl, %edx +; i686-NEXT: movb {{[0-9]+}}(%esp), %ch +; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx +; i686-NEXT: movl %ebx, %edi +; i686-NEXT: movb %ch, %cl ; i686-NEXT: shrl %cl, %edi -; i686-NEXT: movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill -; i686-NEXT: testb $32, %al +; i686-NEXT: movl %edx, %esi +; i686-NEXT: shrl %cl, %esi +; i686-NEXT: shrdl %cl, %edx, %eax +; i686-NEXT: testb $32, %ch +; i686-NEXT: movl {{[0-9]+}}(%esp), %ebp ; i686-NEXT: jne .LBB0_1 ; i686-NEXT: # %bb.2: # %entry -; i686-NEXT: movl %edx, (%esp) # 4-byte Spill +; i686-NEXT: movl %edi, (%esp) # 4-byte Spill ; i686-NEXT: jmp .LBB0_3 ; i686-NEXT: .LBB0_1: -; i686-NEXT: movl %edi, %esi +; i686-NEXT: movl %esi, %eax ; i686-NEXT: movl $0, (%esp) # 4-byte Folded Spill -; i686-NEXT: xorl %edi, %edi +; i686-NEXT: xorl %esi, %esi ; i686-NEXT: .LBB0_3: # %entry -; i686-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: movl %eax, %edx -; i686-NEXT: subb $64, %dl -; i686-NEXT: jb .LBB0_5 +; i686-NEXT: movl %ebp, %edx +; i686-NEXT: movb %ch, %cl +; i686-NEXT: shrdl %cl, %ebx, %edx +; i686-NEXT: testb $32, %ch +; i686-NEXT: jne .LBB0_5 ; i686-NEXT: # %bb.4: # %entry -; i686-NEXT: xorl %edi, %edi +; i686-NEXT: movl %edx, %edi ; i686-NEXT: .LBB0_5: # %entry ; i686-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: negb %dl -; i686-NEXT: movl {{[0-9]+}}(%esp), %edi -; i686-NEXT: movl %edx, %ecx +; i686-NEXT: movb $64, %cl +; i686-NEXT: subb %ch, %cl +; i686-NEXT: movl %ebx, %edi ; i686-NEXT: shldl %cl, %ebp, %edi -; i686-NEXT: movl %ebp, %esi -; i686-NEXT: shll %cl, %esi -; i686-NEXT: testb $32, %dl -; i686-NEXT: movl %esi, %ebx -; i686-NEXT: jne .LBB0_7 -; i686-NEXT: # %bb.6: # %entry -; i686-NEXT: movl %edi, %ebx +; i686-NEXT: movl %ebp, %edx +; i686-NEXT: shll %cl, %edx +; i686-NEXT: testb $32, %cl +; i686-NEXT: je .LBB0_7 +; i686-NEXT: # %bb.6: +; i686-NEXT: movl %edx, %edi +; i686-NEXT: xorl %edx, %edx ; i686-NEXT: .LBB0_7: # %entry -; i686-NEXT: movb %al, %ah -; i686-NEXT: addb $-64, %ah -; i686-NEXT: movl {{[0-9]+}}(%esp), %edi -; i686-NEXT: movb %ah, %cl -; i686-NEXT: shrl %cl, %edi -; i686-NEXT: testb $32, %ah -; i686-NEXT: movl $0, %ecx -; i686-NEXT: jne .LBB0_9 -; i686-NEXT: # %bb.8: # %entry -; i686-NEXT: movl %edi, %ecx +; i686-NEXT: movb %ch, %cl +; i686-NEXT: addb $-64, %cl +; i686-NEXT: shrdl %cl, %ebx, %ebp +; i686-NEXT: shrl %cl, %ebx +; i686-NEXT: testb $32, %cl +; i686-NEXT: je .LBB0_9 +; i686-NEXT: # %bb.8: +; i686-NEXT: movl %ebx, %ebp +; i686-NEXT: xorl %ebx, %ebx ; i686-NEXT: .LBB0_9: # %entry -; i686-NEXT: cmpb $64, %al -; i686-NEXT: jb .LBB0_10 +; i686-NEXT: cmpb $63, %ch +; i686-NEXT: jbe .LBB0_10 ; i686-NEXT: # %bb.11: # %entry -; i686-NEXT: movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill +; i686-NEXT: xorl %esi, %esi +; i686-NEXT: xorl %edi, %edi +; i686-NEXT: movl {{[0-9]+}}(%esp), %edx ; i686-NEXT: jmp .LBB0_12 ; i686-NEXT: .LBB0_10: -; i686-NEXT: movl (%esp), %ecx # 4-byte Reload -; i686-NEXT: orl %ebx, %ecx +; i686-NEXT: orl %edx, %eax +; i686-NEXT: orl %edi, %esi +; i686-NEXT: movl %esi, %ebx +; i686-NEXT: movl %eax, %ebp +; i686-NEXT: movl {{[0-9]+}}(%esp), %edx +; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload +; i686-NEXT: movl (%esp), %edi # 4-byte Reload ; i686-NEXT: .LBB0_12: # %entry -; i686-NEXT: movl %ecx, (%esp) # 4-byte Spill -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx -; i686-NEXT: testb $32, %dl -; i686-NEXT: jne .LBB0_14 +; i686-NEXT: movl {{[0-9]+}}(%esp), %eax +; i686-NEXT: testb %ch, %ch +; i686-NEXT: movl {{[0-9]+}}(%esp), %ecx +; i686-NEXT: je .LBB0_14 ; i686-NEXT: # %bb.13: # %entry -; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: .LBB0_14: # %entry +; i686-NEXT: movl %ebp, %ecx ; i686-NEXT: movl %ebx, %edx -; i686-NEXT: movl %eax, %ecx -; i686-NEXT: movl {{[0-9]+}}(%esp), %esi -; i686-NEXT: shrdl %cl, %esi, %edx -; i686-NEXT: testb $32, %al -; i686-NEXT: jne .LBB0_16 -; i686-NEXT: # %bb.15: # %entry -; i686-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: .LBB0_16: # %entry -; i686-NEXT: movb %ah, %cl -; i686-NEXT: movl {{[0-9]+}}(%esp), %edx -; i686-NEXT: shrdl %cl, %edx, %ebp -; i686-NEXT: testb $32, %ah -; i686-NEXT: jne .LBB0_18 -; i686-NEXT: # %bb.17: # %entry -; i686-NEXT: movl %ebp, %edi -; i686-NEXT: .LBB0_18: # %entry -; i686-NEXT: cmpb $64, %al -; i686-NEXT: jae .LBB0_20 -; i686-NEXT: # %bb.19: -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload -; i686-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Folded Reload -; i686-NEXT: .LBB0_20: # %entry -; i686-NEXT: movl {{[0-9]+}}(%esp), %ecx -; i686-NEXT: testb %al, %al -; i686-NEXT: je .LBB0_22 -; i686-NEXT: # %bb.21: # %entry -; i686-NEXT: movl %edi, %ebx -; i686-NEXT: movl (%esp), %esi # 4-byte Reload -; i686-NEXT: .LBB0_22: # %entry -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; i686-NEXT: movl %eax, 12(%ecx) -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; i686-NEXT: movl %eax, 8(%ecx) -; i686-NEXT: movl %esi, 4(%ecx) -; i686-NEXT: movl %ebx, (%ecx) -; i686-NEXT: addl $20, %esp +; i686-NEXT: .LBB0_14: # %entry +; i686-NEXT: movl %edi, 12(%eax) +; i686-NEXT: movl %esi, 8(%eax) +; i686-NEXT: movl %edx, 4(%eax) +; i686-NEXT: movl %ecx, (%eax) +; i686-NEXT: addl $8, %esp ; i686-NEXT: popl %esi ; i686-NEXT: popl %edi ; i686-NEXT: popl %ebx @@ -150,116 +126,91 @@ ; i686-NEXT: pushl %ebx ; i686-NEXT: pushl %edi ; i686-NEXT: pushl %esi -; i686-NEXT: subl $24, %esp +; i686-NEXT: subl $12, %esp +; i686-NEXT: movl {{[0-9]+}}(%esp), %eax ; i686-NEXT: movl {{[0-9]+}}(%esp), %edx -; i686-NEXT: movb {{[0-9]+}}(%esp), %al -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx +; i686-NEXT: movb {{[0-9]+}}(%esp), %ch +; i686-NEXT: movl {{[0-9]+}}(%esp), %edi +; i686-NEXT: movl %edi, %ebx +; i686-NEXT: movb %ch, %cl +; i686-NEXT: sarl %cl, %ebx +; i686-NEXT: movl %edx, %esi +; i686-NEXT: shrl %cl, %esi +; i686-NEXT: shrdl %cl, %edx, %eax +; i686-NEXT: movl %edi, %edx +; i686-NEXT: sarl $31, %edx +; i686-NEXT: testb $32, %ch ; i686-NEXT: movl {{[0-9]+}}(%esp), %ebp -; i686-NEXT: movl %ebp, %esi -; i686-NEXT: movl %eax, %ecx -; i686-NEXT: shrdl %cl, %ebx, %esi -; i686-NEXT: shrl %cl, %edx -; i686-NEXT: movl %ebx, %edi -; i686-NEXT: sarl %cl, %edi -; i686-NEXT: sarl $31, %ebx -; i686-NEXT: movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill -; i686-NEXT: testb $32, %al -; i686-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; i686-NEXT: jne .LBB1_1 ; i686-NEXT: # %bb.2: # %entry -; i686-NEXT: movl %edx, (%esp) # 4-byte Spill +; i686-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: movl %ebx, (%esp) # 4-byte Spill ; i686-NEXT: jmp .LBB1_3 ; i686-NEXT: .LBB1_1: -; i686-NEXT: movl %edi, %esi -; i686-NEXT: movl $0, (%esp) # 4-byte Folded Spill -; i686-NEXT: movl %ebx, %edi -; i686-NEXT: .LBB1_3: # %entry ; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: movl %eax, %edx -; i686-NEXT: subb $64, %dl -; i686-NEXT: jb .LBB1_5 +; i686-NEXT: movl %edx, (%esp) # 4-byte Spill +; i686-NEXT: xorl %esi, %esi +; i686-NEXT: .LBB1_3: # %entry +; i686-NEXT: movl %edx, %ebx +; i686-NEXT: movl %ebp, %eax +; i686-NEXT: movb %ch, %cl +; i686-NEXT: shrdl %cl, %edi, %eax +; i686-NEXT: testb $32, %ch +; i686-NEXT: jne .LBB1_5 ; i686-NEXT: # %bb.4: # %entry -; i686-NEXT: movl %ebx, %edi +; i686-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; i686-NEXT: .LBB1_5: # %entry -; i686-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: negb %dl -; i686-NEXT: movl {{[0-9]+}}(%esp), %edi -; i686-NEXT: movl %edx, %ecx -; i686-NEXT: shldl %cl, %ebp, %edi -; i686-NEXT: movl %ebp, %esi -; i686-NEXT: shll %cl, %esi -; i686-NEXT: testb $32, %dl -; i686-NEXT: movl %esi, %ecx -; i686-NEXT: jne .LBB1_7 -; i686-NEXT: # %bb.6: # %entry -; i686-NEXT: movl %edi, %ecx +; i686-NEXT: movb $64, %cl +; i686-NEXT: subb %ch, %cl +; i686-NEXT: movl %edi, %eax +; i686-NEXT: shldl %cl, %ebp, %eax +; i686-NEXT: movl %ebp, %edx +; i686-NEXT: shll %cl, %edx +; i686-NEXT: testb $32, %cl +; i686-NEXT: je .LBB1_7 +; i686-NEXT: # %bb.6: +; i686-NEXT: movl %edx, %eax +; i686-NEXT: xorl %edx, %edx ; i686-NEXT: .LBB1_7: # %entry -; i686-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: movb %al, %ah -; i686-NEXT: addb $-64, %ah -; i686-NEXT: movl {{[0-9]+}}(%esp), %edi -; i686-NEXT: movb %ah, %cl +; i686-NEXT: movb %ch, %cl +; i686-NEXT: addb $-64, %cl +; i686-NEXT: shrdl %cl, %edi, %ebp ; i686-NEXT: sarl %cl, %edi -; i686-NEXT: testb $32, %ah -; i686-NEXT: movl %ebx, %ecx -; i686-NEXT: jne .LBB1_9 -; i686-NEXT: # %bb.8: # %entry -; i686-NEXT: movl %edi, %ecx +; i686-NEXT: testb $32, %cl +; i686-NEXT: je .LBB1_9 +; i686-NEXT: # %bb.8: +; i686-NEXT: movl %edi, %ebp +; i686-NEXT: movl %ebx, %edi ; i686-NEXT: .LBB1_9: # %entry -; i686-NEXT: cmpb $64, %al -; i686-NEXT: jb .LBB1_10 +; i686-NEXT: cmpb $63, %ch +; i686-NEXT: jbe .LBB1_10 ; i686-NEXT: # %bb.11: # %entry -; i686-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: movl %ebx, %esi +; i686-NEXT: movl {{[0-9]+}}(%esp), %edx ; i686-NEXT: jmp .LBB1_12 ; i686-NEXT: .LBB1_10: -; i686-NEXT: movl (%esp), %ecx # 4-byte Reload -; i686-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload +; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Reload +; i686-NEXT: orl %edx, %ebp +; i686-NEXT: orl %eax, %esi +; i686-NEXT: movl %esi, %edi +; i686-NEXT: movl {{[0-9]+}}(%esp), %edx +; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload +; i686-NEXT: movl (%esp), %ebx # 4-byte Reload ; i686-NEXT: .LBB1_12: # %entry -; i686-NEXT: movl %ecx, (%esp) # 4-byte Spill -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx -; i686-NEXT: testb $32, %dl -; i686-NEXT: jne .LBB1_14 +; i686-NEXT: movl {{[0-9]+}}(%esp), %eax +; i686-NEXT: testb %ch, %ch +; i686-NEXT: movl {{[0-9]+}}(%esp), %ecx +; i686-NEXT: je .LBB1_14 ; i686-NEXT: # %bb.13: # %entry -; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: movl %ebp, %ecx +; i686-NEXT: movl %edi, %edx ; i686-NEXT: .LBB1_14: # %entry -; i686-NEXT: movl %ebx, %edx -; i686-NEXT: movl %eax, %ecx -; i686-NEXT: movl {{[0-9]+}}(%esp), %esi -; i686-NEXT: shrdl %cl, %esi, %edx -; i686-NEXT: testb $32, %al -; i686-NEXT: jne .LBB1_16 -; i686-NEXT: # %bb.15: # %entry -; i686-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: .LBB1_16: # %entry -; i686-NEXT: movb %ah, %cl -; i686-NEXT: movl {{[0-9]+}}(%esp), %edx -; i686-NEXT: shrdl %cl, %edx, %ebp -; i686-NEXT: testb $32, %ah -; i686-NEXT: jne .LBB1_18 -; i686-NEXT: # %bb.17: # %entry -; i686-NEXT: movl %ebp, %edi -; i686-NEXT: .LBB1_18: # %entry -; i686-NEXT: cmpb $64, %al -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload -; i686-NEXT: jae .LBB1_20 -; i686-NEXT: # %bb.19: -; i686-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload -; i686-NEXT: movl %ecx, %edi -; i686-NEXT: .LBB1_20: # %entry -; i686-NEXT: movl {{[0-9]+}}(%esp), %ecx -; i686-NEXT: testb %al, %al -; i686-NEXT: je .LBB1_22 -; i686-NEXT: # %bb.21: # %entry -; i686-NEXT: movl %edi, %ebx -; i686-NEXT: movl (%esp), %esi # 4-byte Reload -; i686-NEXT: .LBB1_22: # %entry -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; i686-NEXT: movl %eax, 12(%ecx) -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; i686-NEXT: movl %eax, 8(%ecx) -; i686-NEXT: movl %esi, 4(%ecx) -; i686-NEXT: movl %ebx, (%ecx) -; i686-NEXT: addl $24, %esp +; i686-NEXT: movl %ebx, 12(%eax) +; i686-NEXT: movl %esi, 8(%eax) +; i686-NEXT: movl %edx, 4(%eax) +; i686-NEXT: movl %ecx, (%eax) +; i686-NEXT: addl $12, %esp ; i686-NEXT: popl %esi ; i686-NEXT: popl %edi ; i686-NEXT: popl %ebx @@ -292,113 +243,92 @@ ; i686-NEXT: pushl %ebx ; i686-NEXT: pushl %edi ; i686-NEXT: pushl %esi -; i686-NEXT: subl $20, %esp -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebp +; i686-NEXT: subl $16, %esp ; i686-NEXT: movl {{[0-9]+}}(%esp), %edi -; i686-NEXT: movb {{[0-9]+}}(%esp), %al -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx -; i686-NEXT: movl %eax, %ecx -; i686-NEXT: shll %cl, %ebx -; i686-NEXT: movl %ebp, %esi -; i686-NEXT: shll %cl, %esi -; i686-NEXT: movl %edi, %edx -; i686-NEXT: shldl %cl, %ebp, %edx -; i686-NEXT: movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill -; i686-NEXT: testb $32, %al +; i686-NEXT: movl {{[0-9]+}}(%esp), %edx +; i686-NEXT: movl {{[0-9]+}}(%esp), %esi +; i686-NEXT: movb {{[0-9]+}}(%esp), %ch +; i686-NEXT: movb $64, %cl +; i686-NEXT: subb %ch, %cl +; i686-NEXT: movl %esi, %ebx +; i686-NEXT: shrl %cl, %ebx +; i686-NEXT: shrdl %cl, %esi, %edx +; i686-NEXT: testb $32, %cl +; i686-NEXT: movl {{[0-9]+}}(%esp), %eax ; i686-NEXT: jne .LBB2_1 ; i686-NEXT: # %bb.2: # %entry -; i686-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; i686-NEXT: movl %ebx, (%esp) # 4-byte Spill ; i686-NEXT: jmp .LBB2_3 ; i686-NEXT: .LBB2_1: -; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: movl %ebx, %edx ; i686-NEXT: movl $0, (%esp) # 4-byte Folded Spill -; i686-NEXT: xorl %esi, %esi ; i686-NEXT: .LBB2_3: # %entry -; i686-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: movl %eax, %edx -; i686-NEXT: subb $64, %dl -; i686-NEXT: jb .LBB2_5 -; i686-NEXT: # %bb.4: # %entry -; i686-NEXT: xorl %esi, %esi -; i686-NEXT: .LBB2_5: # %entry -; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: negb %dl -; i686-NEXT: movl %edi, %esi -; i686-NEXT: movl %edx, %ecx -; i686-NEXT: shrl %cl, %esi -; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx -; i686-NEXT: shrdl %cl, %edi, %ebx -; i686-NEXT: testb $32, %dl -; i686-NEXT: movl %esi, %ebp -; i686-NEXT: jne .LBB2_7 -; i686-NEXT: # %bb.6: # %entry -; i686-NEXT: movl %ebx, %ebp -; i686-NEXT: .LBB2_7: # %entry -; i686-NEXT: movb %al, %ah -; i686-NEXT: addb $-64, %ah +; i686-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: movb %ch, %cl +; i686-NEXT: shldl %cl, %edi, %eax ; i686-NEXT: movl {{[0-9]+}}(%esp), %ebx -; i686-NEXT: movb %ah, %cl ; i686-NEXT: shll %cl, %ebx -; i686-NEXT: testb $32, %ah -; i686-NEXT: movl $0, %ecx -; i686-NEXT: jne .LBB2_9 -; i686-NEXT: # %bb.8: # %entry -; i686-NEXT: movl %ebx, %ecx -; i686-NEXT: .LBB2_9: # %entry -; i686-NEXT: cmpb $64, %al -; i686-NEXT: jb .LBB2_10 -; i686-NEXT: # %bb.11: # %entry +; i686-NEXT: shll %cl, %edi +; i686-NEXT: testb $32, %ch +; i686-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: jne .LBB2_4 +; i686-NEXT: # %bb.5: # %entry +; i686-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill +; i686-NEXT: jmp .LBB2_6 +; i686-NEXT: .LBB2_4: +; i686-NEXT: movl %edi, %eax ; i686-NEXT: movl $0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill -; i686-NEXT: jmp .LBB2_12 -; i686-NEXT: .LBB2_10: -; i686-NEXT: movl (%esp), %ecx # 4-byte Reload -; i686-NEXT: orl %ebp, %ecx -; i686-NEXT: .LBB2_12: # %entry +; i686-NEXT: xorl %edi, %edi +; i686-NEXT: .LBB2_6: # %entry +; i686-NEXT: movl %esi, %edx +; i686-NEXT: movb %ch, %cl ; i686-NEXT: movl {{[0-9]+}}(%esp), %ebp -; i686-NEXT: movl %ecx, (%esp) # 4-byte Spill -; i686-NEXT: testb $32, %dl -; i686-NEXT: movl {{[0-9]+}}(%esp), %edx -; i686-NEXT: jne .LBB2_14 -; i686-NEXT: # %bb.13: # %entry -; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: .LBB2_14: # %entry -; i686-NEXT: movl %edx, %esi -; i686-NEXT: movl %eax, %ecx +; i686-NEXT: shldl %cl, %ebp, %edx +; i686-NEXT: testb $32, %ch +; i686-NEXT: jne .LBB2_8 +; i686-NEXT: # %bb.7: # %entry +; i686-NEXT: movl %edx, %ebx +; i686-NEXT: .LBB2_8: # %entry +; i686-NEXT: movb %ch, %cl +; i686-NEXT: addb $-64, %cl +; i686-NEXT: movl {{[0-9]+}}(%esp), %ebp +; i686-NEXT: movl %ebp, %edx +; i686-NEXT: shll %cl, %edx ; i686-NEXT: shldl %cl, %ebp, %esi -; i686-NEXT: testb $32, %al -; i686-NEXT: jne .LBB2_16 -; i686-NEXT: # %bb.15: # %entry +; i686-NEXT: testb $32, %cl +; i686-NEXT: je .LBB2_10 +; i686-NEXT: # %bb.9: +; i686-NEXT: movl %edx, %esi +; i686-NEXT: xorl %edx, %edx +; i686-NEXT: .LBB2_10: # %entry +; i686-NEXT: cmpb $63, %ch +; i686-NEXT: jbe .LBB2_11 +; i686-NEXT: # %bb.12: # %entry +; i686-NEXT: xorl %ebx, %ebx +; i686-NEXT: xorl %ebp, %ebp +; i686-NEXT: movl {{[0-9]+}}(%esp), %edi +; i686-NEXT: jmp .LBB2_13 +; i686-NEXT: .LBB2_11: +; i686-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Folded Reload +; i686-NEXT: orl (%esp), %eax # 4-byte Folded Reload +; i686-NEXT: movl %eax, %esi +; i686-NEXT: movl %edi, %edx +; i686-NEXT: movl {{[0-9]+}}(%esp), %edi +; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Reload +; i686-NEXT: .LBB2_13: # %entry +; i686-NEXT: movl {{[0-9]+}}(%esp), %eax +; i686-NEXT: testb %ch, %ch +; i686-NEXT: je .LBB2_15 +; i686-NEXT: # %bb.14: # %entry +; i686-NEXT: movl %edx, %edi ; i686-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; i686-NEXT: .LBB2_16: # %entry -; i686-NEXT: movb %ah, %cl -; i686-NEXT: movl {{[0-9]+}}(%esp), %esi -; i686-NEXT: shldl %cl, %esi, %edi -; i686-NEXT: testb $32, %ah -; i686-NEXT: jne .LBB2_18 -; i686-NEXT: # %bb.17: # %entry -; i686-NEXT: movl %edi, %ebx -; i686-NEXT: .LBB2_18: # %entry -; i686-NEXT: cmpb $64, %al -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload -; i686-NEXT: jae .LBB2_20 -; i686-NEXT: # %bb.19: -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload -; i686-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Folded Reload -; i686-NEXT: .LBB2_20: # %entry -; i686-NEXT: movl {{[0-9]+}}(%esp), %ecx -; i686-NEXT: testb %al, %al -; i686-NEXT: je .LBB2_22 -; i686-NEXT: # %bb.21: # %entry -; i686-NEXT: movl %ebx, %edx -; i686-NEXT: movl (%esp), %ebp # 4-byte Reload -; i686-NEXT: .LBB2_22: # %entry -; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; i686-NEXT: movl %eax, 4(%ecx) -; i686-NEXT: movl %esi, (%ecx) -; i686-NEXT: movl %edx, 12(%ecx) -; i686-NEXT: movl %ebp, 8(%ecx) -; i686-NEXT: addl $20, %esp +; i686-NEXT: .LBB2_15: # %entry +; i686-NEXT: movl %ebx, 4(%eax) +; i686-NEXT: movl %ebp, (%eax) +; i686-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload +; i686-NEXT: movl %ecx, 12(%eax) +; i686-NEXT: movl %edi, 8(%eax) +; i686-NEXT: addl $16, %esp ; i686-NEXT: popl %esi ; i686-NEXT: popl %edi ; i686-NEXT: popl %ebx diff --git a/llvm/test/CodeGen/X86/signed-truncation-check.ll b/llvm/test/CodeGen/X86/signed-truncation-check.ll --- a/llvm/test/CodeGen/X86/signed-truncation-check.ll +++ b/llvm/test/CodeGen/X86/signed-truncation-check.ll @@ -465,16 +465,16 @@ ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax ; X86-NEXT: addw {{[0-9]+}}(%esp), %ax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $256, %eax # imm = 0x100 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $255, %eax +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: add_ultcmp_bad_i16_i8_add: ; X64: # %bb.0: ; X64-NEXT: addl %esi, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $256, %eax # imm = 0x100 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $255, %eax +; X64-NEXT: setbe %al ; X64-NEXT: retq %tmp0 = add i16 %x, %y %tmp1 = icmp ult i16 %tmp0, 256 ; 1U << 8 @@ -528,16 +528,16 @@ ; X86-NEXT: movl $192, %eax ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $256, %eax # imm = 0x100 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $255, %eax +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: add_ultcmp_bad_i16_i8_c0notpoweroftwo: ; X64: # %bb.0: ; X64-NEXT: addl $192, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $256, %eax # imm = 0x100 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $255, %eax +; X64-NEXT: setbe %al ; X64-NEXT: retq %tmp0 = add i16 %x, 192 ; (1U << (8-1)) + (1U << (8-1-1)) %tmp1 = icmp ult i16 %tmp0, 256 ; 1U << 8 @@ -551,16 +551,16 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: subl $-128, %eax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $768, %eax # imm = 0x300 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $767, %eax # imm = 0x2FF +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: add_ultcmp_bad_i16_i8_c1notpoweroftwo: ; X64: # %bb.0: ; X64-NEXT: subl $-128, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $768, %eax # imm = 0x300 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $767, %eax # imm = 0x2FF +; X64-NEXT: setbe %al ; X64-NEXT: retq %tmp0 = add i16 %x, 128 ; 1U << (8-1) %tmp1 = icmp ult i16 %tmp0, 768 ; (1U << 8)) + (1U << (8+1)) @@ -574,16 +574,16 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: addl $64, %eax ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $256, %eax # imm = 0x100 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $255, %eax +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: add_ultcmp_bad_i16_i8_magic: ; X64: # %bb.0: ; X64-NEXT: addl $64, %edi ; X64-NEXT: movzwl %di, %eax -; X64-NEXT: cmpl $256, %eax # imm = 0x100 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $255, %eax +; X64-NEXT: setbe %al ; X64-NEXT: retq %tmp0 = add i16 %x, 64 ; 1U << (8-1-1) %tmp1 = icmp ult i16 %tmp0, 256 ; 1U << 8 @@ -596,15 +596,15 @@ ; X86: # %bb.0: ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: addl $8, %eax -; X86-NEXT: cmpw $16, %ax -; X86-NEXT: setb %al +; X86-NEXT: cmpw $15, %ax +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: add_ultcmp_bad_i16_i4: ; X64: # %bb.0: ; X64-NEXT: addl $8, %edi -; X64-NEXT: cmpw $16, %di -; X64-NEXT: setb %al +; X64-NEXT: cmpw $15, %di +; X64-NEXT: setbe %al ; X64-NEXT: retq %tmp0 = add i16 %x, 8 ; 1U << (4-1) %tmp1 = icmp ult i16 %tmp0, 16 ; 1U << 4 @@ -618,16 +618,16 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: subl $-128, %eax ; X86-NEXT: andl $16777215, %eax # imm = 0xFFFFFF -; X86-NEXT: cmpl $256, %eax # imm = 0x100 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $255, %eax +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: add_ultcmp_bad_i24_i8: ; X64: # %bb.0: ; X64-NEXT: subl $-128, %edi ; X64-NEXT: andl $16777215, %edi # imm = 0xFFFFFF -; X64-NEXT: cmpl $256, %edi # imm = 0x100 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $255, %edi +; X64-NEXT: setbe %al ; X64-NEXT: retq %tmp0 = add i24 %x, 128 ; 1U << (8-1) %tmp1 = icmp ult i24 %tmp0, 256 ; 1U << 8 diff --git a/llvm/test/CodeGen/X86/smul_fix_sat.ll b/llvm/test/CodeGen/X86/smul_fix_sat.ll --- a/llvm/test/CodeGen/X86/smul_fix_sat.ll +++ b/llvm/test/CodeGen/X86/smul_fix_sat.ll @@ -16,12 +16,12 @@ ; X64-NEXT: movq %rcx, %rax ; X64-NEXT: shrq $32, %rax ; X64-NEXT: shrdl $2, %eax, %ecx -; X64-NEXT: cmpl $1, %eax +; X64-NEXT: cmpl $2, %eax ; X64-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF -; X64-NEXT: cmovlel %ecx, %edx -; X64-NEXT: cmpl $-2, %eax +; X64-NEXT: cmovll %ecx, %edx +; X64-NEXT: cmpl $-3, %eax ; X64-NEXT: movl $-2147483648, %eax # imm = 0x80000000 -; X64-NEXT: cmovgel %edx, %eax +; X64-NEXT: cmovgl %edx, %eax ; X64-NEXT: retq ; ; X86-LABEL: func: @@ -29,12 +29,12 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: imull {{[0-9]+}}(%esp) ; X86-NEXT: shrdl $2, %edx, %eax -; X86-NEXT: cmpl $1, %edx +; X86-NEXT: cmpl $2, %edx ; X86-NEXT: movl $2147483647, %ecx # imm = 0x7FFFFFFF -; X86-NEXT: cmovgl %ecx, %eax -; X86-NEXT: cmpl $-2, %edx +; X86-NEXT: cmovgel %ecx, %eax +; X86-NEXT: cmpl $-3, %edx ; X86-NEXT: movl $-2147483648, %ecx # imm = 0x80000000 -; X86-NEXT: cmovll %ecx, %eax +; X86-NEXT: cmovlel %ecx, %eax ; X86-NEXT: retl %tmp = call i32 @llvm.smul.fix.sat.i32(i32 %x, i32 %y, i32 2) ret i32 %tmp @@ -46,12 +46,12 @@ ; X64-NEXT: movq %rdi, %rax ; X64-NEXT: imulq %rsi ; X64-NEXT: shrdq $2, %rdx, %rax -; X64-NEXT: cmpq $1, %rdx +; X64-NEXT: cmpq $2, %rdx ; X64-NEXT: movabsq $9223372036854775807, %rcx # imm = 0x7FFFFFFFFFFFFFFF -; X64-NEXT: cmovgq %rcx, %rax -; X64-NEXT: cmpq $-2, %rdx +; X64-NEXT: cmovgeq %rcx, %rax +; X64-NEXT: cmpq $-3, %rdx ; X64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000 -; X64-NEXT: cmovlq %rcx, %rax +; X64-NEXT: cmovleq %rcx, %rax ; X64-NEXT: retq ; ; X86-LABEL: func2: @@ -90,36 +90,37 @@ ; X86-NEXT: cmpl $0, {{[0-9]+}}(%esp) ; X86-NEXT: cmovnsl %esi, %ebx ; X86-NEXT: cmovnsl %edx, %edi -; X86-NEXT: movl %edi, %ebp -; X86-NEXT: subl {{[0-9]+}}(%esp), %ebp -; X86-NEXT: movl %ebx, %esi -; X86-NEXT: sbbl $0, %esi +; X86-NEXT: movl %edi, %esi +; X86-NEXT: subl {{[0-9]+}}(%esp), %esi +; X86-NEXT: movl %ebx, %ebp +; X86-NEXT: sbbl $0, %ebp ; X86-NEXT: cmpl $0, {{[0-9]+}}(%esp) -; X86-NEXT: cmovnsl %ebx, %esi -; X86-NEXT: cmovnsl %edi, %ebp -; X86-NEXT: testl %esi, %esi +; X86-NEXT: cmovnsl %ebx, %ebp +; X86-NEXT: cmovnsl %edi, %esi +; X86-NEXT: testl %ebp, %ebp ; X86-NEXT: setg %bl ; X86-NEXT: sete %bh -; X86-NEXT: cmpl $1, %ebp -; X86-NEXT: seta %dl +; X86-NEXT: cmpl $2, %esi +; X86-NEXT: setae %dl ; X86-NEXT: andb %bh, %dl ; X86-NEXT: orb %bl, %dl ; X86-NEXT: shrdl $2, %eax, %ecx -; X86-NEXT: shrdl $2, %ebp, %eax +; X86-NEXT: shrdl $2, %esi, %eax ; X86-NEXT: testb %dl, %dl ; X86-NEXT: movl $2147483647, %edi # imm = 0x7FFFFFFF ; X86-NEXT: cmovel %eax, %edi ; X86-NEXT: movl $-1, %eax ; X86-NEXT: cmovnel %eax, %ecx -; X86-NEXT: cmpl $-1, %esi -; X86-NEXT: setl %al -; X86-NEXT: sete %dl +; X86-NEXT: cmpl $-1, %ebp +; X86-NEXT: sete %al +; X86-NEXT: cmpl $-3, %esi +; X86-NEXT: setbe %dl +; X86-NEXT: andb %al, %dl ; X86-NEXT: cmpl $-2, %ebp -; X86-NEXT: setb %ah -; X86-NEXT: andb %dl, %ah -; X86-NEXT: xorl %edx, %edx -; X86-NEXT: orb %al, %ah -; X86-NEXT: cmovnel %edx, %ecx +; X86-NEXT: setle %al +; X86-NEXT: xorl %esi, %esi +; X86-NEXT: orb %dl, %al +; X86-NEXT: cmovnel %esi, %ecx ; X86-NEXT: movl $-2147483648, %edx # imm = 0x80000000 ; X86-NEXT: cmovel %edi, %edx ; X86-NEXT: movl %ecx, %eax @@ -148,12 +149,12 @@ ; X64-NEXT: shlb $6, %dl ; X64-NEXT: orb %al, %dl ; X64-NEXT: movzbl %dl, %eax -; X64-NEXT: cmpb $1, %cl +; X64-NEXT: cmpb $2, %cl ; X64-NEXT: movl $127, %edx -; X64-NEXT: cmovlel %eax, %edx -; X64-NEXT: cmpb $-2, %cl +; X64-NEXT: cmovll %eax, %edx +; X64-NEXT: cmpb $-3, %cl ; X64-NEXT: movl $128, %eax -; X64-NEXT: cmovgel %edx, %eax +; X64-NEXT: cmovgl %edx, %eax ; X64-NEXT: sarb $4, %al ; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq @@ -173,12 +174,12 @@ ; X86-NEXT: shrb $2, %al ; X86-NEXT: orb %cl, %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $1, %ah +; X86-NEXT: cmpb $2, %ah ; X86-NEXT: movl $127, %edx -; X86-NEXT: cmovlel %ecx, %edx -; X86-NEXT: cmpb $-2, %ah +; X86-NEXT: cmovll %ecx, %edx +; X86-NEXT: cmpb $-3, %ah ; X86-NEXT: movl $128, %eax -; X86-NEXT: cmovgel %edx, %eax +; X86-NEXT: cmovgl %edx, %eax ; X86-NEXT: sarb $4, %al ; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl @@ -199,12 +200,12 @@ ; X64-NEXT: movq %rdx, %rcx ; X64-NEXT: shrq $32, %rcx ; X64-NEXT: shrdl $2, %ecx, %edx -; X64-NEXT: cmpl $1, %ecx +; X64-NEXT: cmpl $2, %ecx ; X64-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF -; X64-NEXT: cmovgl %eax, %edx -; X64-NEXT: cmpl $-2, %ecx +; X64-NEXT: cmovgel %eax, %edx +; X64-NEXT: cmpl $-3, %ecx ; X64-NEXT: movl $-2147483648, %ecx # imm = 0x80000000 -; X64-NEXT: cmovll %ecx, %edx +; X64-NEXT: cmovlel %ecx, %edx ; X64-NEXT: movd %edx, %xmm2 ; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3] ; X64-NEXT: movd %xmm3, %edx @@ -216,10 +217,10 @@ ; X64-NEXT: movq %rsi, %rdx ; X64-NEXT: shrq $32, %rdx ; X64-NEXT: shrdl $2, %edx, %esi -; X64-NEXT: cmpl $1, %edx -; X64-NEXT: cmovgl %eax, %esi -; X64-NEXT: cmpl $-2, %edx -; X64-NEXT: cmovll %ecx, %esi +; X64-NEXT: cmpl $2, %edx +; X64-NEXT: cmovgel %eax, %esi +; X64-NEXT: cmpl $-3, %edx +; X64-NEXT: cmovlel %ecx, %esi ; X64-NEXT: movd %esi, %xmm3 ; X64-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1] ; X64-NEXT: movd %xmm1, %edx @@ -230,10 +231,10 @@ ; X64-NEXT: movq %rsi, %rdx ; X64-NEXT: shrq $32, %rdx ; X64-NEXT: shrdl $2, %edx, %esi -; X64-NEXT: cmpl $1, %edx -; X64-NEXT: cmovgl %eax, %esi -; X64-NEXT: cmpl $-2, %edx -; X64-NEXT: cmovll %ecx, %esi +; X64-NEXT: cmpl $2, %edx +; X64-NEXT: cmovgel %eax, %esi +; X64-NEXT: cmpl $-3, %edx +; X64-NEXT: cmovlel %ecx, %esi ; X64-NEXT: movd %esi, %xmm2 ; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1] ; X64-NEXT: movd %xmm1, %edx @@ -245,10 +246,10 @@ ; X64-NEXT: movq %rsi, %rdx ; X64-NEXT: shrq $32, %rdx ; X64-NEXT: shrdl $2, %edx, %esi -; X64-NEXT: cmpl $1, %edx -; X64-NEXT: cmovgl %eax, %esi -; X64-NEXT: cmpl $-2, %edx -; X64-NEXT: cmovll %ecx, %esi +; X64-NEXT: cmpl $2, %edx +; X64-NEXT: cmovgel %eax, %esi +; X64-NEXT: cmpl $-3, %edx +; X64-NEXT: cmovlel %ecx, %esi ; X64-NEXT: movd %esi, %xmm0 ; X64-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1] ; X64-NEXT: punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0] @@ -267,35 +268,35 @@ ; X86-NEXT: imull {{[0-9]+}}(%esp) ; X86-NEXT: movl %eax, %ecx ; X86-NEXT: shrdl $2, %edx, %ecx -; X86-NEXT: cmpl $1, %edx +; X86-NEXT: cmpl $2, %edx ; X86-NEXT: movl $2147483647, %ebp # imm = 0x7FFFFFFF -; X86-NEXT: cmovgl %ebp, %ecx -; X86-NEXT: cmpl $-2, %edx +; X86-NEXT: cmovgel %ebp, %ecx +; X86-NEXT: cmpl $-3, %edx ; X86-NEXT: movl $-2147483648, %esi # imm = 0x80000000 -; X86-NEXT: cmovll %esi, %ecx +; X86-NEXT: cmovlel %esi, %ecx ; X86-NEXT: movl %edi, %eax ; X86-NEXT: imull {{[0-9]+}}(%esp) ; X86-NEXT: movl %eax, %edi ; X86-NEXT: shrdl $2, %edx, %edi -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: cmovgl %ebp, %edi -; X86-NEXT: cmpl $-2, %edx -; X86-NEXT: cmovll %esi, %edi +; X86-NEXT: cmpl $2, %edx +; X86-NEXT: cmovgel %ebp, %edi +; X86-NEXT: cmpl $-3, %edx +; X86-NEXT: cmovlel %esi, %edi ; X86-NEXT: movl %ebx, %eax ; X86-NEXT: imull {{[0-9]+}}(%esp) ; X86-NEXT: movl %eax, %ebx ; X86-NEXT: shrdl $2, %edx, %ebx -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: cmovgl %ebp, %ebx -; X86-NEXT: cmpl $-2, %edx -; X86-NEXT: cmovll %esi, %ebx +; X86-NEXT: cmpl $2, %edx +; X86-NEXT: cmovgel %ebp, %ebx +; X86-NEXT: cmpl $-3, %edx +; X86-NEXT: cmovlel %esi, %ebx ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: imull {{[0-9]+}}(%esp) ; X86-NEXT: shrdl $2, %edx, %eax -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: cmovgl %ebp, %eax -; X86-NEXT: cmpl $-2, %edx -; X86-NEXT: cmovll %esi, %eax +; X86-NEXT: cmpl $2, %edx +; X86-NEXT: cmovgel %ebp, %eax +; X86-NEXT: cmpl $-3, %edx +; X86-NEXT: cmovlel %esi, %eax ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx ; X86-NEXT: movl %eax, 12(%edx) ; X86-NEXT: movl %ebx, 8(%edx) @@ -637,11 +638,12 @@ ; X86-NEXT: movl $-1, %esi ; X86-NEXT: cmovnel %esi, %eax ; X86-NEXT: cmpl $-1, %edi -; X86-NEXT: setl %ch -; X86-NEXT: sete %bl -; X86-NEXT: andb %cl, %bl +; X86-NEXT: sete %ch +; X86-NEXT: andb %cl, %ch +; X86-NEXT: cmpl $-2, %edi +; X86-NEXT: setle %cl ; X86-NEXT: xorl %esi, %esi -; X86-NEXT: orb %ch, %bl +; X86-NEXT: orb %ch, %cl ; X86-NEXT: cmovnel %esi, %eax ; X86-NEXT: movl $-2147483648, %ecx # imm = 0x80000000 ; X86-NEXT: cmovnel %ecx, %edx @@ -660,14 +662,14 @@ ; X64-NEXT: movq %rdi, %rax ; X64-NEXT: imulq %rsi ; X64-NEXT: shrdq $63, %rdx, %rax -; X64-NEXT: movabsq $4611686018427387903, %rcx # imm = 0x3FFFFFFFFFFFFFFF +; X64-NEXT: movabsq $4611686018427387904, %rcx # imm = 0x4000000000000000 ; X64-NEXT: cmpq %rcx, %rdx ; X64-NEXT: movabsq $9223372036854775807, %rcx # imm = 0x7FFFFFFFFFFFFFFF -; X64-NEXT: cmovgq %rcx, %rax -; X64-NEXT: movabsq $-4611686018427387904, %rcx # imm = 0xC000000000000000 +; X64-NEXT: cmovgeq %rcx, %rax +; X64-NEXT: movabsq $-4611686018427387905, %rcx # imm = 0xBFFFFFFFFFFFFFFF ; X64-NEXT: cmpq %rcx, %rdx ; X64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000 -; X64-NEXT: cmovlq %rcx, %rax +; X64-NEXT: cmovleq %rcx, %rax ; X64-NEXT: retq ; ; X86-LABEL: func8: @@ -713,16 +715,16 @@ ; X86-NEXT: cmovnsl %ecx, %edx ; X86-NEXT: shrdl $31, %edx, %eax ; X86-NEXT: shrdl $31, %edi, %edx -; X86-NEXT: cmpl $1073741823, %edi # imm = 0x3FFFFFFF +; X86-NEXT: cmpl $1073741824, %edi # imm = 0x40000000 ; X86-NEXT: movl $2147483647, %ecx # imm = 0x7FFFFFFF -; X86-NEXT: cmovgl %ecx, %edx +; X86-NEXT: cmovgel %ecx, %edx ; X86-NEXT: movl $-1, %ecx -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: xorl %ecx, %ecx -; X86-NEXT: cmpl $-1073741824, %edi # imm = 0xC0000000 -; X86-NEXT: cmovll %ecx, %eax +; X86-NEXT: cmpl $-1073741825, %edi # imm = 0xBFFFFFFF +; X86-NEXT: cmovlel %ecx, %eax ; X86-NEXT: movl $-2147483648, %ecx # imm = 0x80000000 -; X86-NEXT: cmovll %ecx, %edx +; X86-NEXT: cmovlel %ecx, %edx ; X86-NEXT: popl %esi ; X86-NEXT: popl %edi ; X86-NEXT: popl %ebx diff --git a/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll b/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll --- a/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll +++ b/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll @@ -15,13 +15,13 @@ ; X64-NEXT: movl $2, %ecx ; X64-NEXT: movl $3, %eax ; X64-NEXT: imulq %rcx -; X64-NEXT: cmpq $1, %rdx +; X64-NEXT: cmpq $2, %rdx ; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF ; X64-NEXT: movl $1, %ecx -; X64-NEXT: cmovgq %rax, %rcx -; X64-NEXT: cmpq $-2, %rdx +; X64-NEXT: cmovgeq %rax, %rcx +; X64-NEXT: cmpq $-3, %rdx ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 -; X64-NEXT: cmovgeq %rcx, %rax +; X64-NEXT: cmovgq %rcx, %rax ; X64-NEXT: retq %tmp = call i64 @llvm.smul.fix.sat.i64(i64 3, i64 2, i32 2) ret i64 %tmp @@ -51,12 +51,12 @@ ; X64-NEXT: movl $2, %edx ; X64-NEXT: movq %rcx, %rax ; X64-NEXT: imulq %rdx -; X64-NEXT: cmpq $1, %rdx +; X64-NEXT: cmpq $2, %rdx ; X64-NEXT: movabsq $4611686018427387903, %rsi # imm = 0x3FFFFFFFFFFFFFFF -; X64-NEXT: cmovgq %rcx, %rsi -; X64-NEXT: cmpq $-2, %rdx +; X64-NEXT: cmovgeq %rcx, %rsi +; X64-NEXT: cmpq $-3, %rdx ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 -; X64-NEXT: cmovgeq %rsi, %rax +; X64-NEXT: cmovgq %rsi, %rax ; X64-NEXT: retq %tmp = call i64 @llvm.smul.fix.sat.i64(i64 9223372036854775807, i64 2, i32 2) ret i64 %tmp @@ -87,14 +87,14 @@ ; X64-NEXT: movl $2, %edx ; X64-NEXT: movq %rcx, %rax ; X64-NEXT: imulq %rdx -; X64-NEXT: movabsq $4611686018427387903, %rax # imm = 0x3FFFFFFFFFFFFFFF +; X64-NEXT: movabsq $4611686018427387904, %rax # imm = 0x4000000000000000 ; X64-NEXT: cmpq %rax, %rdx ; X64-NEXT: movl $1, %esi -; X64-NEXT: cmovgq %rcx, %rsi -; X64-NEXT: movabsq $-4611686018427387904, %rax # imm = 0xC000000000000000 +; X64-NEXT: cmovgeq %rcx, %rsi +; X64-NEXT: movabsq $-4611686018427387905, %rax # imm = 0xBFFFFFFFFFFFFFFF ; X64-NEXT: cmpq %rax, %rdx ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000 -; X64-NEXT: cmovgeq %rsi, %rax +; X64-NEXT: cmovgq %rsi, %rax ; X64-NEXT: retq %tmp = call i64 @llvm.smul.fix.sat.i64(i64 9223372036854775807, i64 2, i32 63) ret i64 %tmp diff --git a/llvm/test/CodeGen/X86/srem-seteq-illegal-types.ll b/llvm/test/CodeGen/X86/srem-seteq-illegal-types.ll --- a/llvm/test/CodeGen/X86/srem-seteq-illegal-types.ll +++ b/llvm/test/CodeGen/X86/srem-seteq-illegal-types.ll @@ -13,8 +13,8 @@ ; X86-NEXT: imull $526025035, {{[0-9]+}}(%esp), %eax # imm = 0x1F5A814B ; X86-NEXT: addl $2711469, %eax # imm = 0x295FAD ; X86-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF -; X86-NEXT: cmpl $5422939, %eax # imm = 0x52BF5B -; X86-NEXT: setb %al +; X86-NEXT: cmpl $5422938, %eax # imm = 0x52BF5A +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_odd: @@ -22,8 +22,8 @@ ; X64-NEXT: imull $526025035, %edi, %eax # imm = 0x1F5A814B ; X64-NEXT: addl $2711469, %eax # imm = 0x295FAD ; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF -; X64-NEXT: cmpl $5422939, %eax # imm = 0x52BF5B -; X64-NEXT: setb %al +; X64-NEXT: cmpl $5422938, %eax # imm = 0x52BF5A +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i29 %X, 99 %cmp = icmp eq i29 %srem, 0 diff --git a/llvm/test/CodeGen/X86/srem-seteq-optsize.ll b/llvm/test/CodeGen/X86/srem-seteq-optsize.ll --- a/llvm/test/CodeGen/X86/srem-seteq-optsize.ll +++ b/llvm/test/CodeGen/X86/srem-seteq-optsize.ll @@ -49,9 +49,9 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD ; X86-NEXT: addl $429496729, %eax # imm = 0x19999999 -; X86-NEXT: cmpl $858993459, %eax # imm = 0x33333333 +; X86-NEXT: cmpl $858993458, %eax # imm = 0x33333332 ; X86-NEXT: movl $42, %eax -; X86-NEXT: jb .LBB1_2 +; X86-NEXT: jbe .LBB1_2 ; X86-NEXT: # %bb.1: ; X86-NEXT: movl $-10, %eax ; X86-NEXT: .LBB1_2: @@ -61,10 +61,10 @@ ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD ; X64-NEXT: addl $429496729, %eax # imm = 0x19999999 -; X64-NEXT: cmpl $858993459, %eax # imm = 0x33333333 +; X64-NEXT: cmpl $858993458, %eax # imm = 0x33333332 ; X64-NEXT: movl $42, %ecx ; X64-NEXT: movl $-10, %eax -; X64-NEXT: cmovbl %ecx, %eax +; X64-NEXT: cmovbel %ecx, %eax ; X64-NEXT: retq %rem = srem i32 %X, 5 %cmp = icmp eq i32 %rem, 0 diff --git a/llvm/test/CodeGen/X86/srem-seteq.ll b/llvm/test/CodeGen/X86/srem-seteq.ll --- a/llvm/test/CodeGen/X86/srem-seteq.ll +++ b/llvm/test/CodeGen/X86/srem-seteq.ll @@ -12,8 +12,8 @@ ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %ecx # imm = 0xCCCCCCCD ; X86-NEXT: addl $429496729, %ecx # imm = 0x19999999 ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $858993458, %ecx # imm = 0x33333332 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_odd: @@ -21,8 +21,8 @@ ; X64-NEXT: imull $-858993459, %edi, %ecx # imm = 0xCCCCCCCD ; X64-NEXT: addl $429496729, %ecx # imm = 0x19999999 ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $858993458, %ecx # imm = 0x33333332 +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 5 %cmp = icmp eq i32 %srem, 0 @@ -36,8 +36,8 @@ ; X86-NEXT: imull $-1030792151, {{[0-9]+}}(%esp), %ecx # imm = 0xC28F5C29 ; X86-NEXT: addl $85899345, %ecx # imm = 0x51EB851 ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $171798691, %ecx # imm = 0xA3D70A3 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $171798690, %ecx # imm = 0xA3D70A2 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_odd_25: @@ -45,8 +45,8 @@ ; X64-NEXT: imull $-1030792151, %edi, %ecx # imm = 0xC28F5C29 ; X64-NEXT: addl $85899345, %ecx # imm = 0x51EB851 ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $171798691, %ecx # imm = 0xA3D70A3 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $171798690, %ecx # imm = 0xA3D70A2 +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 25 %cmp = icmp eq i32 %srem, 0 @@ -61,8 +61,8 @@ ; X86-NEXT: imull $1789569707, {{[0-9]+}}(%esp), %ecx # imm = 0x6AAAAAAB ; X86-NEXT: incl %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $3, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_odd_bit30: @@ -70,8 +70,8 @@ ; X64-NEXT: imull $1789569707, %edi, %ecx # imm = 0x6AAAAAAB ; X64-NEXT: incl %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $2, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 1073741827 %cmp = icmp eq i32 %srem, 0 @@ -86,8 +86,8 @@ ; X86-NEXT: imull $-715827883, {{[0-9]+}}(%esp), %ecx # imm = 0xD5555555 ; X86-NEXT: incl %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $3, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_odd_bit31: @@ -95,8 +95,8 @@ ; X64-NEXT: imull $-715827883, %edi, %ecx # imm = 0xD5555555 ; X64-NEXT: incl %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $2, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 2147483651 %cmp = icmp eq i32 %srem, 0 @@ -116,8 +116,8 @@ ; X86-NEXT: rorw %ax ; X86-NEXT: movzwl %ax, %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $4680, %ecx # imm = 0x1248 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $4681, %ecx # imm = 0x1249 +; X86-NEXT: setae %al ; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: retl ; @@ -128,8 +128,8 @@ ; X64-NEXT: rorw %ax ; X64-NEXT: movzwl %ax, %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $4680, %ecx # imm = 0x1248 -; X64-NEXT: seta %al +; X64-NEXT: cmpl $4681, %ecx # imm = 0x1249 +; X64-NEXT: setae %al ; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq %srem = srem i16 %X, 14 @@ -145,8 +145,8 @@ ; X86-NEXT: addl $85899344, %ecx # imm = 0x51EB850 ; X86-NEXT: rorl $2, %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $42949673, %ecx # imm = 0x28F5C29 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $42949672, %ecx # imm = 0x28F5C28 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_even_100: @@ -155,8 +155,8 @@ ; X64-NEXT: addl $85899344, %ecx # imm = 0x51EB850 ; X64-NEXT: rorl $2, %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $42949673, %ecx # imm = 0x28F5C29 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $42949672, %ecx # imm = 0x28F5C28 +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 100 %cmp = icmp eq i32 %srem, 0 @@ -172,8 +172,8 @@ ; X86-NEXT: addl $8, %ecx ; X86-NEXT: rorl $3, %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $3, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_even_bit30: @@ -182,8 +182,8 @@ ; X64-NEXT: addl $8, %ecx ; X64-NEXT: rorl $3, %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $2, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 1073741928 %cmp = icmp eq i32 %srem, 0 @@ -199,8 +199,8 @@ ; X86-NEXT: addl $2, %ecx ; X86-NEXT: rorl %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $3, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_even_bit31: @@ -209,8 +209,8 @@ ; X64-NEXT: addl $2, %ecx ; X64-NEXT: rorl %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $2, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %srem = srem i32 %X, 2147483750 %cmp = icmp eq i32 %srem, 0 @@ -229,8 +229,8 @@ ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %ecx # imm = 0xCCCCCCCD ; X86-NEXT: addl $429496729, %ecx # imm = 0x19999999 ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $858993458, %ecx # imm = 0x33333332 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_odd_setne: @@ -238,8 +238,8 @@ ; X64-NEXT: imull $-858993459, %edi, %ecx # imm = 0xCCCCCCCD ; X64-NEXT: addl $429496729, %ecx # imm = 0x19999999 ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $858993458, %ecx # imm = 0x33333332 -; X64-NEXT: seta %al +; X64-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 +; X64-NEXT: setae %al ; X64-NEXT: retq %srem = srem i32 %X, 5 %cmp = icmp ne i32 %srem, 0 @@ -254,8 +254,8 @@ ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %ecx # imm = 0xCCCCCCCD ; X86-NEXT: addl $429496729, %ecx # imm = 0x19999999 ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $858993458, %ecx # imm = 0x33333332 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_negative_odd: @@ -263,8 +263,8 @@ ; X64-NEXT: imull $-858993459, %edi, %ecx # imm = 0xCCCCCCCD ; X64-NEXT: addl $429496729, %ecx # imm = 0x19999999 ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $858993458, %ecx # imm = 0x33333332 -; X64-NEXT: seta %al +; X64-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 +; X64-NEXT: setae %al ; X64-NEXT: retq %srem = srem i32 %X, -5 %cmp = icmp ne i32 %srem, 0 @@ -278,8 +278,8 @@ ; X86-NEXT: addl $306783378, %ecx # imm = 0x12492492 ; X86-NEXT: rorl %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $306783378, %ecx # imm = 0x12492492 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $306783379, %ecx # imm = 0x12492493 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_srem_negative_even: @@ -288,8 +288,8 @@ ; X64-NEXT: addl $306783378, %ecx # imm = 0x12492492 ; X64-NEXT: rorl %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $306783378, %ecx # imm = 0x12492492 -; X64-NEXT: seta %al +; X64-NEXT: cmpl $306783379, %ecx # imm = 0x12492493 +; X64-NEXT: setae %al ; X64-NEXT: retq %srem = srem i32 %X, -14 %cmp = icmp ne i32 %srem, 0 diff --git a/llvm/test/CodeGen/X86/ssub_sat.ll b/llvm/test/CodeGen/X86/ssub_sat.ll --- a/llvm/test/CodeGen/X86/ssub_sat.ll +++ b/llvm/test/CodeGen/X86/ssub_sat.ll @@ -137,12 +137,12 @@ ; X86-NEXT: movb {{[0-9]+}}(%esp), %al ; X86-NEXT: subb {{[0-9]+}}(%esp), %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $7, %al +; X86-NEXT: cmpb $6, %al ; X86-NEXT: movl $7, %eax -; X86-NEXT: cmovll %ecx, %eax -; X86-NEXT: cmpb $-8, %al +; X86-NEXT: cmovlel %ecx, %eax +; X86-NEXT: cmpb $-7, %al ; X86-NEXT: movl $248, %ecx -; X86-NEXT: cmovgl %eax, %ecx +; X86-NEXT: cmovgel %eax, %ecx ; X86-NEXT: movsbl %cl, %eax ; X86-NEXT: retl ; @@ -150,12 +150,12 @@ ; X64: # %bb.0: ; X64-NEXT: subb %sil, %dil ; X64-NEXT: movzbl %dil, %eax -; X64-NEXT: cmpb $7, %al +; X64-NEXT: cmpb $6, %al ; X64-NEXT: movl $7, %ecx -; X64-NEXT: cmovll %eax, %ecx -; X64-NEXT: cmpb $-8, %cl +; X64-NEXT: cmovlel %eax, %ecx +; X64-NEXT: cmpb $-7, %cl ; X64-NEXT: movl $248, %eax -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: movsbl %al, %eax ; X64-NEXT: retq %tmp = call i4 @llvm.ssub.sat.i4(i4 %x, i4 %y) diff --git a/llvm/test/CodeGen/X86/ssub_sat_plus.ll b/llvm/test/CodeGen/X86/ssub_sat_plus.ll --- a/llvm/test/CodeGen/X86/ssub_sat_plus.ll +++ b/llvm/test/CodeGen/X86/ssub_sat_plus.ll @@ -152,12 +152,12 @@ ; X86-NEXT: sarb $4, %al ; X86-NEXT: subb %al, %cl ; X86-NEXT: movzbl %cl, %eax -; X86-NEXT: cmpb $7, %cl +; X86-NEXT: cmpb $6, %cl ; X86-NEXT: movl $7, %ecx -; X86-NEXT: cmovll %eax, %ecx -; X86-NEXT: cmpb $-8, %cl +; X86-NEXT: cmovlel %eax, %ecx +; X86-NEXT: cmpb $-7, %cl ; X86-NEXT: movl $248, %eax -; X86-NEXT: cmovgl %ecx, %eax +; X86-NEXT: cmovgel %ecx, %eax ; X86-NEXT: movsbl %al, %eax ; X86-NEXT: retl ; @@ -170,12 +170,12 @@ ; X64-NEXT: sarb $4, %al ; X64-NEXT: subb %al, %dil ; X64-NEXT: movzbl %dil, %eax -; X64-NEXT: cmpb $7, %al +; X64-NEXT: cmpb $6, %al ; X64-NEXT: movl $7, %ecx -; X64-NEXT: cmovll %eax, %ecx -; X64-NEXT: cmpb $-8, %cl +; X64-NEXT: cmovlel %eax, %ecx +; X64-NEXT: cmpb $-7, %cl ; X64-NEXT: movl $248, %eax -; X64-NEXT: cmovgl %ecx, %eax +; X64-NEXT: cmovgel %ecx, %eax ; X64-NEXT: movsbl %al, %eax ; X64-NEXT: retq %a = mul i4 %y, %z diff --git a/llvm/test/CodeGen/X86/uadd_sat.ll b/llvm/test/CodeGen/X86/uadd_sat.ll --- a/llvm/test/CodeGen/X86/uadd_sat.ll +++ b/llvm/test/CodeGen/X86/uadd_sat.ll @@ -100,9 +100,9 @@ ; X86-NEXT: movb {{[0-9]+}}(%esp), %al ; X86-NEXT: addb {{[0-9]+}}(%esp), %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $15, %al +; X86-NEXT: cmpb $14, %al ; X86-NEXT: movl $15, %eax -; X86-NEXT: cmovbl %ecx, %eax +; X86-NEXT: cmovbel %ecx, %eax ; X86-NEXT: movzbl %al, %eax ; X86-NEXT: retl ; @@ -110,9 +110,9 @@ ; X64: # %bb.0: ; X64-NEXT: addb %sil, %dil ; X64-NEXT: movzbl %dil, %eax -; X64-NEXT: cmpb $15, %al +; X64-NEXT: cmpb $14, %al ; X64-NEXT: movl $15, %ecx -; X64-NEXT: cmovbl %eax, %ecx +; X64-NEXT: cmovbel %eax, %ecx ; X64-NEXT: movzbl %cl, %eax ; X64-NEXT: retq %tmp = call i4 @llvm.uadd.sat.i4(i4 %x, i4 %y) diff --git a/llvm/test/CodeGen/X86/uadd_sat_plus.ll b/llvm/test/CodeGen/X86/uadd_sat_plus.ll --- a/llvm/test/CodeGen/X86/uadd_sat_plus.ll +++ b/llvm/test/CodeGen/X86/uadd_sat_plus.ll @@ -113,9 +113,9 @@ ; X86-NEXT: andb $15, %al ; X86-NEXT: addb {{[0-9]+}}(%esp), %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $15, %al +; X86-NEXT: cmpb $14, %al ; X86-NEXT: movl $15, %eax -; X86-NEXT: cmovbl %ecx, %eax +; X86-NEXT: cmovbel %ecx, %eax ; X86-NEXT: movzbl %al, %eax ; X86-NEXT: retl ; @@ -127,9 +127,9 @@ ; X64-NEXT: andb $15, %al ; X64-NEXT: addb %dil, %al ; X64-NEXT: movzbl %al, %eax -; X64-NEXT: cmpb $15, %al +; X64-NEXT: cmpb $14, %al ; X64-NEXT: movl $15, %ecx -; X64-NEXT: cmovbl %eax, %ecx +; X64-NEXT: cmovbel %eax, %ecx ; X64-NEXT: movzbl %cl, %eax ; X64-NEXT: retq %a = mul i4 %y, %z diff --git a/llvm/test/CodeGen/X86/udiv_fix_sat.ll b/llvm/test/CodeGen/X86/udiv_fix_sat.ll --- a/llvm/test/CodeGen/X86/udiv_fix_sat.ll +++ b/llvm/test/CodeGen/X86/udiv_fix_sat.ll @@ -17,9 +17,9 @@ ; X64-NEXT: shll $8, %eax ; X64-NEXT: xorl %edx, %edx ; X64-NEXT: divl %ecx -; X64-NEXT: cmpl $131071, %eax # imm = 0x1FFFF +; X64-NEXT: cmpl $131070, %eax # imm = 0x1FFFE ; X64-NEXT: movl $131071, %ecx # imm = 0x1FFFF -; X64-NEXT: cmovael %ecx, %eax +; X64-NEXT: cmoval %ecx, %eax ; X64-NEXT: shrl %eax ; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq @@ -32,9 +32,9 @@ ; X86-NEXT: shll $8, %eax ; X86-NEXT: xorl %edx, %edx ; X86-NEXT: divl %ecx -; X86-NEXT: cmpl $131071, %eax # imm = 0x1FFFF +; X86-NEXT: cmpl $131070, %eax # imm = 0x1FFFE ; X86-NEXT: movl $131071, %ecx # imm = 0x1FFFF -; X86-NEXT: cmovael %ecx, %eax +; X86-NEXT: cmoval %ecx, %eax ; X86-NEXT: shrl %eax ; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: retl @@ -52,9 +52,9 @@ ; X64-NEXT: shll $14, %eax ; X64-NEXT: xorl %edx, %edx ; X64-NEXT: divl %ecx -; X64-NEXT: cmpl $32767, %eax # imm = 0x7FFF +; X64-NEXT: cmpl $32766, %eax # imm = 0x7FFE ; X64-NEXT: movl $32767, %ecx # imm = 0x7FFF -; X64-NEXT: cmovbl %eax, %ecx +; X64-NEXT: cmovbel %eax, %ecx ; X64-NEXT: addl %ecx, %ecx ; X64-NEXT: movswl %cx, %eax ; X64-NEXT: shrl %eax @@ -70,9 +70,9 @@ ; X86-NEXT: shll $14, %eax ; X86-NEXT: xorl %edx, %edx ; X86-NEXT: divl %ecx -; X86-NEXT: cmpl $32767, %eax # imm = 0x7FFF +; X86-NEXT: cmpl $32766, %eax # imm = 0x7FFE ; X86-NEXT: movl $32767, %ecx # imm = 0x7FFF -; X86-NEXT: cmovbl %eax, %ecx +; X86-NEXT: cmovbel %eax, %ecx ; X86-NEXT: addl %ecx, %ecx ; X86-NEXT: movswl %cx, %eax ; X86-NEXT: shrl %eax @@ -97,9 +97,9 @@ ; X64-NEXT: divw %cx ; X64-NEXT: # kill: def $ax killed $ax def $eax ; X64-NEXT: movzwl %ax, %ecx -; X64-NEXT: cmpl $32767, %ecx # imm = 0x7FFF +; X64-NEXT: cmpl $32766, %ecx # imm = 0x7FFE ; X64-NEXT: movl $32767, %ecx # imm = 0x7FFF -; X64-NEXT: cmovbl %eax, %ecx +; X64-NEXT: cmovbel %eax, %ecx ; X64-NEXT: addl %ecx, %ecx ; X64-NEXT: movswl %cx, %eax ; X64-NEXT: shrl %eax @@ -118,9 +118,9 @@ ; X86-NEXT: divw %cx ; X86-NEXT: # kill: def $ax killed $ax def $eax ; X86-NEXT: movzwl %ax, %ecx -; X86-NEXT: cmpl $32767, %ecx # imm = 0x7FFF +; X86-NEXT: cmpl $32766, %ecx # imm = 0x7FFE ; X86-NEXT: movl $32767, %ecx # imm = 0x7FFF -; X86-NEXT: cmovbl %eax, %ecx +; X86-NEXT: cmovbel %eax, %ecx ; X86-NEXT: addl %ecx, %ecx ; X86-NEXT: movswl %cx, %eax ; X86-NEXT: shrl %eax @@ -142,9 +142,9 @@ ; X64-NEXT: movzbl %dil, %eax ; X64-NEXT: divb %sil ; X64-NEXT: movzbl %al, %ecx -; X64-NEXT: cmpb $15, %cl +; X64-NEXT: cmpb $14, %cl ; X64-NEXT: movl $15, %eax -; X64-NEXT: cmovbl %ecx, %eax +; X64-NEXT: cmovbel %ecx, %eax ; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq ; @@ -158,9 +158,9 @@ ; X86-NEXT: movzbl %al, %eax ; X86-NEXT: divb %cl ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $15, %al +; X86-NEXT: cmpb $14, %al ; X86-NEXT: movl $15, %eax -; X86-NEXT: cmovbl %ecx, %eax +; X86-NEXT: cmovbel %ecx, %eax ; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl %tmp = call i4 @llvm.udiv.fix.sat.i4(i4 %x, i4 %y, i32 2) @@ -170,27 +170,23 @@ define i64 @func5(i64 %x, i64 %y) nounwind { ; X64-LABEL: func5: ; X64: # %bb.0: -; X64-NEXT: pushq %rbx +; X64-NEXT: pushq %rax ; X64-NEXT: movq %rsi, %rdx ; X64-NEXT: leaq (%rdi,%rdi), %rsi ; X64-NEXT: movq %rdi, %rax ; X64-NEXT: shrq $63, %rax ; X64-NEXT: shrdq $33, %rax, %rsi ; X64-NEXT: shlq $32, %rdi -; X64-NEXT: xorl %ebx, %ebx ; X64-NEXT: xorl %ecx, %ecx ; X64-NEXT: callq __udivti3@PLT ; X64-NEXT: cmpq $1, %rdx -; X64-NEXT: sbbq %rbx, %rbx -; X64-NEXT: notq %rbx -; X64-NEXT: orq %rax, %rbx -; X64-NEXT: cmpq $1, %rdx -; X64-NEXT: movl $1, %ecx -; X64-NEXT: cmovbq %rdx, %rcx -; X64-NEXT: cmoveq %rax, %rbx -; X64-NEXT: shrdq $1, %rcx, %rbx -; X64-NEXT: movq %rbx, %rax -; X64-NEXT: popq %rbx +; X64-NEXT: movq $-1, %rcx +; X64-NEXT: cmovbeq %rax, %rcx +; X64-NEXT: testq %rdx, %rdx +; X64-NEXT: movl $1, %eax +; X64-NEXT: cmovbeq %rdx, %rax +; X64-NEXT: shldq $63, %rcx, %rax +; X64-NEXT: popq %rcx ; X64-NEXT: retq ; ; X86-LABEL: func5: @@ -218,17 +214,15 @@ ; X86-NEXT: pushl %esi ; X86-NEXT: calll __udivti3 ; X86-NEXT: addl $32, %esp -; X86-NEXT: movl (%esp), %ecx +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: orl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl $-1, %eax +; X86-NEXT: movl $-1, %edx +; X86-NEXT: jne .LBB4_2 +; X86-NEXT: # %bb.1: +; X86-NEXT: movl (%esp), %eax ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx -; X86-NEXT: cmpl $-1, %edx -; X86-NEXT: movl %ecx, %eax -; X86-NEXT: cmovel %edx, %eax -; X86-NEXT: cmovel %ecx, %eax -; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X86-NEXT: orl {{[0-9]+}}(%esp), %ecx -; X86-NEXT: movl $-1, %ecx -; X86-NEXT: cmovnel %ecx, %edx -; X86-NEXT: cmovnel %ecx, %eax +; X86-NEXT: .LBB4_2: ; X86-NEXT: leal -4(%ebp), %esp ; X86-NEXT: popl %esi ; X86-NEXT: popl %ebp @@ -247,9 +241,9 @@ ; X64-NEXT: shll $7, %eax ; X64-NEXT: xorl %edx, %edx ; X64-NEXT: divl %ecx -; X64-NEXT: cmpl $262143, %eax # imm = 0x3FFFF +; X64-NEXT: cmpl $262142, %eax # imm = 0x3FFFE ; X64-NEXT: movl $262143, %ecx # imm = 0x3FFFF -; X64-NEXT: cmovael %ecx, %eax +; X64-NEXT: cmoval %ecx, %eax ; X64-NEXT: retq ; ; X86-LABEL: func6: @@ -261,9 +255,9 @@ ; X86-NEXT: shll $7, %eax ; X86-NEXT: xorl %edx, %edx ; X86-NEXT: divl %ecx -; X86-NEXT: cmpl $262143, %eax # imm = 0x3FFFF +; X86-NEXT: cmpl $262142, %eax # imm = 0x3FFFE ; X86-NEXT: movl $262143, %ecx # imm = 0x3FFFF -; X86-NEXT: cmovael %ecx, %eax +; X86-NEXT: cmoval %ecx, %eax ; X86-NEXT: retl %x2 = sext i16 %x to i18 %y2 = sext i16 %y to i18 @@ -280,9 +274,9 @@ ; X64-NEXT: shlq $16, %rax ; X64-NEXT: xorl %edx, %edx ; X64-NEXT: divq %rcx -; X64-NEXT: cmpq $131071, %rax # imm = 0x1FFFF +; X64-NEXT: cmpq $131070, %rax # imm = 0x1FFFE ; X64-NEXT: movl $131071, %ecx # imm = 0x1FFFF -; X64-NEXT: cmovaeq %rcx, %rax +; X64-NEXT: cmovaq %rcx, %rax ; X64-NEXT: shrl %eax ; X64-NEXT: # kill: def $ax killed $ax killed $rax ; X64-NEXT: retq @@ -302,9 +296,9 @@ ; X86-NEXT: pushl %ecx ; X86-NEXT: calll __udivdi3 ; X86-NEXT: addl $16, %esp -; X86-NEXT: cmpl $131071, %eax # imm = 0x1FFFF +; X86-NEXT: cmpl $131070, %eax # imm = 0x1FFFE ; X86-NEXT: movl $131071, %ecx # imm = 0x1FFFF -; X86-NEXT: cmovael %ecx, %eax +; X86-NEXT: cmoval %ecx, %eax ; X86-NEXT: testl %edx, %edx ; X86-NEXT: cmovnel %ecx, %eax ; X86-NEXT: shrl %eax @@ -394,7 +388,10 @@ ; X86-NEXT: pushl %edi ; X86-NEXT: pushl %esi ; X86-NEXT: subl $12, %esp +; X86-NEXT: movl {{[0-9]+}}(%esp), %esi ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi +; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp +; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx ; X86-NEXT: xorl %eax, %eax ; X86-NEXT: addl %ecx, %ecx @@ -407,91 +404,72 @@ ; X86-NEXT: pushl %ecx ; X86-NEXT: calll __udivdi3 ; X86-NEXT: addl $16, %esp -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl $0, %ecx -; X86-NEXT: sbbl %ecx, %ecx -; X86-NEXT: notl %ecx -; X86-NEXT: orl %eax, %ecx -; X86-NEXT: movl %ecx, %esi -; X86-NEXT: xorl %ecx, %ecx -; X86-NEXT: addl %edi, %edi -; X86-NEXT: setb %cl -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx -; X86-NEXT: movl $1, %ebp -; X86-NEXT: cmovael %ebp, %edx +; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill ; X86-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: movl $1, %ebp -; X86-NEXT: cmovel %eax, %esi -; X86-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill -; X86-NEXT: shldl $31, %edi, %ecx -; X86-NEXT: shll $31, %edi +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: addl %ebp, %ebp +; X86-NEXT: setb %al +; X86-NEXT: shldl $31, %ebp, %eax +; X86-NEXT: shll $31, %ebp ; X86-NEXT: pushl $0 -; X86-NEXT: pushl {{[0-9]+}}(%esp) -; X86-NEXT: pushl %ecx -; X86-NEXT: pushl %edi +; X86-NEXT: pushl %ebx +; X86-NEXT: pushl %eax +; X86-NEXT: pushl %ebp ; X86-NEXT: calll __udivdi3 ; X86-NEXT: addl $16, %esp -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl $0, %edi -; X86-NEXT: sbbl %edi, %edi -; X86-NEXT: notl %edi -; X86-NEXT: orl %eax, %edi -; X86-NEXT: xorl %ecx, %ecx -; X86-NEXT: addl %ebx, %ebx -; X86-NEXT: setb %cl -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl {{[0-9]+}}(%esp), %esi -; X86-NEXT: cmovael %ebp, %edx -; X86-NEXT: movl %edx, (%esp) # 4-byte Spill -; X86-NEXT: cmovel %eax, %edi -; X86-NEXT: shldl $31, %ebx, %ecx -; X86-NEXT: shll $31, %ebx +; X86-NEXT: movl %eax, (%esp) # 4-byte Spill +; X86-NEXT: movl %edx, %ebp +; X86-NEXT: xorl %eax, %eax +; X86-NEXT: addl %edi, %edi +; X86-NEXT: setb %al +; X86-NEXT: shldl $31, %edi, %eax +; X86-NEXT: shll $31, %edi ; X86-NEXT: pushl $0 ; X86-NEXT: pushl {{[0-9]+}}(%esp) -; X86-NEXT: pushl %ecx -; X86-NEXT: pushl %ebx +; X86-NEXT: pushl %eax +; X86-NEXT: pushl %edi ; X86-NEXT: calll __udivdi3 ; X86-NEXT: addl $16, %esp -; X86-NEXT: movl %edx, %ebx -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl $0, %ebp -; X86-NEXT: sbbl %ebp, %ebp -; X86-NEXT: notl %ebp -; X86-NEXT: orl %eax, %ebp -; X86-NEXT: xorl %ecx, %ecx +; X86-NEXT: movl %eax, %ebx +; X86-NEXT: movl %edx, %edi +; X86-NEXT: xorl %eax, %eax ; X86-NEXT: addl %esi, %esi -; X86-NEXT: setb %cl -; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl $1, %edx -; X86-NEXT: cmovael %edx, %ebx -; X86-NEXT: cmovel %eax, %ebp -; X86-NEXT: shldl $31, %esi, %ecx +; X86-NEXT: setb %al +; X86-NEXT: shldl $31, %esi, %eax ; X86-NEXT: shll $31, %esi ; X86-NEXT: pushl $0 ; X86-NEXT: pushl {{[0-9]+}}(%esp) -; X86-NEXT: pushl %ecx +; X86-NEXT: pushl %eax ; X86-NEXT: pushl %esi ; X86-NEXT: calll __udivdi3 ; X86-NEXT: addl $16, %esp ; X86-NEXT: cmpl $1, %edx -; X86-NEXT: movl $0, %ecx -; X86-NEXT: sbbl %ecx, %ecx -; X86-NEXT: notl %ecx -; X86-NEXT: orl %eax, %ecx -; X86-NEXT: cmpl $1, %edx +; X86-NEXT: movl $-1, %ecx +; X86-NEXT: cmoval %ecx, %eax +; X86-NEXT: testl %edx, %edx ; X86-NEXT: movl $1, %esi -; X86-NEXT: cmovbl %edx, %esi -; X86-NEXT: cmovel %eax, %ecx -; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload -; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload -; X86-NEXT: shrdl $1, %eax, %edx +; X86-NEXT: cmoval %esi, %edx +; X86-NEXT: shldl $31, %eax, %edx +; X86-NEXT: cmpl $1, %edi +; X86-NEXT: cmoval %ecx, %ebx +; X86-NEXT: testl %edi, %edi +; X86-NEXT: cmoval %esi, %edi +; X86-NEXT: shldl $31, %ebx, %edi +; X86-NEXT: cmpl $1, %ebp ; X86-NEXT: movl (%esp), %eax # 4-byte Reload -; X86-NEXT: shrdl $1, %eax, %edi -; X86-NEXT: shrdl $1, %ebx, %ebp -; X86-NEXT: shrdl $1, %esi, %ecx +; X86-NEXT: cmoval %ecx, %eax +; X86-NEXT: testl %ebp, %ebp +; X86-NEXT: cmoval %esi, %ebp +; X86-NEXT: shldl $31, %eax, %ebp +; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload +; X86-NEXT: cmpl $1, %ebx +; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload +; X86-NEXT: cmoval %ecx, %eax +; X86-NEXT: testl %ebx, %ebx +; X86-NEXT: cmovbel %ebx, %esi +; X86-NEXT: shldl $31, %eax, %esi ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: movl %ecx, 12(%eax) +; X86-NEXT: movl %esi, 12(%eax) ; X86-NEXT: movl %ebp, 8(%eax) ; X86-NEXT: movl %edi, 4(%eax) ; X86-NEXT: movl %edx, (%eax) diff --git a/llvm/test/CodeGen/X86/umul_fix_sat.ll b/llvm/test/CodeGen/X86/umul_fix_sat.ll --- a/llvm/test/CodeGen/X86/umul_fix_sat.ll +++ b/llvm/test/CodeGen/X86/umul_fix_sat.ll @@ -16,9 +16,9 @@ ; X64-NEXT: movq %rcx, %rax ; X64-NEXT: shrq $32, %rax ; X64-NEXT: shrdl $2, %eax, %ecx -; X64-NEXT: cmpl $3, %eax +; X64-NEXT: cmpl $4, %eax ; X64-NEXT: movl $-1, %eax -; X64-NEXT: cmovbel %ecx, %eax +; X64-NEXT: cmovbl %ecx, %eax ; X64-NEXT: retq ; ; X86-LABEL: func: @@ -26,9 +26,9 @@ ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: mull {{[0-9]+}}(%esp) ; X86-NEXT: shrdl $2, %edx, %eax -; X86-NEXT: cmpl $3, %edx +; X86-NEXT: cmpl $4, %edx ; X86-NEXT: movl $-1, %ecx -; X86-NEXT: cmoval %ecx, %eax +; X86-NEXT: cmovael %ecx, %eax ; X86-NEXT: retl %tmp = call i32 @llvm.umul.fix.sat.i32(i32 %x, i32 %y, i32 2) ret i32 %tmp @@ -40,9 +40,9 @@ ; X64-NEXT: movq %rdi, %rax ; X64-NEXT: mulq %rsi ; X64-NEXT: shrdq $2, %rdx, %rax -; X64-NEXT: cmpq $3, %rdx +; X64-NEXT: cmpq $4, %rdx ; X64-NEXT: movq $-1, %rcx -; X64-NEXT: cmovaq %rcx, %rax +; X64-NEXT: cmovaeq %rcx, %rax ; X64-NEXT: retq ; ; X86-LABEL: func2: @@ -105,9 +105,9 @@ ; X64-NEXT: shlb $6, %dl ; X64-NEXT: orb %cl, %dl ; X64-NEXT: movzbl %dl, %ecx -; X64-NEXT: cmpb $3, %al +; X64-NEXT: cmpb $4, %al ; X64-NEXT: movl $255, %eax -; X64-NEXT: cmovbel %ecx, %eax +; X64-NEXT: cmovbl %ecx, %eax ; X64-NEXT: shrb $4, %al ; X64-NEXT: # kill: def $al killed $al killed $eax ; X64-NEXT: retq @@ -126,9 +126,9 @@ ; X86-NEXT: shrb $2, %al ; X86-NEXT: orb %cl, %al ; X86-NEXT: movzbl %al, %ecx -; X86-NEXT: cmpb $3, %ah +; X86-NEXT: cmpb $4, %ah ; X86-NEXT: movl $255, %eax -; X86-NEXT: cmovbel %ecx, %eax +; X86-NEXT: cmovbl %ecx, %eax ; X86-NEXT: shrb $4, %al ; X86-NEXT: # kill: def $al killed $al killed $eax ; X86-NEXT: retl @@ -147,9 +147,9 @@ ; X64-NEXT: movq %rcx, %rax ; X64-NEXT: shrq $32, %rax ; X64-NEXT: shrdl $2, %eax, %ecx -; X64-NEXT: cmpl $3, %eax +; X64-NEXT: cmpl $4, %eax ; X64-NEXT: movl $-1, %eax -; X64-NEXT: cmoval %eax, %ecx +; X64-NEXT: cmovael %eax, %ecx ; X64-NEXT: movd %ecx, %xmm2 ; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm1[2,3,2,3] ; X64-NEXT: movd %xmm3, %ecx @@ -159,8 +159,8 @@ ; X64-NEXT: movq %rdx, %rcx ; X64-NEXT: shrq $32, %rcx ; X64-NEXT: shrdl $2, %ecx, %edx -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: cmoval %eax, %edx +; X64-NEXT: cmpl $4, %ecx +; X64-NEXT: cmovael %eax, %edx ; X64-NEXT: movd %edx, %xmm3 ; X64-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1] ; X64-NEXT: movd %xmm1, %ecx @@ -169,8 +169,8 @@ ; X64-NEXT: movq %rdx, %rcx ; X64-NEXT: shrq $32, %rcx ; X64-NEXT: shrdl $2, %ecx, %edx -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: cmoval %eax, %edx +; X64-NEXT: cmpl $4, %ecx +; X64-NEXT: cmovael %eax, %edx ; X64-NEXT: movd %edx, %xmm2 ; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,1,1] ; X64-NEXT: movd %xmm1, %ecx @@ -180,8 +180,8 @@ ; X64-NEXT: movq %rdx, %rcx ; X64-NEXT: shrq $32, %rcx ; X64-NEXT: shrdl $2, %ecx, %edx -; X64-NEXT: cmpl $3, %ecx -; X64-NEXT: cmoval %eax, %edx +; X64-NEXT: cmpl $4, %ecx +; X64-NEXT: cmovael %eax, %edx ; X64-NEXT: movd %edx, %xmm0 ; X64-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1] ; X64-NEXT: punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0] @@ -201,26 +201,26 @@ ; X86-NEXT: mull {{[0-9]+}}(%esp) ; X86-NEXT: movl %eax, %esi ; X86-NEXT: shrdl $2, %edx, %esi -; X86-NEXT: cmpl $3, %edx +; X86-NEXT: cmpl $4, %edx ; X86-NEXT: movl $-1, %ecx -; X86-NEXT: cmoval %ecx, %esi +; X86-NEXT: cmovael %ecx, %esi ; X86-NEXT: movl %ebp, %eax ; X86-NEXT: mull {{[0-9]+}}(%esp) ; X86-NEXT: movl %eax, %ebp ; X86-NEXT: shrdl $2, %edx, %ebp -; X86-NEXT: cmpl $3, %edx -; X86-NEXT: cmoval %ecx, %ebp +; X86-NEXT: cmpl $4, %edx +; X86-NEXT: cmovael %ecx, %ebp ; X86-NEXT: movl %ebx, %eax ; X86-NEXT: mull {{[0-9]+}}(%esp) ; X86-NEXT: movl %eax, %ebx ; X86-NEXT: shrdl $2, %edx, %ebx -; X86-NEXT: cmpl $3, %edx -; X86-NEXT: cmoval %ecx, %ebx +; X86-NEXT: cmpl $4, %edx +; X86-NEXT: cmovael %ecx, %ebx ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax ; X86-NEXT: mull {{[0-9]+}}(%esp) ; X86-NEXT: shrdl $2, %edx, %eax -; X86-NEXT: cmpl $3, %edx -; X86-NEXT: cmoval %ecx, %eax +; X86-NEXT: cmpl $4, %edx +; X86-NEXT: cmovael %ecx, %eax ; X86-NEXT: movl %eax, 12(%edi) ; X86-NEXT: movl %ebx, 8(%edi) ; X86-NEXT: movl %ebp, 4(%edi) @@ -431,10 +431,10 @@ ; X64-NEXT: movq %rdi, %rax ; X64-NEXT: mulq %rsi ; X64-NEXT: shrdq $32, %rdx, %rax -; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF +; X64-NEXT: movabsq $4294967296, %rcx # imm = 0x100000000 ; X64-NEXT: cmpq %rcx, %rdx ; X64-NEXT: movq $-1, %rcx -; X64-NEXT: cmovaq %rcx, %rax +; X64-NEXT: cmovaeq %rcx, %rax ; X64-NEXT: retq ; ; X86-LABEL: func7: @@ -487,10 +487,10 @@ ; X64-NEXT: movq %rdi, %rax ; X64-NEXT: mulq %rsi ; X64-NEXT: shrdq $63, %rdx, %rax -; X64-NEXT: movabsq $9223372036854775807, %rcx # imm = 0x7FFFFFFFFFFFFFFF +; X64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000 ; X64-NEXT: cmpq %rcx, %rdx ; X64-NEXT: movq $-1, %rcx -; X64-NEXT: cmovaq %rcx, %rax +; X64-NEXT: cmovaeq %rcx, %rax ; X64-NEXT: retq ; ; X86-LABEL: func8: diff --git a/llvm/test/CodeGen/X86/urem-seteq-illegal-types.ll b/llvm/test/CodeGen/X86/urem-seteq-illegal-types.ll --- a/llvm/test/CodeGen/X86/urem-seteq-illegal-types.ll +++ b/llvm/test/CodeGen/X86/urem-seteq-illegal-types.ll @@ -12,16 +12,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $3277, {{[0-9]+}}(%esp), %eax # imm = 0xCCD ; X86-NEXT: andl $8191, %eax # imm = 0x1FFF -; X86-NEXT: cmpl $1639, %eax # imm = 0x667 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $1638, %eax # imm = 0x666 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd: ; X64: # %bb.0: ; X64-NEXT: imull $3277, %edi, %eax # imm = 0xCCD ; X64-NEXT: andl $8191, %eax # imm = 0x1FFF -; X64-NEXT: cmpl $1639, %eax # imm = 0x667 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $1638, %eax # imm = 0x666 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i13 %X, 5 %cmp = icmp eq i13 %urem, 0 @@ -38,8 +38,8 @@ ; X86-NEXT: shrl %eax ; X86-NEXT: orl %ecx, %eax ; X86-NEXT: andl $134217727, %eax # imm = 0x7FFFFFF -; X86-NEXT: cmpl $9586981, %eax # imm = 0x924925 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $9586980, %eax # imm = 0x924924 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_even: @@ -51,8 +51,8 @@ ; X64-NEXT: shrl %eax ; X64-NEXT: orl %ecx, %eax ; X64-NEXT: andl $134217727, %eax # imm = 0x7FFFFFF -; X64-NEXT: cmpl $9586981, %eax # imm = 0x924925 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $9586980, %eax # imm = 0x924924 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i27 %X, 14 %cmp = icmp eq i27 %urem, 0 @@ -66,8 +66,8 @@ ; X86-NEXT: leal (%eax,%eax,2), %ecx ; X86-NEXT: leal (%eax,%ecx,4), %eax ; X86-NEXT: andb $15, %al -; X86-NEXT: cmpb $3, %al -; X86-NEXT: seta %al +; X86-NEXT: cmpb $4, %al +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd_setne: @@ -76,8 +76,8 @@ ; X64-NEXT: leal (%rdi,%rdi,2), %eax ; X64-NEXT: leal (%rdi,%rax,4), %eax ; X64-NEXT: andb $15, %al -; X64-NEXT: cmpb $3, %al -; X64-NEXT: seta %al +; X64-NEXT: cmpb $4, %al +; X64-NEXT: setae %al ; X64-NEXT: retq %urem = urem i4 %X, 5 %cmp = icmp ne i4 %urem, 0 @@ -89,16 +89,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $307, {{[0-9]+}}(%esp), %eax # imm = 0x133 ; X86-NEXT: andl $511, %eax # imm = 0x1FF -; X86-NEXT: cmpw $1, %ax -; X86-NEXT: seta %al +; X86-NEXT: cmpw $2, %ax +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_negative_odd: ; X64: # %bb.0: ; X64-NEXT: imull $307, %edi, %eax # imm = 0x133 ; X64-NEXT: andl $511, %eax # imm = 0x1FF -; X64-NEXT: cmpw $1, %ax -; X64-NEXT: seta %al +; X64-NEXT: cmpw $2, %ax +; X64-NEXT: setae %al ; X64-NEXT: retq %urem = urem i9 %X, -5 %cmp = icmp ne i9 %urem, 0 @@ -115,18 +115,18 @@ ; X86-NEXT: shrl %eax ; X86-NEXT: orl %ecx, %eax ; X86-NEXT: andl $2047, %eax # imm = 0x7FF -; X86-NEXT: cmpl $341, %eax # imm = 0x155 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $342, %eax # imm = 0x156 +; X86-NEXT: setae %al ; X86-NEXT: imull $1463, {{[0-9]+}}(%esp), %ecx # imm = 0x5B7 ; X86-NEXT: addl $-1463, %ecx # imm = 0xFA49 ; X86-NEXT: andl $2047, %ecx # imm = 0x7FF -; X86-NEXT: cmpl $292, %ecx # imm = 0x124 -; X86-NEXT: seta %dl +; X86-NEXT: cmpl $293, %ecx # imm = 0x125 +; X86-NEXT: setae %dl ; X86-NEXT: imull $819, {{[0-9]+}}(%esp), %ecx # imm = 0x333 ; X86-NEXT: addl $-1638, %ecx # imm = 0xF99A ; X86-NEXT: andl $2047, %ecx # imm = 0x7FF -; X86-NEXT: cmpw $1, %cx -; X86-NEXT: seta %cl +; X86-NEXT: cmpw $2, %cx +; X86-NEXT: setae %cl ; X86-NEXT: retl ; ; SSE2-LABEL: test_urem_vec: diff --git a/llvm/test/CodeGen/X86/urem-seteq-nonzero.ll b/llvm/test/CodeGen/X86/urem-seteq-nonzero.ll --- a/llvm/test/CodeGen/X86/urem-seteq-nonzero.ll +++ b/llvm/test/CodeGen/X86/urem-seteq-nonzero.ll @@ -7,16 +7,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: addl $1431655765, %eax # imm = 0x55555555 -; X86-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $1431655764, %eax # imm = 0x55555554 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_3_1: ; X64: # %bb.0: ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: addl $1431655765, %eax # imm = 0x55555555 -; X64-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $1431655764, %eax # imm = 0x55555554 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 3 %cmp = icmp eq i32 %urem, 1 @@ -28,16 +28,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: addl $-1431655766, %eax # imm = 0xAAAAAAAA -; X86-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $1431655764, %eax # imm = 0x55555554 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_3_2: ; X64: # %bb.0: ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: addl $-1431655766, %eax # imm = 0xAAAAAAAA -; X64-NEXT: cmpl $1431655765, %eax # imm = 0x55555555 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $1431655764, %eax # imm = 0x55555554 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 3 %cmp = icmp eq i32 %urem, 2 @@ -50,16 +50,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD ; X86-NEXT: addl $858993459, %eax # imm = 0x33333333 -; X86-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_5_1: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD ; X64-NEXT: addl $858993459, %eax # imm = 0x33333333 -; X64-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 5 %cmp = icmp eq i32 %urem, 1 @@ -71,16 +71,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD ; X86-NEXT: addl $1717986918, %eax # imm = 0x66666666 -; X86-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_5_2: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD ; X64-NEXT: addl $1717986918, %eax # imm = 0x66666666 -; X64-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 5 %cmp = icmp eq i32 %urem, 2 @@ -92,16 +92,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD ; X86-NEXT: addl $-1717986919, %eax # imm = 0x99999999 -; X86-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_5_3: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD ; X64-NEXT: addl $-1717986919, %eax # imm = 0x99999999 -; X64-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 5 %cmp = icmp eq i32 %urem, 3 @@ -113,16 +113,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD ; X86-NEXT: addl $-858993460, %eax # imm = 0xCCCCCCCC -; X86-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_5_4: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD ; X64-NEXT: addl $-858993460, %eax # imm = 0xCCCCCCCC -; X64-NEXT: cmpl $858993459, %eax # imm = 0x33333333 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $858993458, %eax # imm = 0x33333332 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 5 %cmp = icmp eq i32 %urem, 4 @@ -136,8 +136,8 @@ ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: addl $1431655765, %eax # imm = 0x55555555 ; X86-NEXT: rorl %eax -; X86-NEXT: cmpl $715827883, %eax # imm = 0x2AAAAAAB -; X86-NEXT: setb %al +; X86-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_6_1: @@ -145,8 +145,8 @@ ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: addl $1431655765, %eax # imm = 0x55555555 ; X64-NEXT: rorl %eax -; X64-NEXT: cmpl $715827883, %eax # imm = 0x2AAAAAAB -; X64-NEXT: setb %al +; X64-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 6 %cmp = icmp eq i32 %urem, 1 @@ -159,8 +159,8 @@ ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: addl $-1431655766, %eax # imm = 0xAAAAAAAA ; X86-NEXT: rorl %eax -; X86-NEXT: cmpl $715827883, %eax # imm = 0x2AAAAAAB -; X86-NEXT: setb %al +; X86-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_6_2: @@ -168,8 +168,8 @@ ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: addl $-1431655766, %eax # imm = 0xAAAAAAAA ; X64-NEXT: rorl %eax -; X64-NEXT: cmpl $715827883, %eax # imm = 0x2AAAAAAB -; X64-NEXT: setb %al +; X64-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 6 %cmp = icmp eq i32 %urem, 2 @@ -182,8 +182,8 @@ ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: decl %eax ; X86-NEXT: rorl %eax -; X86-NEXT: cmpl $715827883, %eax # imm = 0x2AAAAAAB -; X86-NEXT: setb %al +; X86-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_6_3: @@ -191,8 +191,8 @@ ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: decl %eax ; X64-NEXT: rorl %eax -; X64-NEXT: cmpl $715827883, %eax # imm = 0x2AAAAAAB -; X64-NEXT: setb %al +; X64-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 6 %cmp = icmp eq i32 %urem, 3 @@ -205,8 +205,8 @@ ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: addl $1431655764, %eax # imm = 0x55555554 ; X86-NEXT: rorl %eax -; X86-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA -; X86-NEXT: setb %al +; X86-NEXT: cmpl $715827881, %eax # imm = 0x2AAAAAA9 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_6_4: @@ -214,8 +214,8 @@ ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: addl $1431655764, %eax # imm = 0x55555554 ; X64-NEXT: rorl %eax -; X64-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA -; X64-NEXT: setb %al +; X64-NEXT: cmpl $715827881, %eax # imm = 0x2AAAAAA9 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 6 %cmp = icmp eq i32 %urem, 4 @@ -228,8 +228,8 @@ ; X86-NEXT: imull $-1431655765, {{[0-9]+}}(%esp), %eax # imm = 0xAAAAAAAB ; X86-NEXT: addl $-1431655767, %eax # imm = 0xAAAAAAA9 ; X86-NEXT: rorl %eax -; X86-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA -; X86-NEXT: setb %al +; X86-NEXT: cmpl $715827881, %eax # imm = 0x2AAAAAA9 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t32_6_5: @@ -237,8 +237,8 @@ ; X64-NEXT: imull $-1431655765, %edi, %eax # imm = 0xAAAAAAAB ; X64-NEXT: addl $-1431655767, %eax # imm = 0xAAAAAAA9 ; X64-NEXT: rorl %eax -; X64-NEXT: cmpl $715827882, %eax # imm = 0x2AAAAAAA -; X64-NEXT: setb %al +; X64-NEXT: cmpl $715827881, %eax # imm = 0x2AAAAAA9 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 6 %cmp = icmp eq i32 %urem, 5 @@ -254,8 +254,8 @@ ; X86-NEXT: imull $-21845, {{[0-9]+}}(%esp), %eax # imm = 0xAAAB ; X86-NEXT: addl $-21846, %eax # imm = 0xAAAA ; X86-NEXT: movzwl %ax, %eax -; X86-NEXT: cmpl $21845, %eax # imm = 0x5555 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $21844, %eax # imm = 0x5554 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t16_3_2: @@ -263,8 +263,8 @@ ; X64-NEXT: imull $-21845, %edi, %eax # imm = 0xAAAB ; X64-NEXT: addl $-21846, %eax # imm = 0xAAAA ; X64-NEXT: movzwl %ax, %eax -; X64-NEXT: cmpl $21845, %eax # imm = 0x5555 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $21844, %eax # imm = 0x5554 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i16 %X, 3 %cmp = icmp eq i16 %urem, 2 @@ -276,16 +276,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-85, {{[0-9]+}}(%esp), %eax ; X86-NEXT: addb $-86, %al -; X86-NEXT: cmpb $85, %al -; X86-NEXT: setb %al +; X86-NEXT: cmpb $84, %al +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: t8_3_2: ; X64: # %bb.0: ; X64-NEXT: imull $-85, %edi, %eax ; X64-NEXT: addb $-86, %al -; X64-NEXT: cmpb $85, %al -; X64-NEXT: setb %al +; X64-NEXT: cmpb $84, %al +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i8 %X, 3 %cmp = icmp eq i8 %urem, 2 @@ -316,9 +316,9 @@ ; X64-NEXT: imulq %rdi, %rax ; X64-NEXT: movabsq $-6148914691236517206, %rcx # imm = 0xAAAAAAAAAAAAAAAA ; X64-NEXT: addq %rax, %rcx -; X64-NEXT: movabsq $6148914691236517205, %rax # imm = 0x5555555555555555 +; X64-NEXT: movabsq $6148914691236517204, %rax # imm = 0x5555555555555554 ; X64-NEXT: cmpq %rax, %rcx -; X64-NEXT: setb %al +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i64 %X, 3 %cmp = icmp eq i64 %urem, 2 diff --git a/llvm/test/CodeGen/X86/urem-seteq-optsize.ll b/llvm/test/CodeGen/X86/urem-seteq-optsize.ll --- a/llvm/test/CodeGen/X86/urem-seteq-optsize.ll +++ b/llvm/test/CodeGen/X86/urem-seteq-optsize.ll @@ -48,9 +48,9 @@ ; X86-LABEL: test_optsize: ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD -; X86-NEXT: cmpl $858993460, %eax # imm = 0x33333334 +; X86-NEXT: cmpl $858993459, %eax # imm = 0x33333333 ; X86-NEXT: movl $42, %eax -; X86-NEXT: jb .LBB1_2 +; X86-NEXT: jbe .LBB1_2 ; X86-NEXT: # %bb.1: ; X86-NEXT: movl $-10, %eax ; X86-NEXT: .LBB1_2: @@ -59,10 +59,10 @@ ; X64-LABEL: test_optsize: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD -; X64-NEXT: cmpl $858993460, %eax # imm = 0x33333334 +; X64-NEXT: cmpl $858993459, %eax # imm = 0x33333333 ; X64-NEXT: movl $42, %ecx ; X64-NEXT: movl $-10, %eax -; X64-NEXT: cmovbl %ecx, %eax +; X64-NEXT: cmovbel %ecx, %eax ; X64-NEXT: retq %rem = urem i32 %X, 5 %cmp = icmp eq i32 %rem, 0 diff --git a/llvm/test/CodeGen/X86/urem-seteq.ll b/llvm/test/CodeGen/X86/urem-seteq.ll --- a/llvm/test/CodeGen/X86/urem-seteq.ll +++ b/llvm/test/CodeGen/X86/urem-seteq.ll @@ -11,16 +11,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %ecx # imm = 0xCCCCCCCD ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $858993460, %ecx # imm = 0x33333334 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %ecx # imm = 0xCCCCCCCD ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $858993460, %ecx # imm = 0x33333334 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 5 %cmp = icmp eq i32 %urem, 0 @@ -33,16 +33,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-1030792151, {{[0-9]+}}(%esp), %ecx # imm = 0xC28F5C29 ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $171798692, %ecx # imm = 0xA3D70A4 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $171798691, %ecx # imm = 0xA3D70A3 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd_25: ; X64: # %bb.0: ; X64-NEXT: imull $-1030792151, %edi, %ecx # imm = 0xC28F5C29 ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $171798692, %ecx # imm = 0xA3D70A4 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $171798691, %ecx # imm = 0xA3D70A3 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 25 %cmp = icmp eq i32 %urem, 0 @@ -56,16 +56,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $1789569707, {{[0-9]+}}(%esp), %ecx # imm = 0x6AAAAAAB ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $4, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $3, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd_bit30: ; X64: # %bb.0: ; X64-NEXT: imull $1789569707, %edi, %ecx # imm = 0x6AAAAAAB ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $4, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $3, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 1073741827 %cmp = icmp eq i32 %urem, 0 @@ -79,16 +79,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $715827883, {{[0-9]+}}(%esp), %ecx # imm = 0x2AAAAAAB ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $2, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $1, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd_bit31: ; X64: # %bb.0: ; X64-NEXT: imull $715827883, %edi, %ecx # imm = 0x2AAAAAAB ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $2, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $1, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 2147483651 %cmp = icmp eq i32 %urem, 0 @@ -107,8 +107,8 @@ ; X86-NEXT: rorw %ax ; X86-NEXT: movzwl %ax, %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $4681, %ecx # imm = 0x1249 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $4682, %ecx # imm = 0x124A +; X86-NEXT: setae %al ; X86-NEXT: # kill: def $ax killed $ax killed $eax ; X86-NEXT: retl ; @@ -118,8 +118,8 @@ ; X64-NEXT: rorw %ax ; X64-NEXT: movzwl %ax, %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $4681, %ecx # imm = 0x1249 -; X64-NEXT: seta %al +; X64-NEXT: cmpl $4682, %ecx # imm = 0x124A +; X64-NEXT: setae %al ; X64-NEXT: # kill: def $ax killed $ax killed $eax ; X64-NEXT: retq %urem = urem i16 %X, 14 @@ -134,8 +134,8 @@ ; X86-NEXT: imull $-1030792151, {{[0-9]+}}(%esp), %ecx # imm = 0xC28F5C29 ; X86-NEXT: rorl $2, %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $42949673, %ecx # imm = 0x28F5C29 -; X86-NEXT: setb %al +; X86-NEXT: cmpl $42949672, %ecx # imm = 0x28F5C28 +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_even_100: @@ -143,8 +143,8 @@ ; X64-NEXT: imull $-1030792151, %edi, %ecx # imm = 0xC28F5C29 ; X64-NEXT: rorl $2, %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $42949673, %ecx # imm = 0x28F5C29 -; X64-NEXT: setb %al +; X64-NEXT: cmpl $42949672, %ecx # imm = 0x28F5C28 +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 100 %cmp = icmp eq i32 %urem, 0 @@ -159,8 +159,8 @@ ; X86-NEXT: imull $-51622203, {{[0-9]+}}(%esp), %ecx # imm = 0xFCEC4EC5 ; X86-NEXT: rorl $3, %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $4, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $3, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_even_bit30: @@ -168,8 +168,8 @@ ; X64-NEXT: imull $-51622203, %edi, %ecx # imm = 0xFCEC4EC5 ; X64-NEXT: rorl $3, %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $4, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $3, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 1073741928 %cmp = icmp eq i32 %urem, 0 @@ -184,8 +184,8 @@ ; X86-NEXT: imull $-1157956869, {{[0-9]+}}(%esp), %ecx # imm = 0xBAFAFAFB ; X86-NEXT: rorl %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $2, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $1, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_even_bit31: @@ -193,8 +193,8 @@ ; X64-NEXT: imull $-1157956869, %edi, %ecx # imm = 0xBAFAFAFB ; X64-NEXT: rorl %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $2, %ecx -; X64-NEXT: setb %al +; X64-NEXT: cmpl $1, %ecx +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 2147483750 %cmp = icmp eq i32 %urem, 0 @@ -212,16 +212,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %ecx # imm = 0xCCCCCCCD ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 -; X86-NEXT: seta %al +; X86-NEXT: cmpl $858993460, %ecx # imm = 0x33333334 +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_odd_setne: ; X64: # %bb.0: ; X64-NEXT: imull $-858993459, %edi, %ecx # imm = 0xCCCCCCCD ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $858993459, %ecx # imm = 0x33333333 -; X64-NEXT: seta %al +; X64-NEXT: cmpl $858993460, %ecx # imm = 0x33333334 +; X64-NEXT: setae %al ; X64-NEXT: retq %urem = urem i32 %X, 5 %cmp = icmp ne i32 %urem, 0 @@ -235,16 +235,16 @@ ; X86: # %bb.0: ; X86-NEXT: imull $858993459, {{[0-9]+}}(%esp), %ecx # imm = 0x33333333 ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $1, %ecx -; X86-NEXT: seta %al +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_negative_odd: ; X64: # %bb.0: ; X64-NEXT: imull $858993459, %edi, %ecx # imm = 0x33333333 ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $1, %ecx -; X64-NEXT: seta %al +; X64-NEXT: cmpl $2, %ecx +; X64-NEXT: setae %al ; X64-NEXT: retq %urem = urem i32 %X, -5 %cmp = icmp ne i32 %urem, 0 @@ -257,8 +257,8 @@ ; X86-NEXT: imull $-920350135, {{[0-9]+}}(%esp), %ecx # imm = 0xC9249249 ; X86-NEXT: rorl %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $1, %ecx -; X86-NEXT: seta %al +; X86-NEXT: cmpl $2, %ecx +; X86-NEXT: setae %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_negative_even: @@ -266,8 +266,8 @@ ; X64-NEXT: imull $-920350135, %edi, %ecx # imm = 0xC9249249 ; X64-NEXT: rorl %ecx ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $1, %ecx -; X64-NEXT: seta %al +; X64-NEXT: cmpl $2, %ecx +; X64-NEXT: setae %al ; X64-NEXT: retq %urem = urem i32 %X, -14 %cmp = icmp ne i32 %urem, 0 @@ -340,16 +340,16 @@ ; X86-NEXT: xorl %ecx, %ecx ; X86-NEXT: subl {{[0-9]+}}(%esp), %ecx ; X86-NEXT: xorl %eax, %eax -; X86-NEXT: cmpl $2, %ecx -; X86-NEXT: setb %al +; X86-NEXT: cmpl $1, %ecx +; X86-NEXT: setbe %al ; X86-NEXT: retl ; ; X64-LABEL: test_urem_allones: ; X64: # %bb.0: ; X64-NEXT: negl %edi ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: cmpl $2, %edi -; X64-NEXT: setb %al +; X64-NEXT: cmpl $1, %edi +; X64-NEXT: setbe %al ; X64-NEXT: retq %urem = urem i32 %X, 4294967295 %cmp = icmp eq i32 %urem, 0 diff --git a/llvm/test/CodeGen/X86/use-cr-result-of-dom-icmp-st.ll b/llvm/test/CodeGen/X86/use-cr-result-of-dom-icmp-st.ll --- a/llvm/test/CodeGen/X86/use-cr-result-of-dom-icmp-st.ll +++ b/llvm/test/CodeGen/X86/use-cr-result-of-dom-icmp-st.ll @@ -24,8 +24,9 @@ ; CHECK-NEXT: cmpq $-2, %rdx ; CHECK-NEXT: jg .LBB0_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpq $-3, %rdx ; CHECK-NEXT: movl $1, %ecx -; CHECK-NEXT: cmovlq %rcx, %rax +; CHECK-NEXT: cmovleq %rcx, %rax ; CHECK-NEXT: imulq %rdi, %rax ; CHECK-NEXT: .LBB0_2: # %return ; CHECK-NEXT: retq @@ -56,9 +57,9 @@ ; CHECK-NEXT: # %bb.2: # %return ; CHECK-NEXT: retq ; CHECK-NEXT: .LBB1_1: # %if.end -; CHECK-NEXT: cmpq $-1, %rdx +; CHECK-NEXT: cmpq $-2, %rdx ; CHECK-NEXT: movl $1, %ecx -; CHECK-NEXT: cmovlq %rcx, %rax +; CHECK-NEXT: cmovleq %rcx, %rax ; CHECK-NEXT: imulq %rdi, %rax ; CHECK-NEXT: retq entry: @@ -148,8 +149,9 @@ ; CHECK-NEXT: cmpq $2, %rdx ; CHECK-NEXT: jg .LBB4_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpq $1, %rdx ; CHECK-NEXT: movl $1, %ecx -; CHECK-NEXT: cmovlq %rcx, %rax +; CHECK-NEXT: cmovleq %rcx, %rax ; CHECK-NEXT: imulq %rdi, %rax ; CHECK-NEXT: .LBB4_2: # %return ; CHECK-NEXT: retq @@ -175,8 +177,9 @@ ; CHECK-NEXT: cmpq $-2, %rdi ; CHECK-NEXT: jg .LBB5_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpq $-3, %rdi ; CHECK-NEXT: movl $1, %ecx -; CHECK-NEXT: cmovlq %rcx, %rax +; CHECK-NEXT: cmovleq %rcx, %rax ; CHECK-NEXT: imulq %rdi, %rax ; CHECK-NEXT: .LBB5_2: # %return ; CHECK-NEXT: retq @@ -203,9 +206,9 @@ ; CHECK-NEXT: # %bb.2: # %return ; CHECK-NEXT: retq ; CHECK-NEXT: .LBB6_1: # %if.end -; CHECK-NEXT: cmpq $-1, %rdi +; CHECK-NEXT: cmpq $-2, %rdi ; CHECK-NEXT: movl $1, %ecx -; CHECK-NEXT: cmovlq %rcx, %rax +; CHECK-NEXT: cmovleq %rcx, %rax ; CHECK-NEXT: imulq %rdi, %rax ; CHECK-NEXT: retq entry: @@ -283,8 +286,9 @@ ; CHECK-NEXT: cmpq $2, %rdi ; CHECK-NEXT: jg .LBB9_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpq $1, %rdi ; CHECK-NEXT: movl $1, %ecx -; CHECK-NEXT: cmovlq %rcx, %rax +; CHECK-NEXT: cmovleq %rcx, %rax ; CHECK-NEXT: imulq %rdi, %rax ; CHECK-NEXT: .LBB9_2: # %return ; CHECK-NEXT: retq @@ -311,8 +315,9 @@ ; CHECK-NEXT: cmpl $-2, %eax ; CHECK-NEXT: jg .LBB10_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpl $-3, %eax ; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: cmovll %eax, %ecx +; CHECK-NEXT: cmovlel %eax, %ecx ; CHECK-NEXT: imull %edi, %ecx ; CHECK-NEXT: .LBB10_2: # %return ; CHECK-NEXT: movslq %ecx, %rax @@ -346,9 +351,9 @@ ; CHECK-NEXT: movslq %ecx, %rax ; CHECK-NEXT: retq ; CHECK-NEXT: .LBB11_1: # %if.end -; CHECK-NEXT: cmpl $-1, %eax +; CHECK-NEXT: cmpl $-2, %eax ; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: cmovll %eax, %ecx +; CHECK-NEXT: cmovlel %eax, %ecx ; CHECK-NEXT: imull %edi, %ecx ; CHECK-NEXT: movslq %ecx, %rax ; CHECK-NEXT: retq @@ -445,8 +450,9 @@ ; CHECK-NEXT: cmpl $2, %eax ; CHECK-NEXT: jg .LBB14_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpl $1, %eax ; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: cmovll %eax, %ecx +; CHECK-NEXT: cmovlel %eax, %ecx ; CHECK-NEXT: imull %edi, %ecx ; CHECK-NEXT: .LBB14_2: # %return ; CHECK-NEXT: movslq %ecx, %rax @@ -474,8 +480,9 @@ ; CHECK-NEXT: cmpl $-2, %edi ; CHECK-NEXT: jg .LBB15_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpl $-3, %edi ; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: cmovll %eax, %esi +; CHECK-NEXT: cmovlel %eax, %esi ; CHECK-NEXT: imull %edi, %esi ; CHECK-NEXT: .LBB15_2: # %return ; CHECK-NEXT: movslq %esi, %rax @@ -505,9 +512,9 @@ ; CHECK-NEXT: movslq %esi, %rax ; CHECK-NEXT: retq ; CHECK-NEXT: .LBB16_1: # %if.end -; CHECK-NEXT: cmpl $-1, %edi +; CHECK-NEXT: cmpl $-2, %edi ; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: cmovll %eax, %esi +; CHECK-NEXT: cmovlel %eax, %esi ; CHECK-NEXT: imull %edi, %esi ; CHECK-NEXT: movslq %esi, %rax ; CHECK-NEXT: retq @@ -592,8 +599,9 @@ ; CHECK-NEXT: cmpl $2, %edi ; CHECK-NEXT: jg .LBB19_2 ; CHECK-NEXT: # %bb.1: # %if.end +; CHECK-NEXT: cmpl $1, %edi ; CHECK-NEXT: movl $1, %eax -; CHECK-NEXT: cmovll %eax, %esi +; CHECK-NEXT: cmovlel %eax, %esi ; CHECK-NEXT: imull %edi, %esi ; CHECK-NEXT: .LBB19_2: # %return ; CHECK-NEXT: movslq %esi, %rax diff --git a/llvm/test/CodeGen/X86/vector-mulfix-legalize.ll b/llvm/test/CodeGen/X86/vector-mulfix-legalize.ll --- a/llvm/test/CodeGen/X86/vector-mulfix-legalize.ll +++ b/llvm/test/CodeGen/X86/vector-mulfix-legalize.ll @@ -50,12 +50,12 @@ ; CHECK-NEXT: shrl $16, %edx ; CHECK-NEXT: shldw $1, %cx, %dx ; CHECK-NEXT: sarl $16, %ecx -; CHECK-NEXT: cmpl $16383, %ecx # imm = 0x3FFF +; CHECK-NEXT: cmpl $16384, %ecx # imm = 0x4000 ; CHECK-NEXT: movl $32767, %r8d # imm = 0x7FFF -; CHECK-NEXT: cmovgl %r8d, %edx -; CHECK-NEXT: cmpl $-16384, %ecx # imm = 0xC000 +; CHECK-NEXT: cmovgel %r8d, %edx +; CHECK-NEXT: cmpl $-16385, %ecx # imm = 0xBFFF ; CHECK-NEXT: movl $32768, %ecx # imm = 0x8000 -; CHECK-NEXT: cmovll %ecx, %edx +; CHECK-NEXT: cmovlel %ecx, %edx ; CHECK-NEXT: pextrw $1, %xmm0, %esi ; CHECK-NEXT: movswl %si, %edi ; CHECK-NEXT: movl %edi, %eax @@ -63,20 +63,20 @@ ; CHECK-NEXT: leal (%rdi,%rdi), %esi ; CHECK-NEXT: shrdw $15, %ax, %si ; CHECK-NEXT: sarl $15, %edi -; CHECK-NEXT: cmpl $16383, %edi # imm = 0x3FFF -; CHECK-NEXT: cmovgl %r8d, %esi -; CHECK-NEXT: cmpl $-16384, %edi # imm = 0xC000 -; CHECK-NEXT: cmovll %ecx, %esi +; CHECK-NEXT: cmpl $16384, %edi # imm = 0x4000 +; CHECK-NEXT: cmovgel %r8d, %esi +; CHECK-NEXT: cmpl $-16385, %edi # imm = 0xBFFF +; CHECK-NEXT: cmovlel %ecx, %esi ; CHECK-NEXT: movd %xmm0, %eax ; CHECK-NEXT: cwtl ; CHECK-NEXT: movl %eax, %edi ; CHECK-NEXT: shrl $16, %edi ; CHECK-NEXT: shldw $1, %ax, %di ; CHECK-NEXT: sarl $16, %eax -; CHECK-NEXT: cmpl $16383, %eax # imm = 0x3FFF -; CHECK-NEXT: cmovgl %r8d, %edi -; CHECK-NEXT: cmpl $-16384, %eax # imm = 0xC000 -; CHECK-NEXT: cmovll %ecx, %edi +; CHECK-NEXT: cmpl $16384, %eax # imm = 0x4000 +; CHECK-NEXT: cmovgel %r8d, %edi +; CHECK-NEXT: cmpl $-16385, %eax # imm = 0xBFFF +; CHECK-NEXT: cmovlel %ecx, %edi ; CHECK-NEXT: movzwl %di, %eax ; CHECK-NEXT: movd %eax, %xmm1 ; CHECK-NEXT: pinsrw $1, %esi, %xmm1 @@ -88,10 +88,10 @@ ; CHECK-NEXT: leal (,%rax,4), %esi ; CHECK-NEXT: shrdw $15, %dx, %si ; CHECK-NEXT: sarl $14, %eax -; CHECK-NEXT: cmpl $16383, %eax # imm = 0x3FFF -; CHECK-NEXT: cmovgl %r8d, %esi -; CHECK-NEXT: cmpl $-16384, %eax # imm = 0xC000 -; CHECK-NEXT: cmovll %ecx, %esi +; CHECK-NEXT: cmpl $16384, %eax # imm = 0x4000 +; CHECK-NEXT: cmovgel %r8d, %esi +; CHECK-NEXT: cmpl $-16385, %eax # imm = 0xBFFF +; CHECK-NEXT: cmovlel %ecx, %esi ; CHECK-NEXT: pinsrw $3, %esi, %xmm1 ; CHECK-NEXT: movdqa %xmm1, %xmm0 ; CHECK-NEXT: retq @@ -109,23 +109,23 @@ ; CHECK-NEXT: shrl $16, %edx ; CHECK-NEXT: movl %edx, %ecx ; CHECK-NEXT: shldw $1, %ax, %cx -; CHECK-NEXT: cmpl $32767, %edx # imm = 0x7FFF +; CHECK-NEXT: cmpl $32768, %edx # imm = 0x8000 ; CHECK-NEXT: movl $65535, %eax # imm = 0xFFFF -; CHECK-NEXT: cmoval %eax, %ecx +; CHECK-NEXT: cmovael %eax, %ecx ; CHECK-NEXT: pextrw $1, %xmm0, %edx ; CHECK-NEXT: addl %edx, %edx ; CHECK-NEXT: movl %edx, %esi ; CHECK-NEXT: shrl $16, %esi ; CHECK-NEXT: movl %esi, %edi ; CHECK-NEXT: shldw $1, %dx, %di -; CHECK-NEXT: cmpl $32767, %esi # imm = 0x7FFF -; CHECK-NEXT: cmoval %eax, %edi +; CHECK-NEXT: cmpl $32768, %esi # imm = 0x8000 +; CHECK-NEXT: cmovael %eax, %edi ; CHECK-NEXT: movd %xmm0, %edx ; CHECK-NEXT: xorl %esi, %esi ; CHECK-NEXT: shldw $1, %dx, %si -; CHECK-NEXT: movl $32767, %edx # imm = 0x7FFF +; CHECK-NEXT: movl $32768, %edx # imm = 0x8000 ; CHECK-NEXT: negl %edx -; CHECK-NEXT: cmoval %eax, %esi +; CHECK-NEXT: cmovael %eax, %esi ; CHECK-NEXT: movzwl %si, %edx ; CHECK-NEXT: movd %edx, %xmm1 ; CHECK-NEXT: pinsrw $1, %edi, %xmm1 @@ -136,8 +136,8 @@ ; CHECK-NEXT: shrl $16, %edx ; CHECK-NEXT: movl %edx, %esi ; CHECK-NEXT: shldw $1, %cx, %si -; CHECK-NEXT: cmpl $32767, %edx # imm = 0x7FFF -; CHECK-NEXT: cmoval %eax, %esi +; CHECK-NEXT: cmpl $32768, %edx # imm = 0x8000 +; CHECK-NEXT: cmovael %eax, %esi ; CHECK-NEXT: pinsrw $3, %esi, %xmm1 ; CHECK-NEXT: movdqa %xmm1, %xmm0 ; CHECK-NEXT: retq diff --git a/llvm/test/CodeGen/X86/zext-sext.ll b/llvm/test/CodeGen/X86/zext-sext.ll --- a/llvm/test/CodeGen/X86/zext-sext.ll +++ b/llvm/test/CodeGen/X86/zext-sext.ll @@ -20,13 +20,13 @@ ; CHECK-NEXT: imull %edx, %eax ; CHECK-NEXT: xorl %edx, %edx ; CHECK-NEXT: addl $2138875574, %eax # imm = 0x7F7CA6B6 -; CHECK-NEXT: cmpl $-8608074, %eax # imm = 0xFF7CA6B6 +; CHECK-NEXT: cmpl $-8608075, %eax # imm = 0xFF7CA6B5 ; CHECK-NEXT: movslq %eax, %rdi -; CHECK-NEXT: setl %dl -; CHECK-NEXT: cmpl $2138875573, %eax # imm = 0x7F7CA6B5 +; CHECK-NEXT: setle %dl +; CHECK-NEXT: cmpl $2138875574, %eax # imm = 0x7F7CA6B6 ; CHECK-NEXT: movq %rdi, %r8 ; CHECK-NEXT: leal -1(%rdx,%rdx), %edx -; CHECK-NEXT: cmovlel %edx, %esi +; CHECK-NEXT: cmovll %edx, %esi ; CHECK-NEXT: subq %rax, %r8 ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: cmpl $1, %esi