public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robin Dapp <rdapp.gcc@gmail.com>
To: "Robin Dapp via Gcc-patches" <gcc-patches@gcc.gnu.org>,
	钟居哲 <juzhe.zhong@rivai.ai>, "Jeff Law" <jeffreyalaw@gmail.com>,
	"kito.cheng" <kito.cheng@gmail.com>,
	"kito.cheng" <kito.cheng@sifive.com>, palmer <palmer@dabbelt.com>,
	palmer <palmer@rivosinc.com>,
	richard.sandiford@arm.com
Cc: rdapp.gcc@gmail.com
Subject: Re: [PATCH V3] RISC-V: Fix bug of pre-calculated const vector mask for VNx1BI, VNx2BI and VNx4BI
Date: Thu, 29 Jun 2023 11:09:17 +0200	[thread overview]
Message-ID: <f09db752-033f-b71e-15d3-0697a0ee964b@gmail.com> (raw)
In-Reply-To: <mptilb67ioc.fsf@arm.com>

> Yeah, that part is OK, and was the case I was thinking about when
> I said OK yesterday.  But now that we allow BITSIZE != PRECISION,
> it's possible for BITSIZE - PRECISION to be more than a full byte,
> in which case the new loop would not initialise every byte of
> the mode.

Ah, I see, so when e.g. BITSIZE == 16 and PRECISION == 1.  Luckily
this cannot happen with RVV as all we do is adjust the precision
of the modes that have BITSIZE == 8.  I'm going to add an assert.
Juzhe would rather work around that in the backend, though.

The other thing I just noticed is

tree
build_truth_vector_type_for_mode (poly_uint64 nunits, machine_mode mask_mode)
{
  gcc_assert (mask_mode != BLKmode);

  unsigned HOST_WIDE_INT esize;
  if (VECTOR_MODE_P (mask_mode))
    {
      poly_uint64 vsize = GET_MODE_BITSIZE (mask_mode);
      esize = vector_element_size (vsize, nunits);
    }
  else
    esize = 1;

  tree bool_type = build_nonstandard_boolean_type (esize);

  return make_vector_type (bool_type, nunits, mask_mode);
}

which gives us wrong precision as we rely on the BITSIZE here as well.
This results in a precision of 1 for VNx8BI, 2 for VNx4BI and 4 for
VNx2BI.

Maybe this isn't a problem per se but to me it appears
just wrong.

Regards
 Robin


  reply	other threads:[~2023-06-29  9:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28  9:47 Juzhe-Zhong
2023-06-28 18:11 ` Jeff Law
2023-06-28 19:02   ` 钟居哲
2023-06-28 19:12     ` Robin Dapp
2023-06-28 20:42       ` Richard Sandiford
2023-06-28 21:46         ` 钟居哲
2023-06-29  7:53         ` Richard Sandiford
2023-06-29  8:08           ` juzhe.zhong
2023-06-29  8:14           ` Robin Dapp
2023-06-29  8:18             ` juzhe.zhong
2023-06-29  8:53               ` Robin Dapp
2023-06-29  9:01                 ` juzhe.zhong
2023-06-29  8:54             ` Richard Sandiford
2023-06-29  9:09               ` Robin Dapp [this message]
2023-06-29  9:23                 ` juzhe.zhong
2023-06-29 11:22                 ` Richard Biener
2023-06-29 11:38                   ` Robin Dapp
2023-06-29 13:53                     ` Kito Cheng
2023-06-29 14:04                       ` Richard Sandiford
2023-06-29 14:12                         ` Robin Dapp
2023-07-04 19:07                           ` Robin Dapp

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=f09db752-033f-b71e-15d3-0697a0ee964b@gmail.com \
    --to=rdapp.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=palmer@rivosinc.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).