As we want to transition to only vcond_mask expanders the following
makes it possible to easier distinguish queries that rely on
vcond queries for expand_vec_cond_expr_p from those of vcond_mask
by for the latter having the comparison code defaulted to ERROR_MARK.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        * optabs-tree.h (expand_vec_cond_expr_p): Default the
        comparison code to ERROR_MARK.
        * match.pd: Remove unneded expand_vec_cond_expr_p args.
        * tree-vect-generic.cc (expand_vector_condition): Likewise.
        * tree-vect-loop.cc (vect_reduction_update_partial_vector_usage):
        Likewise.
        * tree-vect-stmts.cc (vectorizable_simd_clone_call): Likewise.
        (scan_store_can_perm_p): Likewise.
        (vectorizable_condition): Likewise.
---
 gcc/match.pd             | 17 +++++++----------
 gcc/optabs-tree.h        |  2 +-
 gcc/tree-vect-generic.cc |  2 +-
 gcc/tree-vect-loop.cc    |  3 +--
 gcc/tree-vect-stmts.cc   |  7 +++----
 5 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 93536a39348..e622ccbd67c 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -411,7 +411,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        tree ones = build_all_ones_cst (vec_cmp_type);
       }
       (if (expand_vec_cmp_expr_p (vec_cmp_type, vec_truth_type, LT_EXPR)
-          && expand_vec_cond_expr_p (vec_cmp_type, vec_truth_type, LT_EXPR))
+          && expand_vec_cond_expr_p (vec_cmp_type, vec_truth_type))
        (view_convert:type (vec_cond (lt:vec_truth_type
                                     (view_convert:vec_cmp_type @0)
                                     { zeros; })
@@ -5805,13 +5805,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (if (VECTOR_TYPE_P (type)
        && (TREE_CODE_CLASS (op) != tcc_comparison
           || types_match (type, TREE_TYPE (@1))
-          || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)
+          || expand_vec_cond_expr_p (type, TREE_TYPE (@0))
           || (optimize_vectors_before_lowering_p ()
               /* The following is optimistic on the side of non-support, we are
                  missing the legacy vcond{,u,eq} cases.  Do this only when
                  lowering will be able to fixup..  */
-              && !expand_vec_cond_expr_p (TREE_TYPE (@1),
-                                          TREE_TYPE (@0), ERROR_MARK))))
+              && !expand_vec_cond_expr_p (TREE_TYPE (@1), TREE_TYPE (@0)))))
    (vec_cond @0 (op! @1 @3) (op! @2 @4))))
 
 /* (c ? a : b) op d  -->  c ? (a op d) : (b op d) */
@@ -5820,20 +5819,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (if (VECTOR_TYPE_P (type)
        && (TREE_CODE_CLASS (op) != tcc_comparison
           || types_match (type, TREE_TYPE (@1))
-          || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)
+          || expand_vec_cond_expr_p (type, TREE_TYPE (@0))
           || (optimize_vectors_before_lowering_p ()
-              && !expand_vec_cond_expr_p (TREE_TYPE (@1),
-                                          TREE_TYPE (@0), ERROR_MARK))))
+              && !expand_vec_cond_expr_p (TREE_TYPE (@1), TREE_TYPE (@0)))))
    (vec_cond @0 (op! @1 @3) (op! @2 @3))))
  (simplify
   (op @3 (vec_cond:s @0 @1 @2))
   (if (VECTOR_TYPE_P (type)
        && (TREE_CODE_CLASS (op) != tcc_comparison
           || types_match (type, TREE_TYPE (@1))
-          || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)
+          || expand_vec_cond_expr_p (type, TREE_TYPE (@0))
           || (optimize_vectors_before_lowering_p ()
-              && !expand_vec_cond_expr_p (TREE_TYPE (@1),
-                                          TREE_TYPE (@0), ERROR_MARK))))
+              && !expand_vec_cond_expr_p (TREE_TYPE (@1), TREE_TYPE (@0)))))
    (vec_cond @0 (op! @3 @1) (op! @3 @2)))))
 
 #if GIMPLE
diff --git a/gcc/optabs-tree.h b/gcc/optabs-tree.h
index f2b49991462..85805fd8296 100644
--- a/gcc/optabs-tree.h
+++ b/gcc/optabs-tree.h
@@ -43,7 +43,7 @@ supportable_half_widening_operation (enum tree_code, tree, 
tree,
 bool supportable_convert_operation (enum tree_code, tree, tree,
                                    enum tree_code *);
 bool expand_vec_cmp_expr_p (tree, tree, enum tree_code);
-bool expand_vec_cond_expr_p (tree, tree, enum tree_code);
+bool expand_vec_cond_expr_p (tree, tree, enum tree_code = ERROR_MARK);
 void init_tree_optimization_optabs (tree);
 bool target_supports_op_p (tree, enum tree_code,
                           enum optab_subtype = optab_default);
diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index f6f52569f43..ef7d2dd259d 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -1051,7 +1051,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi, 
bitmap dce_ssa_names)
      VEC_COND_EXPR could be supported individually.  See PR109176.  */
   if (a_is_comparison
       && VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a))
-      && expand_vec_cond_expr_p (type, TREE_TYPE (a), SSA_NAME)
+      && expand_vec_cond_expr_p (type, TREE_TYPE (a))
       && expand_vec_cmp_expr_p (TREE_TYPE (a1), TREE_TYPE (a), code))
     return true;
 
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 414f8360e51..b8e155b90f8 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7418,8 +7418,7 @@ vect_reduction_update_partial_vector_usage (loop_vec_info 
loop_vinfo,
     }
   else if (reduc_type == FOLD_LEFT_REDUCTION
           && reduc_fn == IFN_LAST
-          && !expand_vec_cond_expr_p (vectype_in, truth_type_for (vectype_in),
-                                      SSA_NAME))
+          && !expand_vec_cond_expr_p (vectype_in, truth_type_for (vectype_in)))
     {
       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 9f1449dfc25..396eea070a4 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -4292,7 +4292,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, 
stmt_vec_info stmt_info,
                  return false;
                }
              if (!expand_vec_cond_expr_p (clone_arg_vectype,
-                                          arginfo[i].vectype, ERROR_MARK))
+                                          arginfo[i].vectype))
                {
                  if (dump_enabled_p ())
                    dump_printf_loc (MSG_MISSED_OPTIMIZATION,
@@ -7425,7 +7425,7 @@ scan_store_can_perm_p (tree vectype, tree init,
                  || !initializer_zerop (init))
                {
                  tree masktype = truth_type_for (vectype);
-                 if (!expand_vec_cond_expr_p (vectype, masktype, VECTOR_CST))
+                 if (!expand_vec_cond_expr_p (vectype, masktype))
                    return -1;
                  whole_vector_shift_kind = scan_store_kind_lshift_cond;
                }
@@ -12432,8 +12432,7 @@ vectorizable_condition (vec_info *vinfo,
               && (masked
                   || (!expand_vec_cmp_expr_p (comp_vectype, vec_cmp_type,
                                               cond_code)
-                      || !expand_vec_cond_expr_p (vectype, vec_cmp_type,
-                                                  ERROR_MARK))))
+                      || !expand_vec_cond_expr_p (vectype, vec_cmp_type))))
        return false;
 
       if (slp_node
-- 
2.43.0

Reply via email to