Pass a vec_info to get_mask_type_for_scalar_type
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 21 Oct 2019 06:40:49 +0000 (06:40 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 21 Oct 2019 06:40:49 +0000 (06:40 +0000)
2019-10-21  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vectorizer.h (get_mask_type_for_scalar_type): Take a vec_info.
* tree-vect-stmts.c (get_mask_type_for_scalar_type): Likewise.
(vect_check_load_store_mask): Update call accordingly.
(vect_get_mask_type_for_stmt): Likewise.
* tree-vect-patterns.c (check_bool_pattern): Likewise.
(search_type_for_mask_1, vect_recog_mask_conversion_pattern): Likewise.
(vect_convert_mask_for_vectype): Likewise.

From-SVN: r277226

gcc/ChangeLog
gcc/tree-vect-patterns.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h

index d3cba28319076d711cf441591f4b395a4a6c7d97..bbb4710c99bb3fc34f2e20b8598e10661d996087 100644 (file)
@@ -1,3 +1,13 @@
+2019-10-21  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree-vectorizer.h (get_mask_type_for_scalar_type): Take a vec_info.
+       * tree-vect-stmts.c (get_mask_type_for_scalar_type): Likewise.
+       (vect_check_load_store_mask): Update call accordingly.
+       (vect_get_mask_type_for_stmt): Likewise.
+       * tree-vect-patterns.c (check_bool_pattern): Likewise.
+       (search_type_for_mask_1, vect_recog_mask_conversion_pattern): Likewise.
+       (vect_convert_mask_for_vectype): Likewise.
+
 2019-10-21  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-patterns.c (vect_supportable_direct_optab_p): Take
index b0b31636e3799dcccb4212ff093174a7db2d4c3f..1be4cc0a371b4099579c1f7e46dc4a1f032b1c7a 100644 (file)
@@ -3616,7 +3616,8 @@ check_bool_pattern (tree var, vec_info *vinfo, hash_set<gimple *> &stmts)
          if (comp_vectype == NULL_TREE)
            return false;
 
-         tree mask_type = get_mask_type_for_scalar_type (TREE_TYPE (rhs1));
+         tree mask_type = get_mask_type_for_scalar_type (vinfo,
+                                                         TREE_TYPE (rhs1));
          if (mask_type
              && expand_vec_cmp_expr_p (comp_vectype, mask_type, rhs_code))
            return false;
@@ -3943,7 +3944,7 @@ search_type_for_mask_1 (tree var, vec_info *vinfo,
              break;
            }
 
-         mask_type = get_mask_type_for_scalar_type (TREE_TYPE (rhs1));
+         mask_type = get_mask_type_for_scalar_type (vinfo, TREE_TYPE (rhs1));
          if (!mask_type
              || !expand_vec_cmp_expr_p (comp_vectype, mask_type, rhs_code))
            {
@@ -4275,7 +4276,7 @@ vect_recog_mask_conversion_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
       tree mask_arg_type = search_type_for_mask (mask_arg, vinfo);
       if (!mask_arg_type)
        return NULL;
-      vectype2 = get_mask_type_for_scalar_type (mask_arg_type);
+      vectype2 = get_mask_type_for_scalar_type (vinfo, mask_arg_type);
 
       if (!vectype1 || !vectype2
          || known_eq (TYPE_VECTOR_SUBPARTS (vectype1),
@@ -4352,7 +4353,7 @@ vect_recog_mask_conversion_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
       else
        return NULL;
 
-      vectype2 = get_mask_type_for_scalar_type (rhs1_type);
+      vectype2 = get_mask_type_for_scalar_type (vinfo, rhs1_type);
 
       if (!vectype1 || !vectype2)
        return NULL;
@@ -4442,14 +4443,14 @@ vect_recog_mask_conversion_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
 
   if (TYPE_PRECISION (rhs1_type) < TYPE_PRECISION (rhs2_type))
     {
-      vectype1 = get_mask_type_for_scalar_type (rhs1_type);
+      vectype1 = get_mask_type_for_scalar_type (vinfo, rhs1_type);
       if (!vectype1)
        return NULL;
       rhs2 = build_mask_conversion (rhs2, vectype1, stmt_vinfo);
     }
   else
     {
-      vectype1 = get_mask_type_for_scalar_type (rhs2_type);
+      vectype1 = get_mask_type_for_scalar_type (vinfo, rhs2_type);
       if (!vectype1)
        return NULL;
       rhs1 = build_mask_conversion (rhs1, vectype1, stmt_vinfo);
@@ -4520,7 +4521,7 @@ vect_convert_mask_for_vectype (tree mask, tree vectype,
   tree mask_type = search_type_for_mask (mask, vinfo);
   if (mask_type)
     {
-      tree mask_vectype = get_mask_type_for_scalar_type (mask_type);
+      tree mask_vectype = get_mask_type_for_scalar_type (vinfo, mask_type);
       if (mask_vectype
          && maybe_ne (TYPE_VECTOR_SUBPARTS (vectype),
                       TYPE_VECTOR_SUBPARTS (mask_vectype)))
index f76b5d4aac709e3b66515c263f05199cc9a6133d..d371820684691984d2567b390e222dd0856168c8 100644 (file)
@@ -2558,6 +2558,7 @@ vect_check_load_store_mask (stmt_vec_info stmt_info, tree mask,
                            vect_def_type *mask_dt_out,
                            tree *mask_vectype_out)
 {
+  vec_info *vinfo = stmt_info->vinfo;
   if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (mask)))
     {
       if (dump_enabled_p ())
@@ -2586,7 +2587,7 @@ vect_check_load_store_mask (stmt_vec_info stmt_info, tree mask,
 
   tree vectype = STMT_VINFO_VECTYPE (stmt_info);
   if (!mask_vectype)
-    mask_vectype = get_mask_type_for_scalar_type (TREE_TYPE (vectype));
+    mask_vectype = get_mask_type_for_scalar_type (vinfo, TREE_TYPE (vectype));
 
   if (!mask_vectype || !VECTOR_BOOLEAN_TYPE_P (mask_vectype))
     {
@@ -11156,7 +11157,7 @@ get_vectype_for_scalar_type (tree scalar_type)
    of vectors of specified SCALAR_TYPE as supported by target.  */
 
 tree
-get_mask_type_for_scalar_type (tree scalar_type)
+get_mask_type_for_scalar_type (vec_info *, tree scalar_type)
 {
   tree vectype = get_vectype_for_scalar_type (scalar_type);
 
@@ -11986,6 +11987,7 @@ vect_get_vector_types_for_stmt (stmt_vec_info stmt_info,
 opt_tree
 vect_get_mask_type_for_stmt (stmt_vec_info stmt_info)
 {
+  vec_info *vinfo = stmt_info->vinfo;
   gimple *stmt = stmt_info->stmt;
   tree mask_type = NULL;
   tree vectype, scalar_type;
@@ -11995,7 +11997,7 @@ vect_get_mask_type_for_stmt (stmt_vec_info stmt_info)
       && !VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt))))
     {
       scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
-      mask_type = get_mask_type_for_scalar_type (scalar_type);
+      mask_type = get_mask_type_for_scalar_type (vinfo, scalar_type);
 
       if (!mask_type)
        return opt_tree::failure_at (stmt,
index e1016d875f7266687d322b5bf078c76319a44e19..2dd9ea3d9e29a91b0f63208d3db15ebe64b073e7 100644 (file)
@@ -1591,7 +1591,7 @@ extern bool vect_can_advance_ivs_p (loop_vec_info);
 extern poly_uint64 current_vector_size;
 extern tree get_vectype_for_scalar_type (tree);
 extern tree get_vectype_for_scalar_type_and_size (tree, poly_uint64);
-extern tree get_mask_type_for_scalar_type (tree);
+extern tree get_mask_type_for_scalar_type (vec_info *, tree);
 extern tree get_same_sized_vectype (tree, tree);
 extern bool vect_get_loop_mask_type (loop_vec_info);
 extern bool vect_is_simple_use (tree, vec_info *, enum vect_def_type *,