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

--- Comment #3 from vekumar at gcc dot gnu.org ---
(In reply to Richard Biener from comment #2)
> Note a workaround would be to re-arrange the vectorizer calls to
> vectorizable_simd_clone_call and vectorizable_call.  Can you check if
> the following works?  It gives precedence to what the target hook
> (and thus -mveclibabi) provides.
> 
> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
> index 9f365e31e49..bdef56bf65e 100644
> --- a/gcc/tree-vect-stmts.c
> +++ b/gcc/tree-vect-stmts.c
> @@ -9543,13 +9543,13 @@ vect_analyze_stmt (gimple *stmt, bool
> *need_to_vectorize, slp_tree node,
>    if (!bb_vinfo
>        && (STMT_VINFO_RELEVANT_P (stmt_info)
>           || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def))
> -    ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node, cost_vec)
> +    ok = (vectorizable_call (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_conversion (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_shift (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_operation (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_assignment (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_load (stmt, NULL, NULL, node, node_instance,
> cost_vec)
> -         || vectorizable_call (stmt, NULL, NULL, node, cost_vec)
> +         || vectorizable_simd_clone_call (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_store (stmt, NULL, NULL, node, cost_vec)
>           || vectorizable_reduction (stmt, NULL, NULL, node, node_instance,
>                                      cost_vec)
> @@ -9559,14 +9559,14 @@ vect_analyze_stmt (gimple *stmt, bool
> *need_to_vectorize, slp_tree node,
>    else
>      {
>        if (bb_vinfo)
> -       ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node, cost_vec)
> +       ok = (vectorizable_call (stmt, NULL, NULL, node, cost_vec)
>               || vectorizable_conversion (stmt, NULL, NULL, node, cost_vec)
>               || vectorizable_shift (stmt, NULL, NULL, node, cost_vec)
>               || vectorizable_operation (stmt, NULL, NULL, node, cost_vec)
>               || vectorizable_assignment (stmt, NULL, NULL, node, cost_vec)
>               || vectorizable_load (stmt, NULL, NULL, node, node_instance,
>                                     cost_vec)
> -             || vectorizable_call (stmt, NULL, NULL, node, cost_vec)
> +             || vectorizable_simd_clone_call (stmt, NULL, NULL, node,
> cost_vec)
>               || vectorizable_store (stmt, NULL, NULL, node, cost_vec)
>               || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node,
>                                          cost_vec)

Checked the patch now it give preference to  -mveclibabi= option and generating
expected calls.

Reply via email to