mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
Implement mul.ll:test11
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11737 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -616,12 +616,13 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
|
|||||||
Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1);
|
Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1);
|
||||||
const Type *SCOpTy = SCIOp0->getType();
|
const Type *SCOpTy = SCIOp0->getType();
|
||||||
|
|
||||||
// If the source is X < 0, and X is a signed integer type, convert this
|
// If the source is X < 0 or X <= -1, and X is a signed integer type,
|
||||||
// multiply into a shift/and combination.
|
// convert this multiply into a shift/and combination.
|
||||||
if (SCI->getOpcode() == Instruction::SetLT &&
|
if (SCOpTy->isSigned() && isa<ConstantInt>(SCIOp1) &&
|
||||||
isa<Constant>(SCIOp1) && cast<Constant>(SCIOp1)->isNullValue() &&
|
((SCI->getOpcode() == Instruction::SetLT &&
|
||||||
SCOpTy->isInteger() && SCOpTy->isSigned()) {
|
cast<Constant>(SCIOp1)->isNullValue()) ||
|
||||||
|
(SCI->getOpcode() == Instruction::SetLE &&
|
||||||
|
cast<ConstantInt>(SCIOp1)->isAllOnesValue()))) {
|
||||||
// Shift the X value right to turn it into "all signbits".
|
// Shift the X value right to turn it into "all signbits".
|
||||||
Constant *Amt = ConstantUInt::get(Type::UByteTy,
|
Constant *Amt = ConstantUInt::get(Type::UByteTy,
|
||||||
SCOpTy->getPrimitiveSize()*8-1);
|
SCOpTy->getPrimitiveSize()*8-1);
|
||||||
|
Reference in New Issue
Block a user