]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add loop_vinfo argument to vect_get_loop_mask
authorRichard Biener <rguenther@suse.de>
Tue, 6 Jun 2023 14:14:33 +0000 (16:14 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 19 Jun 2023 07:28:46 +0000 (09:28 +0200)
This adds a loop_vinfo argument for future use, making the next
patch smaller.

* tree-vectorizer.h (vect_get_loop_mask): Add loop_vec_info
argument.
* tree-vect-loop.cc (vect_get_loop_mask): Likewise.
(vectorize_fold_left_reduction): Adjust.
(vect_transform_reduction): Likewise.
(vectorizable_live_operation): Likewise.
* tree-vect-stmts.cc (vectorizable_call): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vectorizable_condition): Likewise.

gcc/tree-vect-loop.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h

index ace9e759f5b2eee2bd8df3055fd4ca3f5de97506..cd0160a17c8a145ba3a2dbff0af64546a5b38afc 100644 (file)
@@ -6647,7 +6647,7 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo,
       gimple *new_stmt;
       tree mask = NULL_TREE;
       if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo))
-       mask = vect_get_loop_mask (gsi, masks, vec_num, vectype_in, i);
+       mask = vect_get_loop_mask (loop_vinfo, gsi, masks, vec_num, vectype_in, i);
 
       /* Handle MINUS by adding the negative.  */
       if (reduc_fn != IFN_LAST && code == MINUS_EXPR)
@@ -7960,8 +7960,8 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
              gcc_assert (commutative_binary_op_p (code, op.type));
              std::swap (vop[0], vop[1]);
            }
-         tree mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
-                                         vectype_in, i);
+         tree mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
+                                         vec_num * ncopies, vectype_in, i);
          gcall *call = gimple_build_call_internal (cond_fn, 4, mask,
                                                    vop[0], vop[1], vop[0]);
          new_temp = make_ssa_name (vec_dest, call);
@@ -7977,8 +7977,8 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
 
          if (masked_loop_p && mask_by_cond_expr)
            {
-             tree mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
-                                             vectype_in, i);
+             tree mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
+                                             vec_num * ncopies, vectype_in, i);
              build_vect_cond_expr (code, vop, mask, gsi);
            }
 
@@ -10085,7 +10085,8 @@ vectorizable_live_operation (vec_info *vinfo,
             the loop mask for the final iteration.  */
          gcc_assert (ncopies == 1 && !slp_node);
          tree scalar_type = TREE_TYPE (STMT_VINFO_VECTYPE (stmt_info));
-         tree mask = vect_get_loop_mask (gsi, &LOOP_VINFO_MASKS (loop_vinfo),
+         tree mask = vect_get_loop_mask (loop_vinfo, gsi,
+                                         &LOOP_VINFO_MASKS (loop_vinfo),
                                          1, vectype, 0);
          tree scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type,
                                          mask, vec_lhs_phi);
@@ -10369,7 +10370,8 @@ vect_record_loop_mask (loop_vec_info loop_vinfo, vec_loop_masks *masks,
    arrangement.  */
 
 tree
-vect_get_loop_mask (gimple_stmt_iterator *gsi, vec_loop_masks *masks,
+vect_get_loop_mask (loop_vec_info,
+                   gimple_stmt_iterator *gsi, vec_loop_masks *masks,
                    unsigned int nvectors, tree vectype, unsigned int index)
 {
   rgroup_controls *rgm = &(*masks)[nvectors - 1];
index a7acc032d47a2745fb65056269d1d66fb10e002d..47baf35227f996561b54fbd19573a3c4f2aefce7 100644 (file)
@@ -3692,7 +3692,8 @@ vectorizable_call (vec_info *vinfo,
                      unsigned int vec_num = vec_oprnds0.length ();
                      /* Always true for SLP.  */
                      gcc_assert (ncopies == 1);
-                     vargs[varg++] = vect_get_loop_mask (gsi, masks, vec_num,
+                     vargs[varg++] = vect_get_loop_mask (loop_vinfo,
+                                                         gsi, masks, vec_num,
                                                          vectype_out, i);
                    }
                  size_t k;
@@ -3733,7 +3734,8 @@ vectorizable_call (vec_info *vinfo,
                          unsigned int vec_num = vec_oprnds0.length ();
                          /* Always true for SLP.  */
                          gcc_assert (ncopies == 1);
-                         tree mask = vect_get_loop_mask (gsi, masks, vec_num,
+                         tree mask = vect_get_loop_mask (loop_vinfo,
+                                                         gsi, masks, vec_num,
                                                          vectype_out, i);
                          vargs[mask_opno] = prepare_vec_mask
                            (loop_vinfo, TREE_TYPE (mask), mask,
@@ -3758,7 +3760,7 @@ vectorizable_call (vec_info *vinfo,
 
          int varg = 0;
          if (masked_loop_p && reduc_idx >= 0)
-           vargs[varg++] = vect_get_loop_mask (gsi, masks, ncopies,
+           vargs[varg++] = vect_get_loop_mask (loop_vinfo, gsi, masks, ncopies,
                                                vectype_out, j);
          for (i = 0; i < nargs; i++)
            {
@@ -3777,7 +3779,7 @@ vectorizable_call (vec_info *vinfo,
 
          if (mask_opno >= 0 && masked_loop_p)
            {
-             tree mask = vect_get_loop_mask (gsi, masks, ncopies,
+             tree mask = vect_get_loop_mask (loop_vinfo, gsi, masks, ncopies,
                                              vectype_out, j);
              vargs[mask_opno]
                = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask,
@@ -6823,8 +6825,8 @@ vectorizable_operation (vec_info *vinfo,
        }
       else if (masked_loop_p && mask_out_inactive)
        {
-         tree mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
-                                         vectype, i);
+         tree mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
+                                         vec_num * ncopies, vectype, i);
          auto_vec<tree> vops (5);
          vops.quick_push (mask);
          vops.quick_push (vop0);
@@ -6865,8 +6867,8 @@ vectorizable_operation (vec_info *vinfo,
              if (loop_vinfo->scalar_cond_masked_set.contains ({ op0,
                                                                 ncopies}))
                {
-                 mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
-                                            vectype, i);
+                 mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
+                                            vec_num * ncopies, vectype, i);
 
                  vop0 = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask,
                                           vop0, gsi);
@@ -6875,8 +6877,8 @@ vectorizable_operation (vec_info *vinfo,
              if (loop_vinfo->scalar_cond_masked_set.contains ({ op1,
                                                                 ncopies }))
                {
-                 mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
-                                            vectype, i);
+                 mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
+                                            vec_num * ncopies, vectype, i);
 
                  vop1 = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask,
                                           vop1, gsi);
@@ -8760,8 +8762,8 @@ vectorizable_store (vec_info *vinfo,
 
          tree final_mask = NULL;
          if (loop_masks)
-           final_mask = vect_get_loop_mask (gsi, loop_masks, ncopies,
-                                            vectype, j);
+           final_mask = vect_get_loop_mask (loop_vinfo, gsi, loop_masks,
+                                            ncopies, vectype, j);
          if (vec_mask)
            final_mask = prepare_vec_mask (loop_vinfo, mask_vectype,
                                           final_mask, vec_mask, gsi);
@@ -8814,7 +8816,7 @@ vectorizable_store (vec_info *vinfo,
 
              tree final_mask = NULL_TREE;
              if (loop_masks)
-               final_mask = vect_get_loop_mask (gsi, loop_masks,
+               final_mask = vect_get_loop_mask (loop_vinfo, gsi, loop_masks,
                                                 vec_num * ncopies,
                                                 vectype, vec_num * j + i);
              if (vec_mask)
@@ -10133,8 +10135,8 @@ vectorizable_load (vec_info *vinfo,
 
          tree final_mask = NULL_TREE;
          if (loop_masks)
-           final_mask = vect_get_loop_mask (gsi, loop_masks, ncopies,
-                                            vectype, j);
+           final_mask = vect_get_loop_mask (loop_vinfo, gsi, loop_masks,
+                                            ncopies, vectype, j);
          if (vec_mask)
            final_mask = prepare_vec_mask (loop_vinfo, mask_vectype,
                                           final_mask, vec_mask, gsi);
@@ -10184,7 +10186,7 @@ vectorizable_load (vec_info *vinfo,
              tree final_mask = NULL_TREE;
              if (loop_masks
                  && memory_access_type != VMAT_INVARIANT)
-               final_mask = vect_get_loop_mask (gsi, loop_masks,
+               final_mask = vect_get_loop_mask (loop_vinfo, gsi, loop_masks,
                                                 vec_num * ncopies,
                                                 vectype, vec_num * j + i);
              if (vec_mask)
@@ -11208,7 +11210,7 @@ vectorizable_condition (vec_info *vinfo,
          if (masks)
            {
              tree loop_mask
-               = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
+               = vect_get_loop_mask (loop_vinfo, gsi, masks, vec_num * ncopies,
                                      vectype, i);
              tree tmp2 = make_ssa_name (vec_cmp_type);
              gassign *g
index af25d20bd7ec47949028edc5b087ec26bd9f85c3..767a0774d458d177742a256102a36e7a878deeac 100644 (file)
@@ -2302,7 +2302,8 @@ extern tree vect_halve_mask_nunits (tree, machine_mode);
 extern tree vect_double_mask_nunits (tree, machine_mode);
 extern void vect_record_loop_mask (loop_vec_info, vec_loop_masks *,
                                   unsigned int, tree, tree);
-extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *,
+extern tree vect_get_loop_mask (loop_vec_info, gimple_stmt_iterator *,
+                               vec_loop_masks *,
                                unsigned int, tree, unsigned int);
 extern void vect_record_loop_len (loop_vec_info, vec_loop_lens *, unsigned int,
                                  tree, unsigned int);