[PATCH] D127710: [SelectionDAG] Enable WidenVecOp_VECREDUCE_SEQ for scalable vector
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 10:32:27 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:6152
+ if (WideVT.isScalableVector()) {
+ unsigned GCD = greatestCommonDivisor(OrigElts, WideElts);
+ EVT SplatVT = EVT::getVectorVT(*DAG.getContext(), ElemVT,
----------------
sdesmalen wrote:
> I may be missing something here, but I'm not sure I understand the need for a `GCD` or for a loop that generates `WideVT.getVectorMinNumElements()` `INSERT_SUBVECTOR`s. Should this code not just insert `VecOp` into a `splat(NeutralElem)` of type `WideVT` using INSERT_SUBVECTOR?
>
> i.e.
>
> vecreduce_seq(<vscale x 10 x half> op)
> <=>
> vecreduce_seq(
> insert_subvector(op, <vscale x 16 x half> splat(%neutral.elem), /*idx=*/0))
>
> where `<vscale x 10 x half>` is `OrigVT` and `<vscale x 16 x half>` is `WideVT`.
I think you meant `insert_subvector(<vscale x 16 x half> splat(%neutral.elem), op, /*idx=*/0)`. `op` would be the subvector so should be the second argument.
That would need to go through WidenVecOp_INSERT_SUBVECTOR, but it will fail because `InVec` isn't undef.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127710/new/
https://reviews.llvm.org/D127710
More information about the llvm-commits
mailing list