From: Richard Biener Date: Fri, 30 May 2025 06:54:10 +0000 (+0200) Subject: tree-optimization/120457 - avoid lowering of some single-element interleave X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0291f53f8d2343ca0d39589ebffc31d9c328d6ab;p=thirdparty%2Fgcc.git tree-optimization/120457 - avoid lowering of some single-element interleave The following makes sure we are not lowering single-element interleaving schemes in a way that defeats load vectorizing later but allows the VMAT_ELEMENTWISE fallback to be used. PR tree-optimization/120457 * tree-vect-slp.cc (vect_lower_load_permutations): Implement the same heuristics as load vectorization for single-element interleaving that spans multiple vectors. --- diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index fb2262a6137..dc89da3bf17 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -4557,6 +4557,15 @@ vect_lower_load_permutations (loop_vec_info loop_vinfo, if (!SLP_TREE_CHILDREN (load).is_empty ()) continue; + /* For single-element interleaving spanning multiple vectors avoid + lowering, we want to use VMAT_ELEMENTWISE later. */ + if (ld_lanes_lanes == 0 + && SLP_TREE_LANES (load) == 1 + && !DR_GROUP_NEXT_ELEMENT (first) + && maybe_gt (group_lanes, + TYPE_VECTOR_SUBPARTS (SLP_TREE_VECTYPE (load)))) + return; + /* We want to pattern-match special cases here and keep those alone. Candidates are splats and load-lane. */