public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH] SSCV: Add LEN_MASK_STORE into SCCVN
Date: Mon, 26 Jun 2023 08:11:43 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2306260809490.4723@jbgna.fhfr.qr> (raw)
In-Reply-To: <20230626023735.1013441-1-juzhe.zhong@rivai.ai>

On Mon, 26 Jun 2023, juzhe.zhong@rivai.ai wrote:

> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
> 
> Hi, this patch is to add LEN_MASK_STORE into SCCVN.
> 
> LEN_MASK_STORE is predicated by both len and mask together.
> My understanding is that LEN_MASK_STORE has same rhs_off and offset as MASK_STORE.
> The size = MIN (length (deduced from mask), (len + bias)).
> 
> Not sure my understanding it correct or no. 
> Hope experts (both Richard && Richi) can correct me if I am wrong.
> 
> Thanks.
> 
> gcc/ChangeLog:
> 
>         * tree-ssa-sccvn.cc (vn_reference_lookup_3): Add LEN_MASK_STORE.
> 
> ---
>  gcc/tree-ssa-sccvn.cc | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
> index 11061a374a2..d1629800705 100644
> --- a/gcc/tree-ssa-sccvn.cc
> +++ b/gcc/tree-ssa-sccvn.cc
> @@ -3304,6 +3304,16 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
>  	  if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
>  	    return (void *)-1;
>  	  break;
> +	case IFN_LEN_MASK_STORE:
> +	  len = gimple_call_arg (call, 2);
> +	  bias = gimple_call_arg (call, 5);
> +	  if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
> +	    return (void *)-1;
> +	  mask = gimple_call_arg (call, internal_fn_mask_index (fn));
> +	  mask = vn_valueize (mask);
> +	  if (TREE_CODE (mask) != VECTOR_CST)
> +	    return (void *)-1;
> +	  break;
>  	default:
>  	  return (void *)-1;
>  	}
> @@ -3379,6 +3389,13 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
>  		      pd.rhs_off = start;
>  		      pd.offset = offset2i + start;
>  		      pd.size = length;
> +		      if (fn == IFN_LEN_MASK_STORE)

can you use if (len != 0) here?

> +			{
> +			  HOST_WIDE_INT len_bitsize
> +			    = (tree_to_uhwi (len) + tree_to_shwi (bias))
> +			      * BITS_PER_UNIT;
> +			  pd.size = length > len_bitsize ? length : len_bitsize;
> +			}
>  		      if (ranges_known_overlap_p (offset, maxsize,
>  						  pd.offset, pd.size))
>  			return data->push_partial_def (pd, set, set,

the code continues with

                      mask_idx++;
                    }
                  while (known_lt (mask_idx, TYPE_VECTOR_SUBPARTS 
(vectype)));

it might be nicer to store TYPE_VECTOR_SUBPARTS in a variable and
trim that on 'len' instead?

Thanks,
Richard.

      reply	other threads:[~2023-06-26  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  2:37 juzhe.zhong
2023-06-26  8:11 ` Richard Biener [this message]

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=nycvar.YFH.7.77.849.2306260809490.4723@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --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).