diff mbox series

vect: Add missed opcodes in vect_get_smallest_scalar_type [PR115228]

Message ID LV2PR01MB7839F866EC6CAECAEC45F70FF7BE2@LV2PR01MB7839.prod.exchangelabs.com
State New
Headers show
Series vect: Add missed opcodes in vect_get_smallest_scalar_type [PR115228] | expand

Commit Message

Feng Xue OS Aug. 5, 2024, 10:36 a.m. UTC
Some opcodes are missed when determining the smallest scalar type for a
vectorizable statement. Currently, this bug does not cause any problem,
because vect_get_smallest_scalar_type is only used to compute max nunits
vectype, and even statement with missed opcode is incorrectly bypassed,
the max nunits vectype could also be rightly deduced from def statements
for operands of the statement.

In the future, if this function will be called to do other thing, we may
get something wrong. So fix it in this patch.

Thanks,
Feng

---
gcc/
        * tree-vect-data-refs.cc (vect_get_smallest_scalar_type): Add
        missed opcodes that involve widening operation.
---
 gcc/tree-vect-data-refs.cc | 3 +++
 1 file changed, 3 insertions(+)

Comments

Richard Biener Aug. 5, 2024, 10:46 a.m. UTC | #1
On Mon, Aug 5, 2024 at 12:36 PM Feng Xue OS <fxue@os.amperecomputing.com> wrote:
>
> Some opcodes are missed when determining the smallest scalar type for a
> vectorizable statement. Currently, this bug does not cause any problem,
> because vect_get_smallest_scalar_type is only used to compute max nunits
> vectype, and even statement with missed opcode is incorrectly bypassed,
> the max nunits vectype could also be rightly deduced from def statements
> for operands of the statement.
>
> In the future, if this function will be called to do other thing, we may
> get something wrong. So fix it in this patch.

OK.

Thanks,
Richard.

> Thanks,
> Feng
>
> ---
> gcc/
>         * tree-vect-data-refs.cc (vect_get_smallest_scalar_type): Add
>         missed opcodes that involve widening operation.
> ---
>  gcc/tree-vect-data-refs.cc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
> index 39fd887a96b..5b0d548f847 100644
> --- a/gcc/tree-vect-data-refs.cc
> +++ b/gcc/tree-vect-data-refs.cc
> @@ -162,7 +162,10 @@ vect_get_smallest_scalar_type (stmt_vec_info stmt_info, tree scalar_type)
>        if (gimple_assign_cast_p (assign)
>           || gimple_assign_rhs_code (assign) == DOT_PROD_EXPR
>           || gimple_assign_rhs_code (assign) == WIDEN_SUM_EXPR
> +         || gimple_assign_rhs_code (assign) == SAD_EXPR
>           || gimple_assign_rhs_code (assign) == WIDEN_MULT_EXPR
> +         || gimple_assign_rhs_code (assign) == WIDEN_MULT_PLUS_EXPR
> +         || gimple_assign_rhs_code (assign) == WIDEN_MULT_MINUS_EXPR
>           || gimple_assign_rhs_code (assign) == WIDEN_LSHIFT_EXPR
>           || gimple_assign_rhs_code (assign) == FLOAT_EXPR)
>         {
> --
> 2.17.1
diff mbox series

Patch

diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index 39fd887a96b..5b0d548f847 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -162,7 +162,10 @@  vect_get_smallest_scalar_type (stmt_vec_info stmt_info, tree scalar_type)
       if (gimple_assign_cast_p (assign)
          || gimple_assign_rhs_code (assign) == DOT_PROD_EXPR
          || gimple_assign_rhs_code (assign) == WIDEN_SUM_EXPR
+         || gimple_assign_rhs_code (assign) == SAD_EXPR
          || gimple_assign_rhs_code (assign) == WIDEN_MULT_EXPR
+         || gimple_assign_rhs_code (assign) == WIDEN_MULT_PLUS_EXPR
+         || gimple_assign_rhs_code (assign) == WIDEN_MULT_MINUS_EXPR
          || gimple_assign_rhs_code (assign) == WIDEN_LSHIFT_EXPR
          || gimple_assign_rhs_code (assign) == FLOAT_EXPR)
        {