Lines Matching refs:Ops

739   Value *EmitMul(const BinOpInfo &Ops) {
740 if (Ops.Ty->isSignedIntegerOrEnumerationType()) {
744 return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul");
748 return Builder.CreateNSWMul(Ops.LHS, Ops.RHS, "mul");
751 if (CanElideOverflowCheck(CGF.getContext(), Ops))
752 return Builder.CreateNSWMul(Ops.LHS, Ops.RHS, "mul");
753 return EmitOverflowCheckedBinOp(Ops);
757 if (Ops.Ty->isConstantMatrixType()) {
761 auto *BO = cast<BinaryOperator>(Ops.E);
766 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, Ops.FPFeatures);
768 return MB.CreateMatrixMultiply(Ops.LHS, Ops.RHS, LHSMatTy->getNumRows(),
771 return MB.CreateScalarMultiply(Ops.LHS, Ops.RHS);
774 if (Ops.Ty->isUnsignedIntegerType() &&
776 !CanElideOverflowCheck(CGF.getContext(), Ops))
777 return EmitOverflowCheckedBinOp(Ops);
779 if (Ops.LHS->getType()->isFPOrFPVectorTy()) {
781 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, Ops.FPFeatures);
782 return Builder.CreateFMul(Ops.LHS, Ops.RHS, "mul");
784 if (Ops.isFixedPointOp())
785 return EmitFixedPointBinOp(Ops);
786 return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul");
790 Value *EmitOverflowCheckedBinOp(const BinOpInfo &Ops);
793 void EmitUndefinedBehaviorIntegerDivAndRemCheck(const BinOpInfo &Ops,
802 Value *EmitDiv(const BinOpInfo &Ops);
803 Value *EmitRem(const BinOpInfo &Ops);
804 Value *EmitAdd(const BinOpInfo &Ops);
805 Value *EmitSub(const BinOpInfo &Ops);
806 Value *EmitShl(const BinOpInfo &Ops);
807 Value *EmitShr(const BinOpInfo &Ops);
808 Value *EmitAnd(const BinOpInfo &Ops) {
809 return Builder.CreateAnd(Ops.LHS, Ops.RHS, "and");
811 Value *EmitXor(const BinOpInfo &Ops) {
812 return Builder.CreateXor(Ops.LHS, Ops.RHS, "xor");
814 Value *EmitOr (const BinOpInfo &Ops) {
815 return Builder.CreateOr(Ops.LHS, Ops.RHS, "or");
819 Value *EmitFixedPointBinOp(const BinOpInfo &Ops);
3695 const BinOpInfo &Ops, llvm::Value *Zero, bool isDiv) {
3699 Checks.push_back(std::make_pair(Builder.CreateICmpNE(Ops.RHS, Zero),
3703 const auto *BO = cast<BinaryOperator>(Ops.E);
3705 Ops.Ty->hasSignedIntegerRepresentation() &&
3707 Ops.mayHaveIntegerOverflow()) {
3714 llvm::Value *LHSCmp = Builder.CreateICmpNE(Ops.LHS, IntMin);
3715 llvm::Value *RHSCmp = Builder.CreateICmpNE(Ops.RHS, NegOne);
3722 EmitBinOpCheck(Checks, Ops);
3725 Value *ScalarExprEmitter::EmitDiv(const BinOpInfo &Ops) {
3730 Ops.Ty->isIntegerType() &&
3731 (Ops.mayHaveIntegerDivisionByZero() || Ops.mayHaveIntegerOverflow())) {
3732 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty));
3733 EmitUndefinedBehaviorIntegerDivAndRemCheck(Ops, Zero, true);
3735 Ops.Ty->isRealFloatingType() &&
3736 Ops.mayHaveFloatDivisionByZero()) {
3737 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty));
3738 llvm::Value *NonZero = Builder.CreateFCmpUNE(Ops.RHS, Zero);
3740 Ops);
3744 if (Ops.Ty->isConstantMatrixType()) {
3748 auto *BO = cast<BinaryOperator>(Ops.E);
3755 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, Ops.FPFeatures);
3756 return MB.CreateScalarDiv(Ops.LHS, Ops.RHS,
3757 Ops.Ty->hasUnsignedIntegerRepresentation());
3760 if (Ops.LHS->getType()->isFPOrFPVectorTy()) {
3762 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, Ops.FPFeatures);
3763 Val = Builder.CreateFDiv(Ops.LHS, Ops.RHS, "div");
3767 else if (Ops.isFixedPointOp())
3768 return EmitFixedPointBinOp(Ops);
3769 else if (Ops.Ty->hasUnsignedIntegerRepresentation())
3770 return Builder.CreateUDiv(Ops.LHS, Ops.RHS, "div");
3772 return Builder.CreateSDiv(Ops.LHS, Ops.RHS, "div");
3775 Value *ScalarExprEmitter::EmitRem(const BinOpInfo &Ops) {
3779 Ops.Ty->isIntegerType() &&
3780 (Ops.mayHaveIntegerDivisionByZero() || Ops.mayHaveIntegerOverflow())) {
3782 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty));
3783 EmitUndefinedBehaviorIntegerDivAndRemCheck(Ops, Zero, false);
3786 if (Ops.Ty->hasUnsignedIntegerRepresentation())
3787 return Builder.CreateURem(Ops.LHS, Ops.RHS, "rem");
3789 return Builder.CreateSRem(Ops.LHS, Ops.RHS, "rem");
3792 Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
3797 bool isSigned = Ops.Ty->isSignedIntegerOrEnumerationType();
3798 switch (Ops.Opcode) {
3828 llvm::Type *opTy = CGF.CGM.getTypes().ConvertType(Ops.Ty);
3832 Value *resultAndOverflow = Builder.CreateCall(intrinsic, {Ops.LHS, Ops.RHS});
3846 EmitBinOpCheck(std::make_pair(NotOverflow, Kind), Ops);
3874 llvm::Value *lhs = Builder.CreateSExt(Ops.LHS, CGF.Int64Ty);
3875 llvm::Value *rhs = Builder.CreateSExt(Ops.RHS, CGF.Int64Ty);
4440 Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) {
4442 if (Ops.isFixedPointOp())
4443 return EmitFixedPointBinOp(Ops);
4447 Value *RHS = Ops.RHS;
4448 if (Ops.LHS->getType() != RHS->getType())
4449 RHS = Builder.CreateIntCast(RHS, Ops.LHS->getType(), false, "sh_prom");
4452 Ops.Ty->hasSignedIntegerRepresentation() &&
4457 Ops.Ty->hasUnsignedIntegerRepresentation();
4462 RHS = ConstrainShiftValue(Ops.LHS, RHS, "shl.mask");
4464 isa<llvm::IntegerType>(Ops.LHS->getType())) {
4467 bool RHSIsSigned = Ops.rhsHasSignedIntegerRepresentation();
4469 GetMaximumShiftAmount(Ops.LHS, Ops.RHS, RHSIsSigned);
4470 llvm::Value *ValidExponent = Builder.CreateICmpULE(Ops.RHS, WidthMinusOne);
4486 (RHS == Ops.RHS) ? WidthMinusOne
4487 : GetMaximumShiftAmount(Ops.LHS, RHS, RHSIsSigned);
4490 Ops.LHS, Builder.CreateSub(PromotedWidthMinusOne, RHS, "shl.zeros",
4514 EmitBinOpCheck(Checks, Ops);
4517 return Builder.CreateShl(Ops.LHS, RHS, "shl");
4520 Value *ScalarExprEmitter::EmitShr(const BinOpInfo &Ops) {
4522 if (Ops.isFixedPointOp())
4523 return EmitFixedPointBinOp(Ops);
4527 Value *RHS = Ops.RHS;
4528 if (Ops.LHS->getType() != RHS->getType())
4529 RHS = Builder.CreateIntCast(RHS, Ops.LHS->getType(), false, "sh_prom");
4533 RHS = ConstrainShiftValue(Ops.LHS, RHS, "shr.mask");
4535 isa<llvm::IntegerType>(Ops.LHS->getType())) {
4537 bool RHSIsSigned = Ops.rhsHasSignedIntegerRepresentation();
4539 Ops.RHS, GetMaximumShiftAmount(Ops.LHS, Ops.RHS, RHSIsSigned));
4540 EmitBinOpCheck(std::make_pair(Valid, SanitizerKind::ShiftExponent), Ops);
4543 if (Ops.Ty->hasUnsignedIntegerRepresentation())
4544 return Builder.CreateLShr(Ops.LHS, RHS, "shr");
4545 return Builder.CreateAShr(Ops.LHS, RHS, "shr");