public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@sifive.com>
To: "juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	palmer <palmer@rivosinc.com>,  Robin Dapp <rdapp.gcc@gmail.com>,
	jeffreyalaw <jeffreyalaw@gmail.com>
Subject: Re: [PATCH] RISC-V: Support TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT to optimize codegen of RVV auto-vectorization
Date: Mon, 15 May 2023 10:38:51 +0800	[thread overview]
Message-ID: <CALLt3Tjrkq1Po-t2rm5CXLsOPKVts7pj-TqfhVsBaDQZWZPQXw@mail.gmail.com> (raw)
In-Reply-To: <9749BBE19D80DC01+2023051508355391896637@rivai.ai>

> diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> index de578b5b899..a5776a550b2 100644
> --- a/gcc/config/riscv/riscv.cc
> +++ b/gcc/config/riscv/riscv.cc
> @@ -7499,6 +7499,24 @@ riscv_preferred_simd_mode (scalar_mode mode)
>    return word_mode;
> }
> +/* Implement target hook TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT.  */
> +
> +static poly_uint64
> +riscv_vectorize_preferred_vector_alignment (const_tree type)
> +{
> +  if (riscv_v_ext_vector_mode_p (TYPE_MODE (type)))
> +    {
> +      /* If the length of the vector is a fixed power of 2, try to align
> + to that length, otherwise don't try to align at all.  */
> +      HOST_WIDE_INT result;
> +      if (!GET_MODE_BITSIZE (TYPE_MODE (type)).is_constant (&result)
> +   || !pow2p_hwi (result))
> + result = TYPE_ALIGN (TREE_TYPE (type));
> +      return result;

Why we block VLS here and then relaxed by different way in another patch?

  reply	other threads:[~2023-05-15  2:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13 11:44 juzhe.zhong
2023-05-15  0:35 ` juzhe.zhong
2023-05-15  2:38   ` Kito Cheng [this message]
2023-05-15  2:47     ` juzhe.zhong
2023-05-15  2:56       ` Kito Cheng
2023-05-15  3:17         ` juzhe.zhong
2023-05-15  7:19         ` Robin Dapp
2023-05-15  8:02           ` Kito Cheng
2023-05-15  8:10             ` juzhe.zhong
2023-05-15  8:58               ` Robin Dapp
2023-05-15 10:32                 ` juzhe.zhong

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=CALLt3Tjrkq1Po-t2rm5CXLsOPKVts7pj-TqfhVsBaDQZWZPQXw@mail.gmail.com \
    --to=kito.cheng@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=palmer@rivosinc.com \
    --cc=rdapp.gcc@gmail.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).