From fed58fd72e1c02ea9e068fc5e9a1f1c7d1912bb8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 23 Feb 2004 06:00:11 +0000 Subject: [PATCH] Implement mul.ll:test11 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11737 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index f23c10fcbd8..a5fcbc92b91 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -616,12 +616,13 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1); const Type *SCOpTy = SCIOp0->getType(); - // If the source is X < 0, and X is a signed integer type, convert this - // multiply into a shift/and combination. - if (SCI->getOpcode() == Instruction::SetLT && - isa(SCIOp1) && cast(SCIOp1)->isNullValue() && - SCOpTy->isInteger() && SCOpTy->isSigned()) { - + // If the source is X < 0 or X <= -1, and X is a signed integer type, + // convert this multiply into a shift/and combination. + if (SCOpTy->isSigned() && isa(SCIOp1) && + ((SCI->getOpcode() == Instruction::SetLT && + cast(SCIOp1)->isNullValue()) || + (SCI->getOpcode() == Instruction::SetLE && + cast(SCIOp1)->isAllOnesValue()))) { // Shift the X value right to turn it into "all signbits". Constant *Amt = ConstantUInt::get(Type::UByteTy, SCOpTy->getPrimitiveSize()*8-1); -- 2.34.1