public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: juzhe.zhong@rivai.ai
Cc: gcc-patches@gcc.gnu.org, palmer@dabbelt.com, jeffreyalaw@gmail.com
Subject: Re: [PATCH V4] RISC-V: Using merge approach to optimize repeating sequence in vec_init
Date: Sat, 13 May 2023 00:16:53 +0800	[thread overview]
Message-ID: <CA+yXCZAWmGTOF9t1YbaZbv6miBAcukL-V5Y1YnzQn3Hkk9k47g@mail.gmail.com> (raw)
In-Reply-To: <20230512154655.613780-1-juzhe.zhong@rivai.ai>

> +/* Get the mask for merge approach.
> +
> +     Consider such following case:
> +       {a, b, a, b, a, b, a, b, a, b, a, b, a, b, a, b}
> +     To merge "a", the mask should be 1010....
> +     To merge "b", the mask should be 0101....
> +*/
> +rtx
> +rvv_builder::get_merge_mask_bitfield (unsigned int index) const
> +{
> +  uint64_t base_mask = (1ULL << index);
> +  uint64_t mask = 0;
> +  for (unsigned int i = 0; i < (64 / npatterns ()); i++)

What the magic 64 means?
...

> +static void
> +expand_vector_init_merge_repeating_sequence (rtx target,
> +                                            const rvv_builder &builder)
> +{
> +  machine_mode mask_mode;
> +  gcc_assert (get_mask_mode (builder.mode ()).exists (&mask_mode));
> +
> +  machine_mode dup_mode = builder.mode ();
> +  if (known_gt (GET_MODE_SIZE (dup_mode), BYTES_PER_RISCV_VECTOR))
> +    {
> +      poly_uint64 nunits
> +       = exact_div (BYTES_PER_RISCV_VECTOR, builder.inner_units ());
> +      gcc_assert (
> +       get_vector_mode (builder.inner_int_mode (), nunits).exists (&dup_mode));

gcc_assert will removed at release mode, so it's not you want I guess?

> +    }
> +  else
> +    {
> +      if (FLOAT_MODE_P (dup_mode))
> +       gcc_assert (get_vector_mode (builder.inner_int_mode (),
> +                                    GET_MODE_NUNITS (dup_mode))
> +                     .exists (&dup_mode));

Same issue

> +    }
> +
> +  machine_mode dup_mask_mode;
> +  gcc_assert (get_mask_mode (dup_mode).exists (&dup_mask_mode));

Same issue

  reply	other threads:[~2023-05-12 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 15:46 juzhe.zhong
2023-05-12 16:16 ` Kito Cheng [this message]
2023-05-12 22:51   ` 钟居哲
2023-05-13  0:21   ` 钟居哲

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=CA+yXCZAWmGTOF9t1YbaZbv6miBAcukL-V5Y1YnzQn3Hkk9k47g@mail.gmail.com \
    --to=kito.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=palmer@dabbelt.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).