]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
VECT: Support SLP for MASK_LEN_GATHER_LOAD with dummy mask
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Fri, 3 Nov 2023 06:41:13 +0000 (14:41 +0800)
committerPan Li <pan2.li@intel.com>
Fri, 3 Nov 2023 11:26:20 +0000 (19:26 +0800)
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
gcc/tree-vect-stmts.cc

index 43d742e3c92e766a14370cfd7d816a0d7f08a332..6b8a7b628b6985e0f725d9a0f64d969799478c97 100644 (file)
@@ -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,
index 799b4ab10c7fe124543a4fc0d1129a91d6f91c88..d374907095b53823888d2bc86280be13dbcf78d0 100644 (file)
@@ -9805,6 +9805,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);
@@ -9841,7 +9842,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;
     }
 
@@ -10026,7 +10027,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 ())