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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> --- a/gcc/tree-vect-generic.cc
> +++ b/gcc/tree-vect-generic.cc
> @@ -1040,6 +1040,10 @@ expand_vector_condition (gimple_stmt_iterator *gsi,
> bitmap dce_ssa_names)
>    tree_code code = TREE_CODE (a);
>    gassign *assign = NULL;
>  
> +  if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a))
> +      && expand_vec_cond_expr_p (type, TREE_TYPE (a), ERROR_MARK))
> +    return true;
> +
>    if (code == SSA_NAME)
>      {
>        assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (a));

Ok, the above LGTM.

> @@ -1053,14 +1057,14 @@ expand_vector_condition (gimple_stmt_iterator *gsi,
> bitmap dce_ssa_names)
>           comp_inner_type = TREE_TYPE (TREE_TYPE (a1));
>           comp_width = vector_element_bits_tree (TREE_TYPE (a1));
>         }
> -    }
>  
> -  if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code)
> -      || (integer_all_onesp (b) && integer_zerop (c)
> -         && expand_vec_cmp_expr_p (type, TREE_TYPE (a1), code)))
> -    {
> -      gcc_assert (TREE_CODE (a) == SSA_NAME || TREE_CODE (a) == VECTOR_CST);
> -      return true;
> +      if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code)
> +         || (integer_all_onesp (b) && integer_zerop (c)
> +             && expand_vec_cmp_expr_p (type, TREE_TYPE (a1), code)))
> +       {
> +         gcc_assert (TREE_CODE (a) == SSA_NAME || TREE_CODE (a) ==
> VECTOR_CST);
> +         return true;
> +       }
>      }
>  
>    /* Handle vector boolean types with bitmasks.  If there is a comparison

Is the second hunk because the verifier now requires that first argument of
VEC_COND_EXPR is always is_gimple_val and so it will be never tcc_comparison?
I don't understand the assert after the change though, this is in code guarded
with
code == SSA_NAME, so TREE_CODE (a) == SSA_NAME is always true.
If TREE_CODE (a) == VECTOR_CST, then it could return true without lowering only
in the
first hunk.

Are you going to test the patch (with the assert removed?)?

Not really sure about the testcase, perhaps the #c6 one in
gcc.target/aarch64/sve/pr109176.c with
/* PR tree-optimization/109176 */
/* { dg-do compile } */
/* { dg-options "-O2 -march=armv8.2-a+sve" } */

at the start added?  Or #pragma GCC aarch64 "arm_sve.h" line replaced with
#include <arm_sve.h> as well?

Reply via email to