[PATCH] D127710: [SelectionDAG] Enable WidenVecOp_VECREDUCE_SEQ for scalable vector

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 10:05:22 PDT 2022


sdesmalen 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,
----------------
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`.


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