[llvm] [LV, VP]VP intrinsics support for the Loop Vectorizer (PR #76172)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 26 09:57:04 PST 2024
================
@@ -348,6 +348,42 @@ Value *VPInstruction::generateInstruction(VPTransformState &State,
Value *Zero = ConstantInt::get(ScalarTC->getType(), 0);
return Builder.CreateSelect(Cmp, Sub, Zero);
}
+ case VPInstruction::ExplicitVectorLength: {
+ // Compute EVL
+ auto GetSetVL = [=](VPTransformState &State, Value *EVL) {
+ assert(EVL->getType()->isIntegerTy() &&
+ "Requested vector length should be an integer.");
+
+ // TODO: Add support for MaxSafeDist for correct loop emission.
+ Value *VFArg = State.Builder.getInt32(State.VF.getKnownMinValue());
+
+ Value *GVL = State.Builder.CreateIntrinsic(
+ State.Builder.getInt32Ty(), Intrinsic::experimental_get_vector_length,
+ {EVL, VFArg, State.Builder.getTrue()});
----------------
alexey-bataev wrote:
Done!
https://github.com/llvm/llvm-project/pull/76172
More information about the llvm-commits
mailing list