]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/120457 - avoid lowering of some single-element interleave
authorRichard Biener <rguenther@suse.de>
Fri, 30 May 2025 06:54:10 +0000 (08:54 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 30 May 2025 09:35:26 +0000 (11:35 +0200)
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.

gcc/tree-vect-slp.cc

index fb2262a61376dad90ce5e7b853e07311a84daed8..dc89da3bf1777b1665faab3b720ba2830e892d07 100644 (file)
@@ -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.  */