Lines Matching refs:Div
407 bool llvm::expandDivision(BinaryOperator *Div) { in expandDivision() argument
408 assert((Div->getOpcode() == Instruction::SDiv || in expandDivision()
409 Div->getOpcode() == Instruction::UDiv) && in expandDivision()
412 IRBuilder<> Builder(Div); in expandDivision()
414 assert(!Div->getType()->isVectorTy() && "Div over vectors not supported"); in expandDivision()
417 if (Div->getOpcode() == Instruction::SDiv) { in expandDivision()
419 Value *Quotient = generateSignedDivisionCode(Div->getOperand(0), in expandDivision()
420 Div->getOperand(1), Builder); in expandDivision()
423 bool IsInsertPoint = Div->getIterator() == Builder.GetInsertPoint(); in expandDivision()
424 Div->replaceAllUsesWith(Quotient); in expandDivision()
425 Div->dropAllReferences(); in expandDivision()
426 Div->eraseFromParent(); in expandDivision()
435 Div = BO; in expandDivision()
439 Value *Quotient = generateUnsignedDivisionCode(Div->getOperand(0), in expandDivision()
440 Div->getOperand(1), in expandDivision()
442 Div->replaceAllUsesWith(Quotient); in expandDivision()
443 Div->dropAllReferences(); in expandDivision()
444 Div->eraseFromParent(); in expandDivision()
552 bool llvm::expandDivisionUpTo32Bits(BinaryOperator *Div) { in expandDivisionUpTo32Bits() argument
553 assert((Div->getOpcode() == Instruction::SDiv || in expandDivisionUpTo32Bits()
554 Div->getOpcode() == Instruction::UDiv) && in expandDivisionUpTo32Bits()
557 Type *DivTy = Div->getType(); in expandDivisionUpTo32Bits()
565 return expandDivision(Div); in expandDivisionUpTo32Bits()
569 IRBuilder<> Builder(Div); in expandDivisionUpTo32Bits()
577 if (Div->getOpcode() == Instruction::SDiv) { in expandDivisionUpTo32Bits()
578 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
579 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
582 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
583 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
588 Div->replaceAllUsesWith(Trunc); in expandDivisionUpTo32Bits()
589 Div->dropAllReferences(); in expandDivisionUpTo32Bits()
590 Div->eraseFromParent(); in expandDivisionUpTo32Bits()
600 bool llvm::expandDivisionUpTo64Bits(BinaryOperator *Div) { in expandDivisionUpTo64Bits() argument
601 assert((Div->getOpcode() == Instruction::SDiv || in expandDivisionUpTo64Bits()
602 Div->getOpcode() == Instruction::UDiv) && in expandDivisionUpTo64Bits()
605 Type *DivTy = Div->getType(); in expandDivisionUpTo64Bits()
611 return expandDivision(Div); in expandDivisionUpTo64Bits()
615 IRBuilder<> Builder(Div); in expandDivisionUpTo64Bits()
623 if (Div->getOpcode() == Instruction::SDiv) { in expandDivisionUpTo64Bits()
624 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
625 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
628 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
629 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
634 Div->replaceAllUsesWith(Trunc); in expandDivisionUpTo64Bits()
635 Div->dropAllReferences(); in expandDivisionUpTo64Bits()
636 Div->eraseFromParent(); in expandDivisionUpTo64Bits()