mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Implement sub.ll:test17, -X/C -> X/-C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16863 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -946,6 +946,11 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) {
|
|||||||
return new ShiftInst(Instruction::Shr, I.getOperand(0),
|
return new ShiftInst(Instruction::Shr, I.getOperand(0),
|
||||||
ConstantUInt::get(Type::UByteTy, C));
|
ConstantUInt::get(Type::UByteTy, C));
|
||||||
|
|
||||||
|
// -X/C -> X/-C
|
||||||
|
if (RHS->getType()->isSigned())
|
||||||
|
if (Value *LHSNeg = dyn_castNegVal(I.getOperand(0)))
|
||||||
|
return BinaryOperator::createDiv(LHSNeg, ConstantExpr::getNeg(RHS));
|
||||||
|
|
||||||
if (isa<PHINode>(I.getOperand(0)) && !RHS->isNullValue())
|
if (isa<PHINode>(I.getOperand(0)) && !RHS->isNullValue())
|
||||||
if (Instruction *NV = FoldOpIntoPhi(I))
|
if (Instruction *NV = FoldOpIntoPhi(I))
|
||||||
return NV;
|
return NV;
|
||||||
|
Reference in New Issue
Block a user