[llvm] [LV][EVL] Support cast instruction with EVL-vectorization (PR #108351)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 20:01:21 PST 2024


================
@@ -1484,6 +1484,24 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
                 VPValue *NewMask = GetNewMask(Red->getCondOp());
                 return new VPReductionEVLRecipe(*Red, EVL, NewMask);
               })
+              .Case<VPWidenCastRecipe>(
+                  [&](VPWidenCastRecipe *CInst) -> VPRecipeBase * {
+                    auto *CI = cast<CastInst>(CInst->getUnderlyingInstr());
+                    SmallVector<VPValue *> Ops(CInst->operands());
+                    Ops.push_back(&EVL);
+                    Intrinsic::ID VPID =
+                        VPIntrinsic::getForOpcode(CI->getOpcode());
+                    if (VPID == Intrinsic::not_intrinsic)
+                      return nullptr;
+                    // FIXME: In fact, can we really not pass the
+                    // underlyingInstr? In this case, how to set the Flag and
+                    // add metadata in VPWidenIntrinsicRecipe::execute?
+                    // return new VPWidenIntrinsicRecipe(
+                    //     *CI, VPID, Ops, CI->getType(), CI->getDebugLoc());
----------------
LiqinWeng wrote:

removed~should vp.cast need to set flags ?From https://llvm.org/docs/LangRef.html#llvm-vp-trunc-intrinsics, it seems there are no flags but I'm not sure if I understand it correctly

https://github.com/llvm/llvm-project/pull/108351


More information about the llvm-commits mailing list