https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114375

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I see that get_load_store_type and get_group_load_store_type return VMAT_*
kinds that do not handle the masked case.  There's some rejection in the
callers for that case but it's also incomplete (VMAT_ELEMENTWISE and
VMAT_STRIDED_SLP but I also think VMAT_CONTIGUOUS_PERMUTE/REVERSE misses
some handling, at least the optab check).

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index e8617439a48..5a4eb136c6d 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -10080,6 +10080,14 @@ vectorizable_load (vec_info *vinfo,
                             "unsupported masked emulated gather.\n");
          return false;
        }
+      else if (memory_access_type == VMAT_ELEMENTWISE
+              || memory_access_type == VMAT_STRIDED_SLP)
+       {
+         if (dump_enabled_p ())
+           dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                            "unsupported masked strided access.\n");
+         return false;
+       }
     }

   bool costing_p = !vec_stmt;

should plug the elementwise/SLP case.  Interestingly

void __attribute__((noipa))
foo (int s, int * __restrict p)
{
  for (int i = 0; i < 64; ++i)
    {
      int tem = 0;
      if (a[i])
        tem = p[s*i];
      b[i] = tem;
    }
}

uses VMAT_GATHER_SCATTER, I failed to get it produce VMAT_ELEMENTWISE.

Reply via email to