public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "Li, Pan2" <pan2.li@intel.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	 "richard.sandiford@arm.com" <richard.sandiford@arm.com>,
	"juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>,
	 "kito.cheng@gmail.com" <kito.cheng@gmail.com>
Subject: Re: Vectorizer for types with different size
Date: Tue, 17 Oct 2023 10:23:06 +0200	[thread overview]
Message-ID: <CAFiYyc1pQEXEPja4MGGcA5Prc9zxFjtLX+w9CoEhMHViVsNLGQ@mail.gmail.com> (raw)
In-Reply-To: <MW5PR11MB59086C2B6193F6D88353D276A9D7A@MW5PR11MB5908.namprd11.prod.outlook.com>

On Mon, Oct 16, 2023 at 4:05 PM Li, Pan2 <pan2.li@intel.com> wrote:
>
> Hi Richard Biener,
>
> Recently I am try to enable the RISC-V auto-vec for the lrint family, which is trying to convert the HF/SF/DF to long type.
>
> Then I found the vectorizer can only act on the types with the same data size. For example, DF to DI (long in RV64) works
> well for standard pattern name lrintmn2 but fails on other combinations like SF to DI.
>
> However, according the legacy hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION may help to resolve the problem
> but I would like to learn if there is any plan that the middle-end would like to support the types with different size before we
> start to implement the hook.

I don't think using TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION would
help here?

It should be somewhat straightforward to support different vector size
when nunits_in == nunits_out, so
you could try just removing the restriction for that case in
vectorizable_call.  It's probably that the pre-selection
of vector types will make it so that this easy special case isn't ever
chosen though (I get WIDEN, but also
a matched vector size on x86).  The vectorizable_internal_function
selection then doesn't actually
check how the chosen vector types could be "split" - for both WIDEN
and NARROW we'd have to check
the associated vector types with the same number of lanes (obviously),
and either the input split
or the output composed then.

Richard.

>
> I also have a try for ARM for this, you can reference this link https://godbolt.org/z/o41hr9rY9.
>
> Thanks in advance and have a great day, ;)!
>
> Pan

  reply	other threads:[~2023-10-17  8:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 14:05 Li, Pan2
2023-10-17  8:23 ` Richard Biener [this message]
2023-10-17  8:33   ` Li, Pan2
2023-10-17 12:08     ` Li, Pan2

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=CAFiYyc1pQEXEPja4MGGcA5Prc9zxFjtLX+w9CoEhMHViVsNLGQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=pan2.li@intel.com \
    --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).