Ilya Leoshkevich <i...@linux.ibm.com> writes: > @@ -329,6 +332,34 @@ expand_vec_cmp_expr_p (tree value_type, tree mask_type, > enum tree_code code) > return false; > } > > +/* Return TRUE iff vcond_optab/vcondu_optab support the given tree > + comparison. */
Nit: better to use "true" rather than "TRUE" in modern comments; TRUE is a hold-over from C90 days. > + > +static bool > +vcond_icode_p (tree value_type, tree cmp_op_type, enum tree_code code) > +{ > + enum rtx_code rcode = get_rtx_code_safe (code, TYPE_UNSIGNED > (cmp_op_type)); > + if (rcode == LAST_AND_UNUSED_RTX_CODE) > + /* This may happen, for example, if code == SSA_NAME, in which case we > + cannot be certain whether a vector insn is available. */ > + return false; IMO expand_vec_cond_expr_p should exit early for SSA names before calling this function (but after checking get_vcond_mask_icode). Asserting for a comparison seems reasonable here. > diff --git a/gcc/optabs.c b/gcc/optabs.c > index cdd07f3e53f..479789570a9 100644 > --- a/gcc/optabs.c > +++ b/gcc/optabs.c > @@ -3819,6 +3819,30 @@ can_compare_p (enum rtx_code code, machine_mode mode, > return 0; > } > > +/* Return whether back-end can emit a vector comparison insn(s) using a > give> + CODE, with operands with CMP_OP_MODE, producing a result with > VALUE_MODE, > + in order to achieve a PURPOSE. */ Maybe: /* Return whether the backend can emit a vector comparison for code CODE, comparing operands of mode CMP_OP_MODE and producing a result with VALUE_MODE. */ > + > +bool > +can_vector_compare_p (enum rtx_code code, machine_mode value_mode, > + machine_mode cmp_op_mode, > + enum can_vector_compare_purpose purpose) I think we should leave out the purpose argument until it's needed. (Sorry if someone else said the opposite, can't remember now.) Maybe can_vcond_compare_p would be more consistent with the other function names in the patch. Thanks, Richard