From c57b2f88c93a00f4248b4e5da4de90d142967b4c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 15 Nov 2024 13:59:02 +0100 Subject: [PATCH] Remove unused vcond{,u,eq} expander infrastructure Now that we no longer exercise vcond{,u,eq} patterns remove unused infrastructure. * optabs-query.h (get_vcond_icode): Remove. (get_vcond_eq_icode): Likewise. * optabs-tree.h (expand_vec_cond_expr_p): Remove code argument. * optabs-tree.cc (expand_vec_cond_expr_p): Likewise. (vcond_icode_p): Remove. (vcond_eq_icode_p): Likewise. * optabs.h (can_vcond_compare_p): Remove. * optabs.cc (can_vcond_compare_p): Likewise. --- gcc/optabs-query.h | 23 ----------------------- gcc/optabs-tree.cc | 44 ++------------------------------------------ gcc/optabs-tree.h | 2 +- gcc/optabs.cc | 16 ---------------- gcc/optabs.h | 5 ----- 5 files changed, 3 insertions(+), 87 deletions(-) diff --git a/gcc/optabs-query.h b/gcc/optabs-query.h index 0cb2c21ba85..932ee361c7a 100644 --- a/gcc/optabs-query.h +++ b/gcc/optabs-query.h @@ -108,20 +108,6 @@ get_vec_cmp_eq_icode (machine_mode vmode, machine_mode mask_mode) return convert_optab_handler (vec_cmpeq_optab, vmode, mask_mode); } -/* Return insn code for a conditional operator with a comparison in - mode CMODE, unsigned if UNS is true, resulting in a value of mode VMODE. */ - -inline enum insn_code -get_vcond_icode (machine_mode vmode, machine_mode cmode, bool uns) -{ - enum insn_code icode = CODE_FOR_nothing; - if (uns) - icode = convert_optab_handler (vcondu_optab, vmode, cmode); - else - icode = convert_optab_handler (vcond_optab, vmode, cmode); - return icode; -} - /* Return insn code for a conditional operator with a mask mode MMODE resulting in a value of mode VMODE. */ @@ -131,15 +117,6 @@ get_vcond_mask_icode (machine_mode vmode, machine_mode mmode) return convert_optab_handler (vcond_mask_optab, vmode, mmode); } -/* Return insn code for a conditional operator with a comparison in - mode CMODE (only EQ/NE), resulting in a value of mode VMODE. */ - -inline enum insn_code -get_vcond_eq_icode (machine_mode vmode, machine_mode cmode) -{ - return convert_optab_handler (vcondeq_optab, vmode, cmode); -} - /* Enumerates the possible extraction_insn operations. */ enum extraction_pattern { EP_insv, EP_extv, EP_extzv }; diff --git a/gcc/optabs-tree.cc b/gcc/optabs-tree.cc index b69a5bc3676..f5ef6745756 100644 --- a/gcc/optabs-tree.cc +++ b/gcc/optabs-tree.cc @@ -446,59 +446,19 @@ expand_vec_cmp_expr_p (tree value_type, tree mask_type, enum tree_code code) || vec_cmp_eq_icode_p (value_type, mask_type, code); } -/* Return true iff vcond_optab/vcondu_optab can handle a vector - comparison for code CODE, comparing operands of type CMP_OP_TYPE and - producing a result of type VALUE_TYPE. */ - -static bool -vcond_icode_p (tree value_type, tree cmp_op_type, enum tree_code code) -{ - enum rtx_code rcode = get_rtx_code_1 (code, TYPE_UNSIGNED (cmp_op_type)); - if (rcode == UNKNOWN) - return false; - - return can_vcond_compare_p (rcode, TYPE_MODE (value_type), - TYPE_MODE (cmp_op_type)); -} - -/* Return true iff vcondeq_optab can handle a vector comparison for code CODE, - comparing operands of type CMP_OP_TYPE and producing a result of type - VALUE_TYPE. */ - -static bool -vcond_eq_icode_p (tree value_type, tree cmp_op_type, enum tree_code code) -{ - if (code != EQ_EXPR && code != NE_EXPR) - return false; - - return get_vcond_eq_icode (TYPE_MODE (value_type), TYPE_MODE (cmp_op_type)) - != CODE_FOR_nothing; -} - /* Return TRUE iff, appropriate vector insns are available for vector cond expr with vector type VALUE_TYPE and a comparison with operand vector types in CMP_OP_TYPE. */ bool -expand_vec_cond_expr_p (tree value_type, tree cmp_op_type, enum tree_code code) +expand_vec_cond_expr_p (tree value_type, tree cmp_op_type) { - machine_mode value_mode = TYPE_MODE (value_type); - machine_mode cmp_op_mode = TYPE_MODE (cmp_op_type); if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type) && get_vcond_mask_icode (TYPE_MODE (value_type), TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing) return true; - if (maybe_ne (GET_MODE_NUNITS (value_mode), GET_MODE_NUNITS (cmp_op_mode))) - return false; - - if (TREE_CODE_CLASS (code) != tcc_comparison) - /* This may happen, for example, if code == SSA_NAME, in which case we - cannot be certain whether a vector insn is available. */ - return false; - - return vcond_icode_p (value_type, cmp_op_type, code) - || vcond_eq_icode_p (value_type, cmp_op_type, code); + return false; } /* Use the current target and options to initialize diff --git a/gcc/optabs-tree.h b/gcc/optabs-tree.h index 85805fd8296..afd6fd57771 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 = ERROR_MARK); +bool expand_vec_cond_expr_p (tree, tree); void init_tree_optimization_optabs (tree); bool target_supports_op_p (tree, enum tree_code, enum optab_subtype = optab_default); diff --git a/gcc/optabs.cc b/gcc/optabs.cc index 03ef0c5d81d..fa51e498a98 100644 --- a/gcc/optabs.cc +++ b/gcc/optabs.cc @@ -4364,22 +4364,6 @@ can_vec_cmp_compare_p (enum rtx_code code, machine_mode value_mode, return insn_predicate_matches_p (icode, 1, code, mask_mode, value_mode); } -/* Return whether the backend can emit a vector comparison (vcond/vcondu) for - code CODE, comparing operands of mode CMP_OP_MODE and producing a result - with VALUE_MODE. */ - -bool -can_vcond_compare_p (enum rtx_code code, machine_mode value_mode, - machine_mode cmp_op_mode) -{ - enum insn_code icode - = get_vcond_icode (value_mode, cmp_op_mode, unsigned_optab_p (code)); - if (icode == CODE_FOR_nothing) - return false; - - return insn_predicate_matches_p (icode, 3, code, value_mode, cmp_op_mode); -} - /* Return whether the backend can emit vector set instructions for inserting element into vector at variable index position. */ diff --git a/gcc/optabs.h b/gcc/optabs.h index 86a60865217..a1dbaf8b56c 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -262,11 +262,6 @@ extern bool can_compare_p (enum rtx_code, machine_mode, with MASK_MODE. */ extern bool can_vec_cmp_compare_p (enum rtx_code, machine_mode, machine_mode); -/* Return whether the backend can emit a vector comparison (vcond/vcondu) for - code CODE, comparing operands of mode CMP_OP_MODE and producing a result - with VALUE_MODE. */ -extern bool can_vcond_compare_p (enum rtx_code, machine_mode, machine_mode); - /* Return whether the backend can emit vector set instructions for inserting element into vector at variable index position. */ extern bool can_vec_set_var_idx_p (machine_mode);