Lines Matching refs:VPI

100 static void transferDecorations(Value &NewVal, VPIntrinsic &VPI) {  in transferDecorations()  argument
105 auto *OldFMOp = dyn_cast<FPMathOperator>(&VPI); in transferDecorations()
120 static bool maySpeculateLanes(VPIntrinsic &VPI) { in maySpeculateLanes() argument
122 if (isa<VPReductionIntrinsic>(VPI)) in maySpeculateLanes()
125 Optional<unsigned> OpcOpt = VPI.getFunctionalOpcode(); in maySpeculateLanes()
127 return isSafeToSpeculativelyExecuteWithOpcode(FunctionalOpc, &VPI); in maySpeculateLanes()
163 Value *foldEVLIntoMask(VPIntrinsic &VPI);
180 VPIntrinsic &VPI);
188 VPLegalization getVPLegalizationStrategy(const VPIntrinsic &VPI) const;
236 VPIntrinsic &VPI) { in expandPredicationInBinaryOperator() argument
237 assert((maySpeculateLanes(VPI) || VPI.canIgnoreVectorLengthParam()) && in expandPredicationInBinaryOperator()
240 auto OC = static_cast<Instruction::BinaryOps>(*VPI.getFunctionalOpcode()); in expandPredicationInBinaryOperator()
243 Value *Op0 = VPI.getOperand(0); in expandPredicationInBinaryOperator()
244 Value *Op1 = VPI.getOperand(1); in expandPredicationInBinaryOperator()
245 Value *Mask = VPI.getMaskParam(); in expandPredicationInBinaryOperator()
260 Value *SafeDivisor = getSafeDivisor(VPI.getType()); in expandPredicationInBinaryOperator()
265 Value *NewBinOp = Builder.CreateBinOp(OC, Op0, Op1, VPI.getName()); in expandPredicationInBinaryOperator()
267 replaceOperation(*NewBinOp, VPI); in expandPredicationInBinaryOperator()
271 static Value *getNeutralReductionElement(const VPReductionIntrinsic &VPI, in getNeutralReductionElement() argument
275 switch (VPI.getIntrinsicID()) { in getNeutralReductionElement()
298 FastMathFlags Flags = VPI.getFastMathFlags(); in getNeutralReductionElement()
315 VPReductionIntrinsic &VPI) { in expandPredicationInReduction() argument
316 assert((maySpeculateLanes(VPI) || VPI.canIgnoreVectorLengthParam()) && in expandPredicationInReduction()
319 Value *Mask = VPI.getMaskParam(); in expandPredicationInReduction()
320 Value *RedOp = VPI.getOperand(VPI.getVectorParamPos()); in expandPredicationInReduction()
324 auto *NeutralElt = getNeutralReductionElement(VPI, VPI.getType()); in expandPredicationInReduction()
331 Value *Start = VPI.getOperand(VPI.getStartParamPos()); in expandPredicationInReduction()
333 switch (VPI.getIntrinsicID()) { in expandPredicationInReduction()
378 transferDecorations(*Reduction, VPI); in expandPredicationInReduction()
384 transferDecorations(*Reduction, VPI); in expandPredicationInReduction()
396 replaceOperation(*Reduction, VPI); in expandPredicationInReduction()
402 VPIntrinsic &VPI) { in expandPredicationInMemoryIntrinsic() argument
403 assert(VPI.canIgnoreVectorLengthParam()); in expandPredicationInMemoryIntrinsic()
407 Value *MaskParam = VPI.getMaskParam(); in expandPredicationInMemoryIntrinsic()
408 Value *PtrParam = VPI.getMemoryPointerParam(); in expandPredicationInMemoryIntrinsic()
409 Value *DataParam = VPI.getMemoryDataParam(); in expandPredicationInMemoryIntrinsic()
412 MaybeAlign AlignOpt = VPI.getPointerAlignment(); in expandPredicationInMemoryIntrinsic()
415 switch (VPI.getIntrinsicID()) { in expandPredicationInMemoryIntrinsic()
433 Builder.CreateLoad(VPI.getType(), PtrParam, /*IsVolatile*/ false); in expandPredicationInMemoryIntrinsic()
439 VPI.getType(), PtrParam, AlignOpt.valueOrOne(), MaskParam); in expandPredicationInMemoryIntrinsic()
451 auto *ElementType = cast<VectorType>(VPI.getType())->getElementType(); in expandPredicationInMemoryIntrinsic()
453 VPI.getType(), PtrParam, in expandPredicationInMemoryIntrinsic()
455 VPI.getName()); in expandPredicationInMemoryIntrinsic()
461 replaceOperation(*NewMemoryInst, VPI); in expandPredicationInMemoryIntrinsic()
465 void CachingVPExpander::discardEVLParameter(VPIntrinsic &VPI) { in discardEVLParameter() argument
466 LLVM_DEBUG(dbgs() << "Discard EVL parameter in " << VPI << "\n"); in discardEVLParameter()
468 if (VPI.canIgnoreVectorLengthParam()) in discardEVLParameter()
471 Value *EVLParam = VPI.getVectorLengthParam(); in discardEVLParameter()
475 ElementCount StaticElemCount = VPI.getStaticVectorLength(); in discardEVLParameter()
477 Type *Int32Ty = Type::getInt32Ty(VPI.getContext()); in discardEVLParameter()
480 auto *M = VPI.getModule(); in discardEVLParameter()
483 IRBuilder<> Builder(VPI.getParent(), VPI.getIterator()); in discardEVLParameter()
491 VPI.setVectorLengthParam(MaxEVL); in discardEVLParameter()
494 Value *CachingVPExpander::foldEVLIntoMask(VPIntrinsic &VPI) { in foldEVLIntoMask() argument
495 LLVM_DEBUG(dbgs() << "Folding vlen for " << VPI << '\n'); in foldEVLIntoMask()
497 IRBuilder<> Builder(&VPI); in foldEVLIntoMask()
500 if (VPI.canIgnoreVectorLengthParam()) in foldEVLIntoMask()
501 return &VPI; in foldEVLIntoMask()
504 Value *OldMaskParam = VPI.getMaskParam(); in foldEVLIntoMask()
505 Value *OldEVLParam = VPI.getVectorLengthParam(); in foldEVLIntoMask()
513 ElementCount ElemCount = VPI.getStaticVectorLength(); in foldEVLIntoMask()
516 VPI.setMaskParam(NewMaskParam); in foldEVLIntoMask()
519 discardEVLParameter(VPI); in foldEVLIntoMask()
520 assert(VPI.canIgnoreVectorLengthParam() && in foldEVLIntoMask()
524 return &VPI; in foldEVLIntoMask()
527 Value *CachingVPExpander::expandPredication(VPIntrinsic &VPI) { in expandPredication() argument
528 LLVM_DEBUG(dbgs() << "Lowering to unpredicated op: " << VPI << '\n'); in expandPredication()
530 IRBuilder<> Builder(&VPI); in expandPredication()
533 auto OC = VPI.getFunctionalOpcode(); in expandPredication()
536 return expandPredicationInBinaryOperator(Builder, VPI); in expandPredication()
538 if (auto *VPRI = dyn_cast<VPReductionIntrinsic>(&VPI)) in expandPredication()
541 switch (VPI.getIntrinsicID()) { in expandPredication()
548 return expandPredicationInMemoryIntrinsic(Builder, VPI); in expandPredication()
551 return &VPI; in expandPredication()
565 void sanitizeStrategy(VPIntrinsic &VPI, VPLegalization &LegalizeStrat) { in sanitizeStrategy() argument
567 if (maySpeculateLanes(VPI)) { in sanitizeStrategy()
587 CachingVPExpander::getVPLegalizationStrategy(const VPIntrinsic &VPI) const { in getVPLegalizationStrategy()
588 auto VPStrat = TTI.getVPLegalizationStrategy(VPI); in getVPLegalizationStrategy()
608 auto *VPI = dyn_cast<VPIntrinsic>(&I); in expandVectorPredication() local
609 if (!VPI) in expandVectorPredication()
611 auto VPStrat = getVPLegalizationStrategy(*VPI); in expandVectorPredication()
612 sanitizeStrategy(*VPI, VPStrat); in expandVectorPredication()
614 Worklist.emplace_back(VPI, VPStrat); in expandVectorPredication()