Lines Matching defs:Pow
2038 Value *LibCallSimplifier::replacePowWithExp(CallInst *Pow, IRBuilderBase &B) {
2039 Module *M = Pow->getModule();
2040 Value *Base = Pow->getArgOperand(0), *Expo = Pow->getArgOperand(1);
2041 Type *Ty = Pow->getType();
2060 if (BaseFn && BaseFn->hasOneUse() && BaseFn->isFast() && Pow->isFast()) {
2119 const bool UseIntrinsic = Pow->doesNotAccessMemory();
2133 return copyFlags(*Pow, B.CreateIntrinsic(Intrinsic::ldexp,
2135 {One, ExpoI}, Pow, "exp2"));
2138 return copyFlags(*Pow, emitBinaryFloatFnCall(
2158 if (Pow->doesNotAccessMemory())
2159 return copyFlags(*Pow, B.CreateUnaryIntrinsic(Intrinsic::exp2, FMul,
2162 return copyFlags(*Pow, emitUnaryFloatFnCall(FMul, TLI, LibFunc_exp2,
2172 if (Pow->doesNotAccessMemory()) {
2174 B.CreateIntrinsic(Intrinsic::exp10, {Ty}, {Expo}, Pow, "exp10");
2175 return copyFlags(*Pow, NewExp10);
2178 return copyFlags(*Pow, emitUnaryFloatFnCall(Expo, TLI, LibFunc_exp10,
2184 if (Pow->hasApproxFunc() && Pow->hasNoNaNs() && BaseF->isFiniteNonZero() &&
2199 if (Pow->doesNotAccessMemory())
2200 return copyFlags(*Pow, B.CreateUnaryIntrinsic(Intrinsic::exp2, FMul,
2204 return copyFlags(*Pow, emitUnaryFloatFnCall(FMul, TLI, LibFunc_exp2,
2233 Value *LibCallSimplifier::replacePowWithSqrt(CallInst *Pow, IRBuilderBase &B) {
2234 Value *Sqrt, *Base = Pow->getArgOperand(0), *Expo = Pow->getArgOperand(1);
2235 Module *Mod = Pow->getModule();
2236 Type *Ty = Pow->getType();
2245 if (ExpoF->isNegative() && (!Pow->hasApproxFunc() && !Pow->hasAllowReassoc()))
2252 if (!Pow->doesNotAccessMemory() && !Pow->hasNoInfs() &&
2254 SimplifyQuery(DL, TLI, /*DT=*/nullptr, AC, Pow)))
2257 Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), Mod, B,
2263 if (!Pow->hasNoSignedZeros())
2266 Sqrt = copyFlags(*Pow, Sqrt);
2270 if (!Pow->hasNoInfs()) {
2291 Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilderBase &B) {
2292 Value *Base = Pow->getArgOperand(0);
2293 Value *Expo = Pow->getArgOperand(1);
2294 Function *Callee = Pow->getCalledFunction();
2296 Type *Ty = Pow->getType();
2297 Module *M = Pow->getModule();
2298 bool AllowApprox = Pow->hasApproxFunc();
2303 B.setFastMathFlags(Pow->getFastMathFlags());
2310 if (Value *Exp = replacePowWithExp(Pow, B))
2331 if (Value *Sqrt = replacePowWithSqrt(Pow, B))
2361 Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), M,
2374 *Pow,
2389 return copyFlags(*Pow, createPowWithIntegerExponent(Base, ExpoI, M, B));
2396 if (Value *Shrunk = optimizeBinaryDoubleFP(Pow, B, TLI, true))