Lines Matching refs:FPOp

78   bool fold_pow(FPMathOperator *FPOp, IRBuilder<> &B, const FuncInfo &FInfo);
81 bool fold_rootn(FPMathOperator *FPOp, IRBuilder<> &B, const FuncInfo &FInfo);
99 bool fold_sincos(FPMathOperator *FPOp, IRBuilder<> &B, const FuncInfo &FInfo);
124 bool isUnsafeMath(const FPMathOperator *FPOp) const;
125 bool isUnsafeFiniteOnlyMath(const FPMathOperator *FPOp) const;
127 bool canIncreasePrecisionOfConstantFold(const FPMathOperator *FPOp) const;
422 bool AMDGPULibCalls::isUnsafeMath(const FPMathOperator *FPOp) const { in isUnsafeMath()
423 return UnsafeFPMath || FPOp->isFast(); in isUnsafeMath()
426 bool AMDGPULibCalls::isUnsafeFiniteOnlyMath(const FPMathOperator *FPOp) const { in isUnsafeFiniteOnlyMath()
428 (FPOp->hasApproxFunc() && FPOp->hasNoNaNs() && FPOp->hasNoInfs()); in isUnsafeFiniteOnlyMath()
432 const FPMathOperator *FPOp) const { in canIncreasePrecisionOfConstantFold()
434 return isUnsafeMath(FPOp); in canIncreasePrecisionOfConstantFold()
672 if (FPMathOperator *FPOp = dyn_cast<FPMathOperator>(CI)) { in fold() local
676 if (canIncreasePrecisionOfConstantFold(FPOp) && evaluateCall(CI, FInfo)) in fold()
680 FastMathFlags FMF = FPOp->getFastMathFlags(); in fold()
765 CallInst *Call = cast<CallInst>(FPOp); in fold()
771 FPOp->getOperand(0), /*Depth=*/0, in fold()
774 return fold_pow(FPOp, B, PowrInfo) || true; in fold()
778 if (isKnownIntegral(FPOp->getOperand(1), M->getDataLayout(), in fold()
779 FPOp->getFastMathFlags())) { in fold()
788 B.CreateFPToSI(FPOp->getOperand(1), PownType->getParamType(1)); in fold()
794 return fold_pow(FPOp, B, PownInfo) || true; in fold()
798 return fold_pow(FPOp, B, FInfo); in fold()
802 return fold_pow(FPOp, B, FInfo); in fold()
804 return fold_rootn(FPOp, B, FInfo); in fold()
811 return fold_sincos(FPOp, B, FInfo); in fold()
903 bool AMDGPULibCalls::fold_pow(FPMathOperator *FPOp, IRBuilder<> &B, in fold_pow() argument
911 Type *eltType = FPOp->getType()->getScalarType(); in fold_pow()
912 Value *opr0 = FPOp->getOperand(0); in fold_pow()
913 Value *opr1 = FPOp->getOperand(1); in fold_pow()
925 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> 1\n"); in fold_pow()
930 replaceCall(FPOp, cnval); in fold_pow()
935 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> " << *opr0 << "\n"); in fold_pow()
936 replaceCall(FPOp, opr0); in fold_pow()
941 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> " << *opr0 << " * " in fold_pow()
944 replaceCall(FPOp, nval); in fold_pow()
949 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> 1 / " << *opr0 << "\n"); in fold_pow()
955 replaceCall(FPOp, nval); in fold_pow()
966 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> " << FInfo.getName() in fold_pow()
970 replaceCall(FPOp, nval); in fold_pow()
975 if (!isUnsafeFiniteOnlyMath(FPOp)) in fold_pow()
1023 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> " in fold_pow()
1026 replaceCall(FPOp, nval); in fold_pow()
1037 ExpExpr = Intrinsic::getDeclaration(M, Intrinsic::exp2, {FPOp->getType()}); in fold_pow()
1098 if (!isKnownIntegral(opr1, M->getDataLayout(), FPOp->getFastMathFlags())) in fold_pow()
1112 Intrinsic::getDeclaration(M, Intrinsic::log2, {FPOp->getType()}); in fold_pow()
1131 Type *nTy = FPOp->getType()->getWithNewType(nTyS); in fold_pow()
1133 Value *opr_n = FPOp->getOperand(1); in fold_pow()
1145 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> " in fold_pow()
1147 replaceCall(FPOp, nval); in fold_pow()
1152 bool AMDGPULibCalls::fold_rootn(FPMathOperator *FPOp, IRBuilder<> &B, in fold_rootn() argument
1154 Value *opr0 = FPOp->getOperand(0); in fold_rootn()
1155 Value *opr1 = FPOp->getOperand(1); in fold_rootn()
1168 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> " << *opr0 << '\n'); in fold_rootn()
1169 replaceCall(FPOp, opr0); in fold_rootn()
1175 CallInst *CI = cast<CallInst>(FPOp); in fold_rootn()
1181 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> sqrt(" << *opr0 << ")\n"); in fold_rootn()
1189 MDNode *FPMD = MDHelper.createFPMath(std::max(FPOp->getFPAccuracy(), 2.0f)); in fold_rootn()
1199 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> cbrt(" << *opr0 in fold_rootn()
1202 replaceCall(FPOp, nval); in fold_rootn()
1206 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> 1.0 / " << *opr0 << "\n"); in fold_rootn()
1210 replaceCall(FPOp, nval); in fold_rootn()
1223 MDNode *FPMD = MDHelper.createFPMath(std::max(FPOp->getFPAccuracy(), 2.0f)); in fold_rootn()
1226 FastMathFlags FMF = FPOp->getFastMathFlags(); in fold_rootn()
1236 LLVM_DEBUG(errs() << "AMDIC: " << *FPOp << " ---> rsqrt(" << *opr0 in fold_rootn()
1352 bool AMDGPULibCalls::fold_sincos(FPMathOperator *FPOp, IRBuilder<> &B, in fold_sincos() argument
1364 Value *CArgVal = FPOp->getOperand(0); in fold_sincos()
1365 CallInst *CI = cast<CallInst>(FPOp); in fold_sincos()
1399 FastMathFlags FMF = FPOp->getFastMathFlags(); in fold_sincos()