public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [0/9] [middle-end] Add param to vec_perm_const hook to specify mode of input operand
Date: Tue, 24 May 2022 10:20:40 +0100	[thread overview]
Message-ID: <mptr14jqobb.fsf@arm.com> (raw)
In-Reply-To: <CAAgBjMkv8oW_PK34=mAreBK319FY=r_7QC5anw1O=mFMRsUdNw@mail.gmail.com> (Prathamesh Kulkarni's message of "Tue, 24 May 2022 14:32:33 +0530")

Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> writes:
> diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
> index c5006afc00d..0a3c733ada9 100644
> --- a/gcc/doc/tm.texi
> +++ b/gcc/doc/tm.texi
> @@ -6088,14 +6088,18 @@ for the given scalar type @var{type}.  @var{is_packed} is false if the scalar
>  access using @var{type} is known to be naturally aligned.
>  @end deftypefn
>  
> -@deftypefn {Target Hook} bool TARGET_VECTORIZE_VEC_PERM_CONST (machine_mode @var{mode}, rtx @var{output}, rtx @var{in0}, rtx @var{in1}, const vec_perm_indices @var{&sel})
> +@deftypefn {Target Hook} bool TARGET_VECTORIZE_VEC_PERM_CONST (machine_mode @var{mode}, machine_mode @var{op_mode}, rtx @var{output}, rtx @var{in0}, rtx @var{in1}, const vec_perm_indices @var{&sel})
>  This hook is used to test whether the target can permute up to two
> -vectors of mode @var{mode} using the permutation vector @code{sel}, and
> -also to emit such a permutation.  In the former case @var{in0}, @var{in1}
> -and @var{out} are all null.  In the latter case @var{in0} and @var{in1} are
> -the source vectors and @var{out} is the destination vector; all three are
> -operands of mode @var{mode}.  @var{in1} is the same as @var{in0} if
> -@var{sel} describes a permutation on one vector instead of two.
> +vectors of mode @var{op_mode} using the permutation vector @code{sel},
> +producing a vector of mode @var{mode}.The hook is also used to emit such

Should be two spaces between “@var{mode}.” and “The”.

> +a permutation.
> +
> +When the hook is being used to test whether the target supports a permutation,
> +@var{in0}, @var{in1}, and @var{out} are all null.When the hook is being used

Same here: missing spaces before “When”.

> +to emit a permutation, @var{in0} and @var{in1} are the source vectors of mode
> +@var{op_mode} and @var{out} is the destination vector of mode @var{mode}.
> +@var{in1} is the same as @var{in0} if @var{sel} describes a permutation on one
> +vector instead of two.
>  
>  Return true if the operation is possible, emitting instructions for it
>  if rtxes are provided.
> diff --git a/gcc/match.pd b/gcc/match.pd
> index f5efa77560c..f2a527d9c42 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -7596,6 +7596,8 @@ and,
>   (with
>    {
>      tree op0 = @0, op1 = @1, op2 = @2;
> +    machine_mode result_mode = TYPE_MODE (type);
> +    machine_mode op_mode = TYPE_MODE (TREE_TYPE (op0));
>  
>      /* Build a vector of integers from the tree mask.  */
>      vec_perm_builder builder;
> @@ -7703,12 +7705,12 @@ and,
>  	       2-argument version.  */
>  	    tree oldop2 = op2;
>  	    if (sel.ninputs () == 2
> -	       || can_vec_perm_const_p (TYPE_MODE (type), sel, false))
> +	       || can_vec_perm_const_p (result_mode, op_mode, sel, false))
>  	      op2 = vec_perm_indices_to_tree (TREE_TYPE (op2), sel);
>  	    else
>  	      {
>  	        vec_perm_indices sel2 (builder, 2, nelts);
> -	        if (can_vec_perm_const_p (TYPE_MODE (type), sel2, false))
> +		if (can_vec_perm_const_p (result_mode, op_mode, sel2, false))
>  	          op2 = vec_perm_indices_to_tree (TREE_TYPE (op2), sel2);
>  	        else
>  	          /* Not directly supported with either encoding,

Please replace the use of TYPE_MODE here:

	/* See if the permutation is performing a single element
	   insert from a CONSTRUCTOR or constant and use a BIT_INSERT_EXPR
	   in that case.  But only if the vector mode is supported,
	   otherwise this is invalid GIMPLE.  */
        if (TYPE_MODE (type) != BLKmode

as well.

OK with those changes, thanks.

Richard

  reply	other threads:[~2022-05-24  9:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  7:06 Prathamesh Kulkarni
2022-05-18  9:38 ` Andre Vieira (lists)
2022-05-18 11:57 ` Richard Sandiford
2022-05-23  8:47   ` Prathamesh Kulkarni
2022-05-23 12:44     ` Richard Sandiford
2022-05-24  9:02       ` Prathamesh Kulkarni
2022-05-24  9:20         ` Richard Sandiford [this message]
2022-05-24 19:21           ` Prathamesh Kulkarni
2022-05-25 12:57             ` Richard Biener
2022-05-25 19:02               ` Prathamesh Kulkarni
2022-05-25 19:07                 ` Richard Biener
2022-05-25 20:23                   ` Prathamesh Kulkarni
2022-05-27 13:40                     ` Richard Biener
2022-05-30  8:15                       ` Richard Sandiford
2022-05-19 11:30 ` Richard Biener

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=mptr14jqobb.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=prathamesh.kulkarni@linaro.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).