[tree-optimization/111721,V2] VECT: Support SLP for MASK_LEN_GATHER_LOAD with dummy mask
Checks
Commit Message
This patch fixes following FAILs for RVV:
FAIL: gcc.dg/vect/vect-gather-1.c -flto -ffat-lto-objects scan-tree-dump vect "Loop contains only SLP stmts"
FAIL: gcc.dg/vect/vect-gather-1.c scan-tree-dump vect "Loop contains only SLP stmts"
Bootstrap on X86 and regtest passed.
Ok for trunk ?
PR tree-optimization/111721
gcc/ChangeLog:
* tree-vect-slp.cc (vect_get_and_check_slp_defs): Support SLP for dummy mask -1.
* tree-vect-stmts.cc (vectorizable_load): Ditto.
---
gcc/tree-vect-slp.cc | 5 ++---
gcc/tree-vect-stmts.cc | 5 +++--
2 files changed, 5 insertions(+), 5 deletions(-)
Comments
On Fri, 3 Nov 2023, Juzhe-Zhong wrote:
> This patch fixes following FAILs for RVV:
> FAIL: gcc.dg/vect/vect-gather-1.c -flto -ffat-lto-objects scan-tree-dump vect "Loop contains only SLP stmts"
> FAIL: gcc.dg/vect/vect-gather-1.c scan-tree-dump vect "Loop contains only SLP stmts"
>
> Bootstrap on X86 and regtest passed.
>
> Ok for trunk ?
OK. We can walk back if problems with SVE appear.
Thanks,
Richard.
> PR tree-optimization/111721
>
> gcc/ChangeLog:
>
> * tree-vect-slp.cc (vect_get_and_check_slp_defs): Support SLP for dummy mask -1.
> * tree-vect-stmts.cc (vectorizable_load): Ditto.
>
> ---
> gcc/tree-vect-slp.cc | 5 ++---
> gcc/tree-vect-stmts.cc | 5 +++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
> index 43d742e3c92..6b8a7b628b6 100644
> --- a/gcc/tree-vect-slp.cc
> +++ b/gcc/tree-vect-slp.cc
> @@ -759,9 +759,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
> if ((dt == vect_constant_def
> || dt == vect_external_def)
> && !GET_MODE_SIZE (vinfo->vector_mode).is_constant ()
> - && (TREE_CODE (type) == BOOLEAN_TYPE
> - || !can_duplicate_and_interleave_p (vinfo, stmts.length (),
> - type)))
> + && TREE_CODE (type) != BOOLEAN_TYPE
> + && !can_duplicate_and_interleave_p (vinfo, stmts.length (), type))
> {
> if (dump_enabled_p ())
> dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
> diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
> index 6ce4868d3e1..8c92bd5d931 100644
> --- a/gcc/tree-vect-stmts.cc
> +++ b/gcc/tree-vect-stmts.cc
> @@ -9825,6 +9825,7 @@ vectorizable_load (vec_info *vinfo,
>
> tree mask = NULL_TREE, mask_vectype = NULL_TREE;
> int mask_index = -1;
> + slp_tree slp_op = NULL;
> if (gassign *assign = dyn_cast <gassign *> (stmt_info->stmt))
> {
> scalar_dest = gimple_assign_lhs (assign);
> @@ -9861,7 +9862,7 @@ vectorizable_load (vec_info *vinfo,
> mask_index = vect_slp_child_index_for_operand (call, mask_index);
> if (mask_index >= 0
> && !vect_check_scalar_mask (vinfo, stmt_info, slp_node, mask_index,
> - &mask, NULL, &mask_dt, &mask_vectype))
> + &mask, &slp_op, &mask_dt, &mask_vectype))
> return false;
> }
>
> @@ -10046,7 +10047,7 @@ vectorizable_load (vec_info *vinfo,
> {
> if (slp_node
> && mask
> - && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
> + && !vect_maybe_update_slp_op_vectype (slp_op,
> mask_vectype))
> {
> if (dump_enabled_p ())
>
Committed as passed the regression test of aarch64, thanks Richard.
Pan
-----Original Message-----
From: Richard Biener <rguenther@suse.de>
Sent: Friday, November 3, 2023 3:36 PM
To: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Cc: gcc-patches@gcc.gnu.org; richard.sandiford@arm.com
Subject: Re: [tree-optimization/111721 V2] VECT: Support SLP for MASK_LEN_GATHER_LOAD with dummy mask
On Fri, 3 Nov 2023, Juzhe-Zhong wrote:
> This patch fixes following FAILs for RVV:
> FAIL: gcc.dg/vect/vect-gather-1.c -flto -ffat-lto-objects scan-tree-dump vect "Loop contains only SLP stmts"
> FAIL: gcc.dg/vect/vect-gather-1.c scan-tree-dump vect "Loop contains only SLP stmts"
>
> Bootstrap on X86 and regtest passed.
>
> Ok for trunk ?
OK. We can walk back if problems with SVE appear.
Thanks,
Richard.
> PR tree-optimization/111721
>
> gcc/ChangeLog:
>
> * tree-vect-slp.cc (vect_get_and_check_slp_defs): Support SLP for dummy mask -1.
> * tree-vect-stmts.cc (vectorizable_load): Ditto.
>
> ---
> gcc/tree-vect-slp.cc | 5 ++---
> gcc/tree-vect-stmts.cc | 5 +++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
> index 43d742e3c92..6b8a7b628b6 100644
> --- a/gcc/tree-vect-slp.cc
> +++ b/gcc/tree-vect-slp.cc
> @@ -759,9 +759,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
> if ((dt == vect_constant_def
> || dt == vect_external_def)
> && !GET_MODE_SIZE (vinfo->vector_mode).is_constant ()
> - && (TREE_CODE (type) == BOOLEAN_TYPE
> - || !can_duplicate_and_interleave_p (vinfo, stmts.length (),
> - type)))
> + && TREE_CODE (type) != BOOLEAN_TYPE
> + && !can_duplicate_and_interleave_p (vinfo, stmts.length (), type))
> {
> if (dump_enabled_p ())
> dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
> diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
> index 6ce4868d3e1..8c92bd5d931 100644
> --- a/gcc/tree-vect-stmts.cc
> +++ b/gcc/tree-vect-stmts.cc
> @@ -9825,6 +9825,7 @@ vectorizable_load (vec_info *vinfo,
>
> tree mask = NULL_TREE, mask_vectype = NULL_TREE;
> int mask_index = -1;
> + slp_tree slp_op = NULL;
> if (gassign *assign = dyn_cast <gassign *> (stmt_info->stmt))
> {
> scalar_dest = gimple_assign_lhs (assign);
> @@ -9861,7 +9862,7 @@ vectorizable_load (vec_info *vinfo,
> mask_index = vect_slp_child_index_for_operand (call, mask_index);
> if (mask_index >= 0
> && !vect_check_scalar_mask (vinfo, stmt_info, slp_node, mask_index,
> - &mask, NULL, &mask_dt, &mask_vectype))
> + &mask, &slp_op, &mask_dt, &mask_vectype))
> return false;
> }
>
> @@ -10046,7 +10047,7 @@ vectorizable_load (vec_info *vinfo,
> {
> if (slp_node
> && mask
> - && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
> + && !vect_maybe_update_slp_op_vectype (slp_op,
> mask_vectype))
> {
> if (dump_enabled_p ())
>
@@ -759,9 +759,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
if ((dt == vect_constant_def
|| dt == vect_external_def)
&& !GET_MODE_SIZE (vinfo->vector_mode).is_constant ()
- && (TREE_CODE (type) == BOOLEAN_TYPE
- || !can_duplicate_and_interleave_p (vinfo, stmts.length (),
- type)))
+ && TREE_CODE (type) != BOOLEAN_TYPE
+ && !can_duplicate_and_interleave_p (vinfo, stmts.length (), type))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -9825,6 +9825,7 @@ vectorizable_load (vec_info *vinfo,
tree mask = NULL_TREE, mask_vectype = NULL_TREE;
int mask_index = -1;
+ slp_tree slp_op = NULL;
if (gassign *assign = dyn_cast <gassign *> (stmt_info->stmt))
{
scalar_dest = gimple_assign_lhs (assign);
@@ -9861,7 +9862,7 @@ vectorizable_load (vec_info *vinfo,
mask_index = vect_slp_child_index_for_operand (call, mask_index);
if (mask_index >= 0
&& !vect_check_scalar_mask (vinfo, stmt_info, slp_node, mask_index,
- &mask, NULL, &mask_dt, &mask_vectype))
+ &mask, &slp_op, &mask_dt, &mask_vectype))
return false;
}
@@ -10046,7 +10047,7 @@ vectorizable_load (vec_info *vinfo,
{
if (slp_node
&& mask
- && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+ && !vect_maybe_update_slp_op_vectype (slp_op,
mask_vectype))
{
if (dump_enabled_p ())