• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/llvm-project/llvm/lib/Transforms/Utils/

Lines Matching defs:Div

382   assert(!Rem->getType()->isVectorTy() && "Div over vectors not supported");
385 "Div of bitwidth other than 32 or 64 not supported");
426 /// Generate code to divide two integers, replacing Div with the generated
432 /// Replace Div with generated code.
433 bool llvm::expandDivision(BinaryOperator *Div) {
434 assert((Div->getOpcode() == Instruction::SDiv ||
435 Div->getOpcode() == Instruction::UDiv) &&
438 IRBuilder<> Builder(Div);
440 assert(!Div->getType()->isVectorTy() && "Div over vectors not supported");
441 assert((Div->getType()->getIntegerBitWidth() == 32 ||
442 Div->getType()->getIntegerBitWidth() == 64) &&
443 "Div of bitwidth other than 32 or 64 not supported");
446 if (Div->getOpcode() == Instruction::SDiv) {
447 // Lower the code to unsigned division, and reset Div to point to the udiv.
448 Value *Quotient = generateSignedDivisionCode(Div->getOperand(0),
449 Div->getOperand(1), Builder);
451 // Check whether this is the insert point while Div is still valid.
452 bool IsInsertPoint = Div->getIterator() == Builder.GetInsertPoint();
453 Div->replaceAllUsesWith(Quotient);
454 Div->dropAllReferences();
455 Div->eraseFromParent();
464 Div = BO;
468 Value *Quotient = generateUnsignedDivisionCode(Div->getOperand(0),
469 Div->getOperand(1),
471 Div->replaceAllUsesWith(Quotient);
472 Div->dropAllReferences();
473 Div->eraseFromParent();
491 assert(!RemTy->isVectorTy() && "Div over vectors not supported");
496 "Div of bitwidth greater than 32 not supported");
540 assert(!RemTy->isVectorTy() && "Div over vectors not supported");
544 assert(RemTyBitWidth <= 64 && "Div of bitwidth greater than 64 not supported");
582 /// Replace Div with emulation code.
583 bool llvm::expandDivisionUpTo32Bits(BinaryOperator *Div) {
584 assert((Div->getOpcode() == Instruction::SDiv ||
585 Div->getOpcode() == Instruction::UDiv) &&
588 Type *DivTy = Div->getType();
589 assert(!DivTy->isVectorTy() && "Div over vectors not supported");
593 assert(DivTyBitWidth <= 32 && "Div of bitwidth greater than 32 not supported");
596 return expandDivision(Div);
600 IRBuilder<> Builder(Div);
608 if (Div->getOpcode() == Instruction::SDiv) {
609 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int32Ty);
610 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int32Ty);
613 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int32Ty);
614 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int32Ty);
619 Div->replaceAllUsesWith(Trunc);
620 Div->dropAllReferences();
621 Div->eraseFromParent();
630 /// Replace Div with emulation code.
631 bool llvm::expandDivisionUpTo64Bits(BinaryOperator *Div) {
632 assert((Div->getOpcode() == Instruction::SDiv ||
633 Div->getOpcode() == Instruction::UDiv) &&
636 Type *DivTy = Div->getType();
637 assert(!DivTy->isVectorTy() && "Div over vectors not supported");
642 "Div of bitwidth greater than 64 not supported");
645 return expandDivision(Div);
649 IRBuilder<> Builder(Div);
657 if (Div->getOpcode() == Instruction::SDiv) {
658 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int64Ty);
659 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int64Ty);
662 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int64Ty);
663 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int64Ty);
668 Div->replaceAllUsesWith(Trunc);
669 Div->dropAllReferences();
670 Div->eraseFromParent();