Lines Matching refs:Ops
392 Value *EmitMul(const BinOpInfo &Ops) { in EmitMul() argument
393 if (Ops.Ty->isSignedIntegerOrEnumerationType()) { in EmitMul()
396 return Builder.CreateNSWMul(Ops.LHS, Ops.RHS, "mul"); in EmitMul()
398 return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul"); in EmitMul()
400 return EmitOverflowCheckedBinOp(Ops); in EmitMul()
404 if (Ops.LHS->getType()->isFPOrFPVectorTy()) in EmitMul()
405 return Builder.CreateFMul(Ops.LHS, Ops.RHS, "mul"); in EmitMul()
406 return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul"); in EmitMul()
414 Value *EmitOverflowCheckedBinOp(const BinOpInfo &Ops);
423 void EmitUndefinedBehaviorIntegerDivAndRemCheck(const BinOpInfo &Ops,
425 Value *EmitDiv(const BinOpInfo &Ops);
426 Value *EmitRem(const BinOpInfo &Ops);
427 Value *EmitAdd(const BinOpInfo &Ops);
428 Value *EmitSub(const BinOpInfo &Ops);
429 Value *EmitShl(const BinOpInfo &Ops);
430 Value *EmitShr(const BinOpInfo &Ops);
431 Value *EmitAnd(const BinOpInfo &Ops) { in EmitAnd() argument
432 return Builder.CreateAnd(Ops.LHS, Ops.RHS, "and"); in EmitAnd()
434 Value *EmitXor(const BinOpInfo &Ops) { in EmitXor() argument
435 return Builder.CreateXor(Ops.LHS, Ops.RHS, "xor"); in EmitXor()
437 Value *EmitOr (const BinOpInfo &Ops) { in EmitOr() argument
438 return Builder.CreateOr(Ops.LHS, Ops.RHS, "or"); in EmitOr()
1755 const BinOpInfo &Ops, in EmitUndefinedBehaviorIntegerDivAndRemCheck() argument
1765 if (Ops.Ty->hasSignedIntegerRepresentation()) { in EmitUndefinedBehaviorIntegerDivAndRemCheck()
1770 llvm::Value *Cond1 = Builder.CreateICmpEQ(Ops.RHS, Zero); in EmitUndefinedBehaviorIntegerDivAndRemCheck()
1771 llvm::Value *LHSCmp = Builder.CreateICmpEQ(Ops.LHS, IntMin); in EmitUndefinedBehaviorIntegerDivAndRemCheck()
1772 llvm::Value *RHSCmp = Builder.CreateICmpEQ(Ops.RHS, NegOne); in EmitUndefinedBehaviorIntegerDivAndRemCheck()
1777 CGF.Builder.CreateCondBr(Builder.CreateICmpEQ(Ops.RHS, Zero), in EmitUndefinedBehaviorIntegerDivAndRemCheck()
1784 Value *ScalarExprEmitter::EmitDiv(const BinOpInfo &Ops) { in EmitDiv() argument
1786 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty)); in EmitDiv()
1788 if (Ops.Ty->isIntegerType()) in EmitDiv()
1789 EmitUndefinedBehaviorIntegerDivAndRemCheck(Ops, Zero, true); in EmitDiv()
1790 else if (Ops.Ty->isRealFloatingType()) { in EmitDiv()
1796 CGF.Builder.CreateCondBr(Builder.CreateFCmpOEQ(Ops.RHS, Zero), in EmitDiv()
1802 if (Ops.LHS->getType()->isFPOrFPVectorTy()) { in EmitDiv()
1803 llvm::Value *Val = Builder.CreateFDiv(Ops.LHS, Ops.RHS, "div"); in EmitDiv()
1814 else if (Ops.Ty->hasUnsignedIntegerRepresentation()) in EmitDiv()
1815 return Builder.CreateUDiv(Ops.LHS, Ops.RHS, "div"); in EmitDiv()
1817 return Builder.CreateSDiv(Ops.LHS, Ops.RHS, "div"); in EmitDiv()
1820 Value *ScalarExprEmitter::EmitRem(const BinOpInfo &Ops) { in EmitRem() argument
1823 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty)); in EmitRem()
1825 if (Ops.Ty->isIntegerType()) in EmitRem()
1826 EmitUndefinedBehaviorIntegerDivAndRemCheck(Ops, Zero, false); in EmitRem()
1829 if (Ops.Ty->hasUnsignedIntegerRepresentation()) in EmitRem()
1830 return Builder.CreateURem(Ops.LHS, Ops.RHS, "rem"); in EmitRem()
1832 return Builder.CreateSRem(Ops.LHS, Ops.RHS, "rem"); in EmitRem()
1835 Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) { in EmitOverflowCheckedBinOp() argument
1839 switch (Ops.Opcode) { in EmitOverflowCheckedBinOp()
1861 llvm::Type *opTy = CGF.CGM.getTypes().ConvertType(Ops.Ty); in EmitOverflowCheckedBinOp()
1865 Value *resultAndOverflow = Builder.CreateCall2(intrinsic, Ops.LHS, Ops.RHS); in EmitOverflowCheckedBinOp()
1900 llvm::Value *lhs = Builder.CreateSExt(Ops.LHS, CGF.Int64Ty); in EmitOverflowCheckedBinOp()
1901 llvm::Value *rhs = Builder.CreateSExt(Ops.RHS, CGF.Int64Ty); in EmitOverflowCheckedBinOp()
2104 Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) { in EmitShl() argument
2107 Value *RHS = Ops.RHS; in EmitShl()
2108 if (Ops.LHS->getType() != RHS->getType()) in EmitShl()
2109 RHS = Builder.CreateIntCast(RHS, Ops.LHS->getType(), false, "sh_prom"); in EmitShl()
2112 && isa<llvm::IntegerType>(Ops.LHS->getType())) { in EmitShl()
2113 unsigned Width = cast<llvm::IntegerType>(Ops.LHS->getType())->getBitWidth(); in EmitShl()
2121 return Builder.CreateShl(Ops.LHS, RHS, "shl"); in EmitShl()
2124 Value *ScalarExprEmitter::EmitShr(const BinOpInfo &Ops) { in EmitShr() argument
2127 Value *RHS = Ops.RHS; in EmitShr()
2128 if (Ops.LHS->getType() != RHS->getType()) in EmitShr()
2129 RHS = Builder.CreateIntCast(RHS, Ops.LHS->getType(), false, "sh_prom"); in EmitShr()
2132 && isa<llvm::IntegerType>(Ops.LHS->getType())) { in EmitShr()
2133 unsigned Width = cast<llvm::IntegerType>(Ops.LHS->getType())->getBitWidth(); in EmitShr()
2141 if (Ops.Ty->hasUnsignedIntegerRepresentation()) in EmitShr()
2142 return Builder.CreateLShr(Ops.LHS, RHS, "shr"); in EmitShr()
2143 return Builder.CreateAShr(Ops.LHS, RHS, "shr"); in EmitShr()