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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #18)
> diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
> index 7cf9504398c..8deeecfd4aa 100644
> --- a/gcc/tree-vect-slp.cc
> +++ b/gcc/tree-vect-slp.cc
> @@ -1280,8 +1280,11 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char
> *swap,
>                     && rhs_code.is_tree_code ()
>                     && (TREE_CODE_CLASS (tree_code (first_stmt_code))
>                         == tcc_comparison)
> -                   && (swap_tree_comparison (tree_code (first_stmt_code))
> -                       == tree_code (rhs_code)))
> +                   && ((swap_tree_comparison (tree_code (first_stmt_code))
> +                        == tree_code (rhs_code))
> +                       || ((TREE_CODE_CLASS (tree_code (alt_stmt_code))
> +                            == tcc_comparison)
> +                           && rhs_code == alt_stmt_code)))
>                && !(STMT_VINFO_GROUPED_ACCESS (stmt_info)
>                     && (first_stmt_code == ARRAY_REF
>                         || first_stmt_code == BIT_FIELD_REF
> 


diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 7cf9504398c..e35eeeea3fa 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1519,7 +1522,9 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char
*swap,
   if (alt_stmt_code != ERROR_MARK
       && (!alt_stmt_code.is_tree_code ()
          || (TREE_CODE_CLASS (tree_code (alt_stmt_code)) != tcc_reference
-             && TREE_CODE_CLASS (tree_code (alt_stmt_code)) !=
tcc_comparison)))
+             && (TREE_CODE_CLASS (tree_code (alt_stmt_code)) != tcc_comparison
+                 || (swap_tree_comparison (tree_code (first_stmt_code))
+                     != tree_code (alt_stmt_code))))))
     {
       *two_operators = true;
     }

is also needed btw. to avoid wrong-code.  I see

t.c:8:26: note:   ==> examining statement: pretmp_29 = *_28;
t.c:8:26: missed:   unsupported load permutation
t.c:10:30: missed:   not vectorized: relevant stmt not supported: pretmp_29 =
*_28;
t.c:8:26: note:   removing SLP instance operations starting from: .MASK_STORE
(_5, 8B, patt_12, pretmp_29);

using -O3 -march=armv8.3-a+sve - it then does

t.c:8:26: missed:  unsupported SLP instances
t.c:8:26: note:  re-trying with SLP disabled

and _that_ fails then with

t.c:8:26: missed:   Not using elementwise accesses due to variable
vectorization factor.
t.c:6:1: missed:   not vectorized: relevant stmt not supported: .MASK_STORE
(_5, 8B, patt_12, pretmp_29);

but the interesting bit is why it fails to handle the SLP case.

That's possibly because the load isn't a grouped access, we get
dr_group_size == 1 and group_size == 2 and nunits is {16, 16}
(!repeating_p) and so

      /* We need to construct a separate mask for each vector statement.  */
      unsigned HOST_WIDE_INT const_nunits, const_vf;
      if (!nunits.is_constant (&const_nunits)
          || !vf.is_constant (&const_vf))
        return false;

I'm not sure what that comment means, but supposedly we simply fail to handle
another special case that we could here?  Possibly dr_group_size == 1?

Reply via email to