[llvm] [LV] Support binary and unary operations with EVL-vectorization (PR #93854)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 20:59:23 PDT 2024
================
@@ -1140,6 +1144,53 @@ void VPWidenRecipe::execute(VPTransformState &State) {
#endif
}
+void VPWidenEVLRecipe::execute(VPTransformState &State) {
+ assert(State.UF == 1 && "Expected only UF == 1 when vectorizing with "
+ "explicit vector length.");
+ VPValue *Op0 = getOperand(0);
+
+ assert(State.get(Op0, 0)->getType()->isVectorTy() &&
+ "VPWidenEVLRecipe should not be used for scalars");
+
+ VPValue *EVL = getEVL();
+ Value *EVLArg = State.get(EVL, 0, /*NeedsScalar=*/true);
+ unsigned Opcode = getOpcode();
+ Instruction *I = getUnderlyingInstr();
+ IRBuilderBase &BuilderIR = State.Builder;
+ VectorBuilder Builder(BuilderIR);
+ Value *Mask = BuilderIR.CreateVectorSplat(State.VF, BuilderIR.getTrue());
+ Value *VPInst = nullptr;
+
+ //===------------------- Binary and Unary Ops ---------------------===//
+ if (Instruction::isBinaryOp(Opcode) || Instruction::isUnaryOp(Opcode)) {
+ // Just widen unops and binops.
+
+ SmallVector<Value *, 4> Ops;
----------------
LiqinWeng wrote:
add: State.setDebugLocFrom(getDebugLoc())
https://github.com/llvm/llvm-project/pull/93854
More information about the llvm-commits
mailing list