mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +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:
parent
23e2563226
commit
a052f8297a
@ -946,6 +946,11 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) {
|
||||
return new ShiftInst(Instruction::Shr, I.getOperand(0),
|
||||
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 (Instruction *NV = FoldOpIntoPhi(I))
|
||||
return NV;
|
||||
|
Loading…
Reference in New Issue
Block a user