[PATCH] D127710: [SelectionDAG] Enable WidenVecOp_VECREDUCE_SEQ for scalable vector
WangLian via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 19:25:01 PDT 2022
Jimerlife 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,
----------------
craig.topper wrote:
> 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.
If we do like this `vecreduce_seq(insert_subvector(<vscale x 16 x half> splat, vecop, /*idx=*/0))`, that would go through WidenVecOp_INSERT_SUBVECTOR because of `vecop` need to widen.
But now, WidenVecOp_INSERT_SUBVECTOR only support insert subvector into undefined vector.
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