On Wed, 20 Nov 2024, Richard Biener wrote:

> When SLP vectorizing we fail to mark the general alignment check
> as irrelevant when using VMAT_STRIDED_SLP (the implementation checks
> for itself) and when VMAT_INVARIANT the override isn't effective.
> 
> This results in extra FAILs on sparc which the following fixes.

The following is what I pushed.

Richard.

>From 65318644e4a5c53305a1ce2b61897f651c6fb903 Mon Sep 17 00:00:00 2001
From: Richard Biener <rguent...@suse.de>
Date: Wed, 20 Nov 2024 13:32:48 +0100
Subject: [PATCH] tree-optimization/117698 - SLP vectorization and alignment
To: gcc-patches@gcc.gnu.org

When SLP vectorizing we fail to mark the general alignment check
as irrelevant when using VMAT_STRIDED_SLP (the implementation checks
for itself) and when VMAT_INVARIANT the override isn't effective.

This results in extra FAILs on sparc which the following fixes.

        PR tree-optimization/117698
        * tree-vect-stmts.cc (get_group_load_store_type): Properly
        disregard alignment for VMAT_STRIDED_SLP and VMAT_INVARIANT.
        (vectorizable_load): Adjust guard for dumping whether we
        vectorize and unaligned access.
        (vectorizable_store): Likewise.
---
 gcc/tree-vect-stmts.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 5f7e1e622a8..752ee457f6d 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -2121,9 +2121,6 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info 
stmt_info,
            {
              gcc_assert (vls_type == VLS_LOAD);
              *memory_access_type = VMAT_INVARIANT;
-             /* Invariant accesses perform only component accesses, alignment
-                is irrelevant for them.  */
-             *alignment_support_scheme = dr_unaligned_supported;
            }
          /* Try using LOAD/STORE_LANES.  */
          else if (slp_node->ldst_lanes
@@ -2379,7 +2376,9 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info 
stmt_info,
     *memory_access_type = VMAT_GATHER_SCATTER;
 
   if (*memory_access_type == VMAT_GATHER_SCATTER
-      || *memory_access_type == VMAT_ELEMENTWISE)
+      || *memory_access_type == VMAT_ELEMENTWISE
+      || *memory_access_type == VMAT_STRIDED_SLP
+      || *memory_access_type == VMAT_INVARIANT)
     {
       *alignment_support_scheme = dr_unaligned_supported;
       *misalignment = DR_MISALIGNMENT_UNKNOWN;
@@ -8497,6 +8496,8 @@ vectorizable_store (vec_info *vinfo,
       if (dump_enabled_p ()
          && memory_access_type != VMAT_ELEMENTWISE
          && memory_access_type != VMAT_GATHER_SCATTER
+         && memory_access_type != VMAT_STRIDED_SLP
+         && memory_access_type != VMAT_INVARIANT
          && alignment_support_scheme != dr_aligned)
        dump_printf_loc (MSG_NOTE, vect_location,
                         "Vectorizing an unaligned access.\n");
@@ -10410,6 +10411,8 @@ vectorizable_load (vec_info *vinfo,
       if (dump_enabled_p ()
          && memory_access_type != VMAT_ELEMENTWISE
          && memory_access_type != VMAT_GATHER_SCATTER
+         && memory_access_type != VMAT_STRIDED_SLP
+         && memory_access_type != VMAT_INVARIANT
          && alignment_support_scheme != dr_aligned)
        dump_printf_loc (MSG_NOTE, vect_location,
                         "Vectorizing an unaligned access.\n");
-- 
2.43.0

Reply via email to