public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org,  richard.guenther@gmail.com,
	 segher@kernel.crashing.org,  joseph@codesourcery.com,
	 krebbel@linux.ibm.com,  rdapp@linux.ibm.com
Subject: Re: [PATCH v3 3/9] Introduce can_vector_compare_p function
Date: Fri, 06 Sep 2019 12:58:00 -0000	[thread overview]
Message-ID: <mptef0tbmyh.fsf@arm.com> (raw)
In-Reply-To: <20190905111019.8951-4-iii@linux.ibm.com> (Ilya Leoshkevich's	message of "Thu, 5 Sep 2019 13:10:13 +0200")

Ilya Leoshkevich <iii@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

  reply	other threads:[~2019-09-06 12:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 11:10 [PATCH v3 0/9] S/390: Use signaling FP comparison instructions Ilya Leoshkevich
2019-09-05 11:10 ` [PATCH v3 1/9] Allow COND_EXPR and VEC_COND_EXPR condtions to trap Ilya Leoshkevich
2019-09-06 11:07   ` Richard Biener
2019-09-06 15:45     ` Ilya Leoshkevich
2019-09-09  8:43       ` Richard Biener
2019-09-05 11:11 ` [PATCH v3 4/9] S/390: Do not use signaling vector comparisons on z13 Ilya Leoshkevich
2019-09-06 10:34   ` Segher Boessenkool
2019-09-30 13:36     ` Ilya Leoshkevich
2019-10-01  0:24       ` Segher Boessenkool
2019-09-05 11:11 ` [PATCH v3 3/9] Introduce can_vector_compare_p function Ilya Leoshkevich
2019-09-06 12:58   ` Richard Sandiford [this message]
2019-09-05 11:11 ` [PATCH v3 2/9] Introduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_* Ilya Leoshkevich
2019-09-06 11:09   ` Richard Biener
2019-09-06 12:40   ` Richard Sandiford
2019-09-30 15:00     ` Ilya Leoshkevich
2019-09-05 11:11 ` [PATCH v3 5/9] S/390: Implement vcond expander for V1TI,V1TF Ilya Leoshkevich
2019-09-30 14:51   ` Andreas Krebbel
2019-09-05 11:11 ` [PATCH v3 6/9] S/390: Remove code duplication in vec_unordered<mode> Ilya Leoshkevich
2019-09-30 14:41   ` Andreas Krebbel
2019-09-05 11:12 ` [PATCH v3 8/9] S/390: Use signaling FP comparison instructions Ilya Leoshkevich
2019-09-05 11:12 ` [PATCH v3 7/9] S/390: Remove code duplication in vec_* comparison expanders Ilya Leoshkevich
2019-09-30 14:50   ` Andreas Krebbel
2019-09-05 11:12 ` [PATCH v3 9/9] S/390: Test signaling FP comparison instructions Ilya Leoshkevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mptef0tbmyh.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iii@linux.ibm.com \
    --cc=joseph@codesourcery.com \
    --cc=krebbel@linux.ibm.com \
    --cc=rdapp@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).