Alejandro Martinez Vicente <alejandro.martinezvice...@arm.com> writes:
> @@ -5885,6 +5885,56 @@ is_nonwrapping_integer_induction (stmt_vec_info 
> stmt_vinfo, struct loop *loop)
>         <= TYPE_PRECISION (lhs_type));
>  }
>  
> +/* Check if masking can be supported by inserting a condional expression.

conditional

> +   CODE is the code for the operation.  COND_FN is the conditional internal
> +   function, if it exists.  VECTYPE_IN is the type of the vector input.  */
> +static bool
> +use_mask_by_cond_expr_p (enum tree_code code, internal_fn cond_fn,
> +                      tree vectype_in)
> +{
> +  if (cond_fn != IFN_LAST
> +      && direct_internal_fn_supported_p (cond_fn, vectype_in,
> +                                      OPTIMIZE_FOR_SPEED))
> +    return false;
> +
> +  switch (code)
> +    {
> +    case DOT_PROD_EXPR:
> +      return true;
> +
> +    default:
> +      return false;
> +    }
> +}
> +
> +/* Insert a condional expression to enable masked vectorization.  CODE is the

Same here.

> +   code for the operation.  VOP is the array of operands.  MASK is the loop
> +   mask.  GSI is a statement iterator used to place the new conditional
> +   expression.  */
> +static void
> +build_vect_cond_expr (enum tree_code code, tree vop[3], tree mask,
> +                   gimple_stmt_iterator *gsi)
> +{
> +  switch (code)
> +    {
> +    case DOT_PROD_EXPR:
> +      {
> +     tree vectype = TREE_TYPE (vop[1]);
> +     tree zero = build_zero_cst (vectype);
> +     zero = build_vector_from_val (vectype, zero);

This last line isn't right -- should just delete it.

    tree zero = build_zero_cst (vectype);

builds a zero vector in one go.

OK with those changes, thanks.  (This version didn't include the testcase,
but I assume that's because it didn't change from last time.)

Richard

Reply via email to