Lines Matching refs:Div
433 bool llvm::expandDivision(BinaryOperator *Div) { in expandDivision() argument
434 assert((Div->getOpcode() == Instruction::SDiv || in expandDivision()
435 Div->getOpcode() == Instruction::UDiv) && in expandDivision()
438 IRBuilder<> Builder(Div); in expandDivision()
440 assert(!Div->getType()->isVectorTy() && "Div over vectors not supported"); in expandDivision()
441 assert((Div->getType()->getIntegerBitWidth() == 32 || in expandDivision()
442 Div->getType()->getIntegerBitWidth() == 64) && in expandDivision()
446 if (Div->getOpcode() == Instruction::SDiv) { in expandDivision()
448 Value *Quotient = generateSignedDivisionCode(Div->getOperand(0), in expandDivision()
449 Div->getOperand(1), Builder); in expandDivision()
452 bool IsInsertPoint = Div->getIterator() == Builder.GetInsertPoint(); in expandDivision()
453 Div->replaceAllUsesWith(Quotient); in expandDivision()
454 Div->dropAllReferences(); in expandDivision()
455 Div->eraseFromParent(); in expandDivision()
464 Div = BO; in expandDivision()
468 Value *Quotient = generateUnsignedDivisionCode(Div->getOperand(0), in expandDivision()
469 Div->getOperand(1), in expandDivision()
471 Div->replaceAllUsesWith(Quotient); in expandDivision()
472 Div->dropAllReferences(); in expandDivision()
473 Div->eraseFromParent(); in expandDivision()
583 bool llvm::expandDivisionUpTo32Bits(BinaryOperator *Div) { in expandDivisionUpTo32Bits() argument
584 assert((Div->getOpcode() == Instruction::SDiv || in expandDivisionUpTo32Bits()
585 Div->getOpcode() == Instruction::UDiv) && in expandDivisionUpTo32Bits()
588 Type *DivTy = Div->getType(); in expandDivisionUpTo32Bits()
596 return expandDivision(Div); in expandDivisionUpTo32Bits()
600 IRBuilder<> Builder(Div); in expandDivisionUpTo32Bits()
608 if (Div->getOpcode() == Instruction::SDiv) { in expandDivisionUpTo32Bits()
609 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
610 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
613 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
614 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
619 Div->replaceAllUsesWith(Trunc); in expandDivisionUpTo32Bits()
620 Div->dropAllReferences(); in expandDivisionUpTo32Bits()
621 Div->eraseFromParent(); in expandDivisionUpTo32Bits()
631 bool llvm::expandDivisionUpTo64Bits(BinaryOperator *Div) { in expandDivisionUpTo64Bits() argument
632 assert((Div->getOpcode() == Instruction::SDiv || in expandDivisionUpTo64Bits()
633 Div->getOpcode() == Instruction::UDiv) && in expandDivisionUpTo64Bits()
636 Type *DivTy = Div->getType(); in expandDivisionUpTo64Bits()
645 return expandDivision(Div); in expandDivisionUpTo64Bits()
649 IRBuilder<> Builder(Div); in expandDivisionUpTo64Bits()
657 if (Div->getOpcode() == Instruction::SDiv) { in expandDivisionUpTo64Bits()
658 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
659 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
662 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
663 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
668 Div->replaceAllUsesWith(Trunc); in expandDivisionUpTo64Bits()
669 Div->dropAllReferences(); in expandDivisionUpTo64Bits()
670 Div->eraseFromParent(); in expandDivisionUpTo64Bits()