public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: juzhe.zhong@rivai.ai
Cc: rep.dot.nop@gmail.com, gcc-patches@gcc.gnu.org,
	rguenther@suse.de, richard.sandiford@arm.com
Subject: Re: [PATCH V5] VECT: Apply LEN_MASK_{LOAD,STORE} into vectorizer
Date: Thu, 22 Jun 2023 18:05:51 +0200	[thread overview]
Message-ID: <20230622180551.2bc62c61@nbbrfq.loc> (raw)
In-Reply-To: <20230622135348.160496-1-juzhe.zhong@rivai.ai>

On Thu, 22 Jun 2023 21:53:48 +0800
juzhe.zhong@rivai.ai wrote:

> +static bool
> +target_supports_mask_load_store_p (machine_mode mode, machine_mode mask_mode,
> +				   bool is_load, internal_fn *ifn)
> +{
> +  optab op = is_load ? maskload_optab : maskstore_optab;
> +  optab len_op = is_load ? len_maskload_optab : len_maskstore_optab;
> +  if (convert_optab_handler (op, mode, mask_mode) != CODE_FOR_nothing)
> +    {
> +      if (ifn)
> +	*ifn = is_load ? IFN_MASK_LOAD : IFN_MASK_STORE;
> +      return true;
> +    }
> +  else if (convert_optab_handler (len_op, mode, mask_mode) != CODE_FOR_nothing)
> +    {
> +      *ifn = is_load ? IFN_LEN_MASK_LOAD : IFN_LEN_MASK_STORE;

It feels inconsistent that you do not check ifn here.

> +      return true;
> +    }
> +  return false;
> +}

> +/* Return true if the target has support for len load/store.
> +   We can support len load/store by either len_{load,store}
> +   or len_mask{load,store}.
> +   This helper function checks whether target supports len
> +   load/store and return corresponding IFN in the last argument
> +   (IFN_LEN_{LOAD,STORE} or IFN_LEN_MASK_{LOAD,STORE}).  */
> +
> +static bool
> +target_supports_len_load_store_p (machine_mode mode, bool is_load,
> +				  internal_fn *ifn)
> +{
> +  optab op = is_load ? len_load_optab : len_store_optab;
> +  optab masked_op = is_load ? len_maskload_optab : len_maskstore_optab;
> +
> +  if (direct_optab_handler (op, mode))
> +    {
> +      if (ifn)
> +	*ifn = is_load ? IFN_LEN_LOAD : IFN_LEN_STORE;
> +      return true;
> +    }
> +  machine_mode mask_mode;
> +  if (targetm.vectorize.get_mask_mode (mode).exists (&mask_mode)
> +      && convert_optab_handler (masked_op, mode, mask_mode) != CODE_FOR_nothing)
> +    {
> +      if (ifn)
> +	*ifn = is_load ? IFN_LEN_MASK_LOAD : IFN_LEN_MASK_STORE;
> +      return true;
> +    }
> +  return false;
> +}
> +
>  /* If target supports vector load/store with length for vector mode MODE,
>     return the corresponding vector mode, otherwise return opt_machine_mode ().
>     There are two flavors for vector load/store with length, one is to measure
>     length with bytes, the other is to measure length with lanes.
>     As len_{load,store} optabs point out, for the flavor with bytes, we use
> -   VnQI to wrap the other supportable same size vector modes.  */
> +   VnQI to wrap the other supportable same size vector modes.
> +   An additional output in the last argumennt which is the IFN pointer.
> +   We set IFN as LEN_{LOAD,STORE} or LEN_MASK_{LOAD,STORE} according
> +   which optab is supported in the targe.  */

s/argumennt/argument/
s/targe\./target./

thanks,

  reply	other threads:[~2023-06-22 16:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 13:53 juzhe.zhong
2023-06-22 16:05 ` Bernhard Reutner-Fischer [this message]
2023-06-22 22:52   ` 钟居哲
2023-06-22 18:27 ` Richard Sandiford
2023-06-22 22:52   ` 钟居哲
2023-06-23  6:21 ` Richard Biener
2023-06-23  7:10   ` 钟居哲

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=20230622180551.2bc62c61@nbbrfq.loc \
    --to=rep.dot.nop@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=rguenther@suse.de \
    --cc=richard.sandiford@arm.com \
    /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).