public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Bill Schmidt <wschmidt@linux.ibm.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Richard Sandiford <richard.sandiford@arm.com>,
	Jeff Law <jeffreyalaw@gmail.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH 01/11] gen: Emit error msg for empty split condition
Date: Wed, 2 Jun 2021 16:18:46 +0800	[thread overview]
Message-ID: <2dbff16b-4154-aaa8-af15-de577db9c8a3@linux.ibm.com> (raw)
In-Reply-To: <CAFiYyc1efw-gvdm4ZR0cVWnSRXwFT-W2kjSQMsapn-Vy-FSdvg@mail.gmail.com>

on 2021/6/2 下午3:43, Richard Biener wrote:
> On Wed, Jun 2, 2021 at 9:28 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>>
>> Hi Richi,
>>
>> on 2021/6/2 下午3:04, Richard Biener wrote:
>>> On Wed, Jun 2, 2021 at 7:05 AM Kewen Lin <linkw@linux.ibm.com> wrote:
>>>>
>>>> As Segher suggested, this patch is to emit the error message
>>>> if the split condition of define_insn_and_split is empty while
>>>> the insn condition isn't.
>>>
>>> I wonder whether it would be a good idea to automagically make
>>> the split condition "&& 1" via gensupport?
>>>
>>
>> Thanks for the comment!  Do you happen to have some similar examples?
> 
> Not sure, the docs say
> 
> @var{insn-pattern}, @var{condition}, @var{output-template}, and
> @var{insn-attributes} are used as in @code{define_insn}.
> ...
> The @var{split-condition} is also used as in
> @code{define_split}, with the additional behavior that if the condition starts
> with @samp{&&}, the condition used for the split will be the constructed as a
> logical ``and'' of the split condition with the insn condition.
> 
> so one can indeed read this as "" meaning 'true' w/o considering the
> define_insn condition.  

Yes, the "" in split condition does mean 'true' (always).

> But then we say
> 
> The @code{define_insn_and_split} construction provides exactly the same
> functionality as two separate @code{define_insn} and @code{define_split}
> patterns.  It exists for compactness, and as a maintenance tool to prevent
> having to ensure the two patterns' templates match.
> 
> But then when I split a define_insn_and_split with a "" split condition
> they are not functionally identical?  

Without this patch, they are indeed functionally identical.  It's like
the writer want to have one define_insn to match under some condition, but
want to have one define_split to match always.

> Also "" as split condition _does_
> seem valid, just maybe unintended?  

Yes, it's valid without this patch.  That's why I asked whether there is
some good reason to keep it be [1].  In Segher's opinion, there is no
good reason, he pointed out "A reader does not expect a
define_insn_and_split to split any other insns."

> How would one create a
> functionally equivalent example? "|| 1" will likely not work.
> 

I think "|| 1" works just like "" if people want the define_split to
split all the time, even with this patch.


> Note I'm not familiar with all the details here but the documentation
> does seem ambiguous at best, not supporting to error on empty
> split-conditions at least.
> 

Yes, the current patch will stop the "" condition which was accepted
before.  Thanks for bringing this up!  We have to update the
documentation if people reach a consensus.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2021-March/567014.html


BR,
Kewen

  reply	other threads:[~2021-06-02  8:19 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  5:04 [RFC/PATCH 00/11] Fix up some unexpected empty split conditions Kewen Lin
2021-06-02  5:04 ` [PATCH 01/11] gen: Emit error msg for empty split condition Kewen Lin
2021-06-02  7:04   ` Richard Biener
2021-06-02  7:27     ` Kewen.Lin
2021-06-02  7:43       ` Richard Biener
2021-06-02  8:18         ` Kewen.Lin [this message]
2021-06-02 23:35           ` Segher Boessenkool
2021-06-04 19:03   ` Martin Sebor
2021-06-04 19:37     ` Segher Boessenkool
2021-06-02  5:04 ` [PATCH 02/11] arc: Update unexpected " Kewen Lin
2021-06-02  6:52   ` Claudiu Zissulescu
2021-06-02  7:05     ` Kewen.Lin
2021-06-02  7:12       ` Claudiu Zissulescu
2021-06-02  7:43         ` [PATCH 02/11 v2] arc: Remove define_insn_and_split *bbit_di Kewen.Lin
2021-06-02  8:33           ` Claudiu Zissulescu
2021-06-02  5:04 ` [PATCH 03/11] arm: Update unexpected empty split condition Kewen Lin
2021-06-02  9:02   ` Kyrylo Tkachov
2021-06-02  5:04 ` [PATCH 04/11] cris: " Kewen Lin
2021-06-02 12:45   ` Hans-Peter Nilsson
2021-06-03  5:45     ` Kewen.Lin
2021-06-03 16:12       ` Hans-Peter Nilsson
2021-06-03 22:33         ` Hans-Peter Nilsson
2021-06-04  3:25         ` Kewen.Lin
2021-06-02  5:04 ` [PATCH 05/11] h8300: " Kewen Lin
2021-06-02 17:10   ` Jeff Law
2021-06-02  5:04 ` [PATCH 06/11] i386: " Kewen Lin
2021-06-02  6:28   ` Uros Bizjak
2021-06-02  5:04 ` [PATCH 07/11] m68k: " Kewen Lin
2021-06-02 17:08   ` Jeff Law
2021-06-02  5:04 ` [PATCH 08/11] mips: " Kewen Lin
2021-06-02 17:11   ` Jeff Law
2021-06-02  5:04 ` [PATCH 09/11] or1k: " Kewen Lin
2021-06-02  5:05 ` [PATCH 10/11] sh: " Kewen Lin
2021-06-02  5:17   ` Oleg Endo
2021-06-02  5:05 ` [PATCH 11/11] sparc: " Kewen Lin
2021-06-02  8:11 ` [RFC/PATCH 00/11] Fix up some unexpected empty split conditions Richard Sandiford
2021-06-02  8:37   ` Kewen.Lin
2021-06-02  9:13     ` Richard Sandiford
2021-06-02 10:01       ` Kewen.Lin
2021-06-02 10:12         ` Richard Biener
2021-06-02 17:32           ` Richard Sandiford
2021-06-02 18:25             ` Jeff Law
2021-06-02 23:52             ` Segher Boessenkool
2021-06-03  5:22               ` Kewen.Lin
2021-06-03  8:00                 ` Segher Boessenkool
2021-06-03  9:18                   ` Segher Boessenkool
2021-06-04  2:57                     ` Kewen.Lin
2021-06-07  7:12                       ` Richard Biener
2021-06-08  1:45                         ` Kewen.Lin
2021-06-07 23:50                       ` Segher Boessenkool
2021-06-08  2:09                         ` Kewen.Lin
2021-06-08  7:08                           ` Richard Biener
2021-06-08 12:30                             ` Segher Boessenkool
2021-06-08 12:50                               ` Richard Biener
2021-06-03 17:11                   ` Jeff Law
2021-06-03 22:19                     ` Segher Boessenkool
2021-06-03  8:05                 ` Richard Sandiford
2021-06-03 10:01                   ` Segher Boessenkool
2021-06-03 10:25                     ` Richard Sandiford
2021-06-03 21:25                       ` Segher Boessenkool
2021-06-03 21:34                         ` Jakub Jelinek
2021-06-04  3:33                   ` Kewen.Lin

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=2dbff16b-4154-aaa8-af15-de577db9c8a3@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).