public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: 钟居哲 <juzhe.zhong@rivai.ai>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	 rdapp.gcc <rdapp.gcc@gmail.com>,  rguenther <rguenther@suse.de>
Subject: Re: [PATCH] internal-fn: Add VCOND_MASK_LEN.
Date: Wed, 25 Oct 2023 23:32:02 +0100	[thread overview]
Message-ID: <mpt1qdil4f1.fsf@arm.com> (raw)
In-Reply-To: <F89C3D1170BC0FD2+2023102606105599669998@rivai.ai> (=?utf-8?B?IumSn+WxheWTsiIncw==?= message of "Thu, 26 Oct 2023 06:10:56 +0800")

钟居哲 <juzhe.zhong@rivai.ai> writes:
>>> Which one is right?
> Hi, Richard. Let me explain this situation.
>
> Both situations are possible. It's depending on the 'ELSE' value whether it is unitialized value.
>
> For reduction case:
>
> for (int i = 0; i < n; i++)
>   result += a[i]
>
> The trailing elements should be well-defined, keep the original value. Otherwise, it will cause run-time issue.
>
> For integer DIV operation:
>
> for (int i = 0; i < n; i++)
>   a[i] = a[i] / b[i];
>
> The trailling elements are DON'T care (or undefined), I will use unitialized value in 'ELSE' value.
> Then later 'expand' stage will expand it into "clobber scratch" RTL.

OK, in that case it sounds like we're talking about PR110751.
The gimple semantics are that the COND_LEN operates on all lanes
of the mode (and the md.texi documentation should be fixed).
But if the else value is undefined, we can simplify:

  IFN_COND_LEN_IOR (mask, a, 0, undef, len, bias)

to "a".

That's not really a property of COND_LEN though.  The same thing
applies to plain IFN_COND_IOR.  If the fold reduces to a selection
between two values, and one of them is undefined, we can pick the other.

(Although we'd need to think a little carefully about that,
c.f. llvm's distinction between undef and poison.)

Thanks,
Richard

  reply	other threads:[~2023-10-25 22:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 22:10 钟居哲
2023-10-25 22:32 ` Richard Sandiford [this message]
2023-10-25 22:35   ` 钟居哲
2023-10-26  8:41     ` Robin Dapp
2023-10-26 14:02       ` Robin Dapp
2023-10-26 14:10         ` 钟居哲
2023-10-26 20:32           ` Robin Dapp
2023-11-02 13:35         ` Richard Biener
2023-11-02 13:48           ` Robin Dapp
2023-11-02 23:49             ` Richard Sandiford
2023-11-03  9:03               ` Robin Dapp
2023-11-03  9:11                 ` Richard Sandiford
2023-11-03 22:02                   ` Robin Dapp
2023-11-05 20:28                     ` Richard Sandiford
2023-11-06  7:22                       ` Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2023-09-08  9:01 [PATCH] gimple-match: Do not try UNCOND optimization with COND_LEN Robin Dapp
2023-09-11 20:35 ` Robin Dapp
2023-10-12 13:53   ` Richard Sandiford
2023-10-12 14:19     ` Richard Sandiford
2023-10-13 15:50       ` Robin Dapp
2023-10-16 21:59         ` Richard Sandiford
2023-10-17  8:47           ` Richard Biener
2023-10-17 11:39             ` Robin Dapp
2023-10-17 13:35               ` Richard Sandiford
2023-10-17 15:42                 ` Robin Dapp
2023-10-17 16:05                   ` Richard Sandiford
     [not found]                     ` <7e083b67-f283-4e9e-ba76-24e194fa1761@gmail.com>
     [not found]                       ` <mptttqmny4u.fsf@arm.com>
2023-10-23 16:09                         ` [PATCH] internal-fn: Add VCOND_MASK_LEN Robin Dapp
2023-10-24 21:50                           ` Richard Sandiford
2023-10-25 19:59                             ` Robin Dapp
2023-10-25 21:58                               ` Richard Sandiford

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=mpt1qdil4f1.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=rdapp.gcc@gmail.com \
    --cc=rguenther@suse.de \
    /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).