[llvm] Vector masked extract last active element intrinsic (PR #113587)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 05:42:41 PST 2024
================
@@ -8187,6 +8187,29 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
visitVectorHistogram(I, Intrinsic);
return;
}
+ case Intrinsic::experimental_vector_masked_extract_last_active: {
+ SDValue Data = getValue(I.getOperand(0));
+ SDValue Mask = getValue(I.getOperand(1));
+ SDValue PassThru = getValue(I.getOperand(2));
+
+ EVT DataVT = Data.getValueType();
+ EVT ScalarVT = PassThru.getValueType();
+ EVT BoolVT = Mask.getValueType().getScalarType();
+ EVT IdxVT = TLI.getVectorIdxTy(DAG.getDataLayout());
+ EVT IdxVecVT = DataVT.changeVectorElementType(IdxVT);
----------------
paulwalker-arm wrote:
More often than not this will be an illegal (way too big) type that will need splitting. Perhaps DAGCombine will come to the rescue, but if you look at the lowering of `cttz_elts` you'll see we have logic that attempts to pick a better starting vector type. Perhaps you can just use `getBitWidthForCttzElements` as well? and then zero extend the result of the umax reduction.
https://github.com/llvm/llvm-project/pull/113587
More information about the llvm-commits
mailing list