Lines Matching refs:Div

432 bool llvm::expandDivision(BinaryOperator *Div) {  in expandDivision()  argument
433 assert((Div->getOpcode() == Instruction::SDiv || in expandDivision()
434 Div->getOpcode() == Instruction::UDiv) && in expandDivision()
437 IRBuilder<> Builder(Div); in expandDivision()
439 assert(!Div->getType()->isVectorTy() && "Div over vectors not supported"); in expandDivision()
440 assert((Div->getType()->getIntegerBitWidth() == 32 || in expandDivision()
441 Div->getType()->getIntegerBitWidth() == 64) && in expandDivision()
445 if (Div->getOpcode() == Instruction::SDiv) { in expandDivision()
447 Value *Quotient = generateSignedDivisionCode(Div->getOperand(0), in expandDivision()
448 Div->getOperand(1), Builder); in expandDivision()
451 bool IsInsertPoint = Div->getIterator() == Builder.GetInsertPoint(); in expandDivision()
452 Div->replaceAllUsesWith(Quotient); in expandDivision()
453 Div->dropAllReferences(); in expandDivision()
454 Div->eraseFromParent(); in expandDivision()
463 Div = BO; in expandDivision()
467 Value *Quotient = generateUnsignedDivisionCode(Div->getOperand(0), in expandDivision()
468 Div->getOperand(1), in expandDivision()
470 Div->replaceAllUsesWith(Quotient); in expandDivision()
471 Div->dropAllReferences(); in expandDivision()
472 Div->eraseFromParent(); in expandDivision()
582 bool llvm::expandDivisionUpTo32Bits(BinaryOperator *Div) { in expandDivisionUpTo32Bits() argument
583 assert((Div->getOpcode() == Instruction::SDiv || in expandDivisionUpTo32Bits()
584 Div->getOpcode() == Instruction::UDiv) && in expandDivisionUpTo32Bits()
587 Type *DivTy = Div->getType(); in expandDivisionUpTo32Bits()
595 return expandDivision(Div); in expandDivisionUpTo32Bits()
599 IRBuilder<> Builder(Div); in expandDivisionUpTo32Bits()
607 if (Div->getOpcode() == Instruction::SDiv) { in expandDivisionUpTo32Bits()
608 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
609 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
612 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
613 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
618 Div->replaceAllUsesWith(Trunc); in expandDivisionUpTo32Bits()
619 Div->dropAllReferences(); in expandDivisionUpTo32Bits()
620 Div->eraseFromParent(); in expandDivisionUpTo32Bits()
630 bool llvm::expandDivisionUpTo64Bits(BinaryOperator *Div) { in expandDivisionUpTo64Bits() argument
631 assert((Div->getOpcode() == Instruction::SDiv || in expandDivisionUpTo64Bits()
632 Div->getOpcode() == Instruction::UDiv) && in expandDivisionUpTo64Bits()
635 Type *DivTy = Div->getType(); in expandDivisionUpTo64Bits()
644 return expandDivision(Div); in expandDivisionUpTo64Bits()
648 IRBuilder<> Builder(Div); in expandDivisionUpTo64Bits()
656 if (Div->getOpcode() == Instruction::SDiv) { in expandDivisionUpTo64Bits()
657 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
658 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
661 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
662 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
667 Div->replaceAllUsesWith(Trunc); in expandDivisionUpTo64Bits()
668 Div->dropAllReferences(); in expandDivisionUpTo64Bits()
669 Div->eraseFromParent(); in expandDivisionUpTo64Bits()