Lines Matching defs:Pow
2047 Value *LibCallSimplifier::replacePowWithExp(CallInst *Pow, IRBuilderBase &B) {
2048 Module *M = Pow->getModule();
2049 Value *Base = Pow->getArgOperand(0), *Expo = Pow->getArgOperand(1);
2050 Type *Ty = Pow->getType();
2069 if (BaseFn && BaseFn->hasOneUse() && BaseFn->isFast() && Pow->isFast()) {
2128 const bool UseIntrinsic = Pow->doesNotAccessMemory();
2142 return copyFlags(*Pow, B.CreateIntrinsic(Intrinsic::ldexp,
2144 {One, ExpoI}, Pow, "exp2"));
2147 return copyFlags(*Pow, emitBinaryFloatFnCall(
2167 if (Pow->doesNotAccessMemory())
2168 return copyFlags(*Pow, B.CreateUnaryIntrinsic(Intrinsic::exp2, FMul,
2171 return copyFlags(*Pow, emitUnaryFloatFnCall(FMul, TLI, LibFunc_exp2,
2181 if (Pow->doesNotAccessMemory()) {
2183 B.CreateIntrinsic(Intrinsic::exp10, {Ty}, {Expo}, Pow, "exp10");
2184 return copyFlags(*Pow, NewExp10);
2187 return copyFlags(*Pow, emitUnaryFloatFnCall(Expo, TLI, LibFunc_exp10,
2193 if (Pow->hasApproxFunc() && Pow->hasNoNaNs() && BaseF->isFiniteNonZero() &&
2208 if (Pow->doesNotAccessMemory())
2209 return copyFlags(*Pow, B.CreateUnaryIntrinsic(Intrinsic::exp2, FMul,
2213 return copyFlags(*Pow, emitUnaryFloatFnCall(FMul, TLI, LibFunc_exp2,
2242 Value *LibCallSimplifier::replacePowWithSqrt(CallInst *Pow, IRBuilderBase &B) {
2243 Value *Sqrt, *Base = Pow->getArgOperand(0), *Expo = Pow->getArgOperand(1);
2244 Module *Mod = Pow->getModule();
2245 Type *Ty = Pow->getType();
2254 if (ExpoF->isNegative() && (!Pow->hasApproxFunc() && !Pow->hasAllowReassoc()))
2261 if (!Pow->doesNotAccessMemory() && !Pow->hasNoInfs() &&
2263 Base, 0, SimplifyQuery(DL, TLI, DT, AC, Pow, true, true, DC)))
2266 Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), Mod, B,
2272 if (!Pow->hasNoSignedZeros())
2275 Sqrt = copyFlags(*Pow, Sqrt);
2279 if (!Pow->hasNoInfs()) {
2300 Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilderBase &B) {
2301 Value *Base = Pow->getArgOperand(0);
2302 Value *Expo = Pow->getArgOperand(1);
2303 Function *Callee = Pow->getCalledFunction();
2305 Type *Ty = Pow->getType();
2306 Module *M = Pow->getModule();
2307 bool AllowApprox = Pow->hasApproxFunc();
2312 B.setFastMathFlags(Pow->getFastMathFlags());
2319 if (Value *Exp = replacePowWithExp(Pow, B))
2340 if (Value *Sqrt = replacePowWithSqrt(Pow, B))
2370 Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), M,
2383 *Pow,
2398 return copyFlags(*Pow, createPowWithIntegerExponent(Base, ExpoI, M, B));
2405 if (Value *Shrunk = optimizeBinaryDoubleFP(Pow, B, TLI, true))