llvm.org GIT mirror llvm / bd8623a
function names start with a lower case letter ; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257496 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 3 years ago
7 changed file(s) with 24 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
177177 void clearFastMathFlags() { FMF.clear(); }
178178
179179 /// \brief Set the floating point math metadata to be used.
180 void SetDefaultFPMathTag(MDNode *FPMathTag) { DefaultFPMathTag = FPMathTag; }
180 void setDefaultFPMathTag(MDNode *FPMathTag) { DefaultFPMathTag = FPMathTag; }
181181
182182 /// \brief Set the fast-math flags to be used with generated fp-math operators
183 void SetFastMathFlags(FastMathFlags NewFMF) { FMF = NewFMF; }
183 void setFastMathFlags(FastMathFlags NewFMF) { FMF = NewFMF; }
184184
185185 //===--------------------------------------------------------------------===//
186186 // RAII helpers.
635635 // if pattern detected emit alternate sequence
636636 if (OpX && OpY) {
637637 BuilderTy::FastMathFlagGuard Guard(*Builder);
638 Builder->SetFastMathFlags(Log2->getFastMathFlags());
638 Builder->setFastMathFlags(Log2->getFastMathFlags());
639639 Log2->setArgOperand(0, OpY);
640640 Value *FMulVal = Builder->CreateFMul(OpX, Log2);
641641 Value *FSub = Builder->CreateFSub(FMulVal, OpX);
651651 bool IgnoreZeroSign = I.hasNoSignedZeros();
652652 if (BinaryOperator::isFNeg(Opnd0, IgnoreZeroSign)) {
653653 BuilderTy::FastMathFlagGuard Guard(*Builder);
654 Builder->SetFastMathFlags(I.getFastMathFlags());
654 Builder->setFastMathFlags(I.getFastMathFlags());
655655
656656 Value *N0 = dyn_castFNegVal(Opnd0, IgnoreZeroSign);
657657 Value *N1 = dyn_castFNegVal(Opnd1, IgnoreZeroSign);
692692
693693 if (Y) {
694694 BuilderTy::FastMathFlagGuard Guard(*Builder);
695 Builder->SetFastMathFlags(I.getFastMathFlags());
695 Builder->setFastMathFlags(I.getFastMathFlags());
696696 Value *T = Builder->CreateFMul(Opnd1, Opnd1);
697697
698698 Value *R = Builder->CreateFMul(T, Y);
929929 if (FCI->hasOneUse() && FCmpInst::isUnordered(FCI->getPredicate())) {
930930 FCmpInst::Predicate InvPred = FCI->getInversePredicate();
931931 IRBuilder<>::FastMathFlagGuard FMFG(*Builder);
932 Builder->SetFastMathFlags(FCI->getFastMathFlags());
932 Builder->setFastMathFlags(FCI->getFastMathFlags());
933933 Value *NewCond = Builder->CreateFCmp(InvPred, TrueVal, FalseVal,
934934 FCI->getName() + ".inv");
935935
972972 if (FCI->hasOneUse() && FCmpInst::isUnordered(FCI->getPredicate())) {
973973 FCmpInst::Predicate InvPred = FCI->getInversePredicate();
974974 IRBuilder<>::FastMathFlagGuard FMFG(*Builder);
975 Builder->SetFastMathFlags(FCI->getFastMathFlags());
975 Builder->setFastMathFlags(FCI->getFastMathFlags());
976976 Value *NewCond = Builder->CreateFCmp(InvPred, FalseVal, TrueVal,
977977 FCI->getName() + ".inv");
978978
10811081 } else {
10821082 IRBuilder<>::FastMathFlagGuard FMFG(*Builder);
10831083 auto FMF = cast(SI.getCondition())->getFastMathFlags();
1084 Builder->SetFastMathFlags(FMF);
1084 Builder->setFastMathFlags(FMF);
10851085 Cmp = Builder->CreateFCmp(Pred, LHS, RHS);
10861086 }
10871087
598598 IRBuilder<>::FastMathFlagGuard FMFG(Builder);
599599 FastMathFlags FMF;
600600 FMF.setUnsafeAlgebra();
601 Builder.SetFastMathFlags(FMF);
601 Builder.setFastMathFlags(FMF);
602602
603603 Value *Cmp;
604604 if (RK == MRK_FloatMin || RK == MRK_FloatMax)
996996
997997 // Propagate fast-math flags from the existing call to the new call.
998998 IRBuilder<>::FastMathFlagGuard Guard(B);
999 B.SetFastMathFlags(CI->getFastMathFlags());
999 B.setFastMathFlags(CI->getFastMathFlags());
10001000
10011001 // floor((double)floatval) -> (double)floorf(floatval)
10021002 if (Callee->isIntrinsic()) {
10341034
10351035 // Propagate fast-math flags from the existing call to the new call.
10361036 IRBuilder<>::FastMathFlagGuard Guard(B);
1037 B.SetFastMathFlags(CI->getFastMathFlags());
1037 B.setFastMathFlags(CI->getFastMathFlags());
10381038
10391039 // fmin((double)floatval1, (double)floatval2)
10401040 // -> (double)fminf(floatval1, floatval2)
11421142 if (OpCCallee && TLI->getLibFunc(OpCCallee->getName(), Func) &&
11431143 TLI->has(Func) && (Func == LibFunc::exp || Func == LibFunc::exp2)) {
11441144 IRBuilder<>::FastMathFlagGuard Guard(B);
1145 B.SetFastMathFlags(CI->getFastMathFlags());
1145 B.setFastMathFlags(CI->getFastMathFlags());
11461146 Value *FMul = B.CreateFMul(OpC->getArgOperand(0), Op2, "mul");
11471147 return EmitUnaryFloatFnCall(FMul, OpCCallee->getName(), B,
11481148 OpCCallee->getAttributes());
13241324 FMF.setNoSignedZeros();
13251325 FMF.setNoNaNs();
13261326 }
1327 B.SetFastMathFlags(FMF);
1327 B.setFastMathFlags(FMF);
13281328
13291329 // We have a relaxed floating-point environment. We can ignore NaN-handling
13301330 // and transform to a compare and select. We do not have to consider errno or
13671367 IRBuilder<>::FastMathFlagGuard Guard(B);
13681368 FastMathFlags FMF;
13691369 FMF.setUnsafeAlgebra();
1370 B.SetFastMathFlags(FMF);
1370 B.setFastMathFlags(FMF);
13711371
13721372 LibFunc::Func Func;
13731373 Function *F = OpC->getCalledFunction();
14361436 // Fast math flags for any created instructions should match the sqrt
14371437 // and multiply.
14381438 IRBuilder<>::FastMathFlagGuard Guard(B);
1439 B.SetFastMathFlags(I->getFastMathFlags());
1439 B.setFastMathFlags(I->getFastMathFlags());
14401440
14411441 // If we found a repeated factor, hoist it out of the square root and
14421442 // replace it with the fabs of that factor.
37743774 IRBuilder<> Builder(ReductionRoot);
37753775 FastMathFlags Unsafe;
37763776 Unsafe.setUnsafeAlgebra();
3777 Builder.SetFastMathFlags(Unsafe);
3777 Builder.setFastMathFlags(Unsafe);
37783778 unsigned i = 0;
37793779
37803780 for (; i < NumReducedVals - ReduxWidth + 1; i += ReduxWidth) {
141141 EXPECT_FALSE(FAdd->hasNoNaNs());
142142
143143 FastMathFlags FMF;
144 Builder.SetFastMathFlags(FMF);
144 Builder.setFastMathFlags(FMF);
145145
146146 F = Builder.CreateFAdd(F, F);
147147 EXPECT_FALSE(Builder.getFastMathFlags().any());
148148
149149 FMF.setUnsafeAlgebra();
150 Builder.SetFastMathFlags(FMF);
150 Builder.setFastMathFlags(FMF);
151151
152152 F = Builder.CreateFAdd(F, F);
153153 EXPECT_TRUE(Builder.getFastMathFlags().any());
178178
179179 FMF.clear();
180180 FMF.setAllowReciprocal();
181 Builder.SetFastMathFlags(FMF);
181 Builder.setFastMathFlags(FMF);
182182
183183 F = Builder.CreateFDiv(F, F);
184184 EXPECT_TRUE(Builder.getFastMathFlags().any());
196196
197197 FMF.clear();
198198 FMF.setAllowReciprocal();
199 Builder.SetFastMathFlags(FMF);
199 Builder.setFastMathFlags(FMF);
200200
201201 FC = Builder.CreateFCmpOEQ(F, F);
202202 EXPECT_TRUE(Builder.getFastMathFlags().any());
223223
224224 FMF.clear();
225225 FMF.setNoNaNs();
226 Builder.SetFastMathFlags(FMF);
226 Builder.setFastMathFlags(FMF);
227227
228228 FCall = Builder.CreateCall(Callee, None);
229229 EXPECT_TRUE(Builder.getFastMathFlags().any());
308308 MDNode *FPMathA = MDB.createFPMath(0.01f);
309309 MDNode *FPMathB = MDB.createFPMath(0.1f);
310310
311 Builder.SetDefaultFPMathTag(FPMathA);
311 Builder.setDefaultFPMathTag(FPMathA);
312312
313313 {
314314 IRBuilder<>::FastMathFlagGuard Guard(Builder);
315315 FastMathFlags FMF;
316316 FMF.setAllowReciprocal();
317 Builder.SetFastMathFlags(FMF);
318 Builder.SetDefaultFPMathTag(FPMathB);
317 Builder.setFastMathFlags(FMF);
318 Builder.setDefaultFPMathTag(FPMathB);
319319 EXPECT_TRUE(Builder.getFastMathFlags().allowReciprocal());
320320 EXPECT_EQ(FPMathB, Builder.getDefaultFPMathTag());
321321 }