https://gcc.gnu.org/g:1732298d51028ae50a802e538df5d7249556255d

commit r15-4112-g1732298d51028ae50a802e538df5d7249556255d
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Mon Oct 7 13:03:03 2024 +0100

    vect: Variable lane indices in vectorizable_slp_permutation_1 [PR116583]
    
    The main patch for PR116583 needs to create variable indices into
    an input vector.  This pre-patch changes the types to allow that.
    
    There is no pretty-print format for poly_uint64 because of issues
    with passing C++ objects through "...".
    
    gcc/
            PR tree-optimization/116583
            * tree-vect-slp.cc (vectorizable_slp_permutation_1): Using
            poly_uint64 for scalar lane indices.

Diff:
---
 gcc/tree-vect-slp.cc | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 125e69cf0eb0..97a471ad9108 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -10310,8 +10310,8 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, 
gimple_stmt_iterator *gsi,
      from the { SLP operand, scalar lane } permutation as recorded in the
      SLP node as intermediate step.  This part should already work
      with SLP children with arbitrary number of lanes.  */
-  auto_vec<std::pair<std::pair<unsigned, unsigned>, unsigned> > vperm;
-  auto_vec<unsigned> active_lane;
+  auto_vec<std::pair<std::pair<unsigned, unsigned>, poly_uint64>> vperm;
+  auto_vec<poly_uint64> active_lane;
   vperm.create (olanes);
   active_lane.safe_grow_cleared (children.length (), true);
   for (unsigned i = 0; i < ncopies; ++i)
@@ -10326,8 +10326,9 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, 
gimple_stmt_iterator *gsi,
            {
              /* We checked above that the vectors are constant-length.  */
              unsigned vnunits = TYPE_VECTOR_SUBPARTS (vtype).to_constant ();
-             unsigned vi = (active_lane[p.first] + p.second) / vnunits;
-             unsigned vl = (active_lane[p.first] + p.second) % vnunits;
+             unsigned lane = active_lane[p.first].to_constant ();
+             unsigned vi = (lane + p.second) / vnunits;
+             unsigned vl = (lane + p.second) % vnunits;
              vperm.quick_push ({{p.first, vi}, vl});
            }
        }
@@ -10353,9 +10354,10 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, 
gimple_stmt_iterator *gsi,
                  ? multiple_p (i, npatterns)
                  : multiple_p (i, TYPE_VECTOR_SUBPARTS (vectype))))
            dump_printf (MSG_NOTE, ",");
-         dump_printf (MSG_NOTE, " vops%u[%u][%u]",
-                      vperm[i].first.first, vperm[i].first.second,
-                      vperm[i].second);
+         dump_printf (MSG_NOTE, " vops%u[%u][",
+                      vperm[i].first.first, vperm[i].first.second);
+         dump_dec (MSG_NOTE, vperm[i].second);
+         dump_printf (MSG_NOTE, "]");
        }
       dump_printf (MSG_NOTE, "\n");
     }

Reply via email to