From: Jiufu Guo <guojiufu@linux.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, linkw@gcc.gnu.org,
bergner@linux.ibm.com, rguenther@suse.de,
richard.sandiford@arm.com, jeffreyalaw@gmail.com
Subject: Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie
Date: Fri, 16 Jun 2023 10:24:42 +0800 [thread overview]
Message-ID: <7nbkhg87px.fsf@ltcden2-lp1.aus.stglabs.ibm.com> (raw)
In-Reply-To: <20230615163023.GE19790@gate.crashing.org> (Segher Boessenkool's message of "Thu, 15 Jun 2023 11:30:24 -0500")
Hi,
Segher Boessenkool <segher@kernel.crashing.org> writes:
> On Thu, Jun 15, 2023 at 03:00:40PM +0800, Jiufu Guo wrote:
>> >> This is the existing pattern. It may be read as an action
>> >> to clean an unknown-size memory block.
>> >
>> > Including a size zero memory block, yes. BLKmode was originally to do
>> > things like bcopy (before modern names like memcpy were more usually
>> > used), and those very much need size zero as well.h
>>
>> The size is possible to be zero. No asm code needs to
>> be generated for "set 'const_int 0' to zero size memory"".
>> stack_tie does not generate any real code. It seems ok :)
>>
>> While, it may not be zero size mem. This may be a concern.
>> This is one reason that I would like to have an unspec_tie.
>
> It very much *can* be a zero size mem, that is perfectly find for
> mem:BLK.
There is still one concern: how to distinguish stack_tie
from other insn.
For example, below fake pattern:
(define_insn "xx_cleanmem"
[(parallel: [(set (mem:BLK (xxx)) (const_int 0))
(XXX/use "const_int_operand" "n")])]...
To avoid this pattern to be recognized as 'stack_tie',
'unspec_tie' was came to mind.
>
>> Another reason is unspec:blk is used but various ports :)
>
> unspec:BLK is undefined. BLKmode is allowed on mem only.
>
>> >> 2. "set (mem/c:BLK (reg/f:DI 1 1) unspec:blk (const_int 0 [0])
>> >> UNSPEC_TIE".
>> >> Current patch is using this one.
>> >
>> > What would be the semantics of that? Just the same as the current stuff
>> > I'd say, or less? It cannot be more!
>>
>> The semantic that I trying to achieve is "this is a special
>> insn, not only a normal set to unknown size mem".
>
> What does that *mean*? "Special instruction"? What would what code do
> for that? What would the RTL mean?
>
>> As you explained before on 'unspec:DI', the unspec would
>> just decorate the set_src part: something DI value with
>> machine-specific operation.
>
> An unspec is an operation on its operands, giving some (in this case)
> DImode value. There is nothing special about that operation, it can be
> optimised like any other, it's just not specified what exactly that
> value is (to the generic compiler, the backend itself can very much
> optimise stuff with it).
>
>> But, since 'tie_operand' is checked for this insn.
>> If 'tie_operand' checks UNPSEC_TIE, then the insn
>> with UNPSEC_TIE is 'a special insn'. Or interpret
>> the semantic of this insn as: this insn stack_ite
>> indicates "set/operate a zero size block".
>
> tie_operand is a predicate. The predicate of an insn has to return 1,
> or the insn is not recognised. You can do the same in insn conditions
> always (in principle anyway).
Thank you very much for your detailed and patient explanation!
BR,
Jeff (Jiufu Guo)
>
>
> Segher
next prev parent reply other threads:[~2023-06-16 2:24 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 12:23 Jiufu Guo
2023-06-13 12:48 ` Xi Ruoyao
2023-06-14 1:55 ` Jiufu Guo
2023-06-14 9:18 ` Xi Ruoyao
2023-06-14 15:05 ` Segher Boessenkool
2023-06-15 7:59 ` Jiufu Guo
2023-06-13 18:33 ` Segher Boessenkool
2023-06-14 4:06 ` Jiufu Guo
2023-06-14 7:59 ` Richard Biener
2023-06-14 9:04 ` Richard Sandiford
2023-06-14 9:22 ` Richard Biener
2023-06-14 9:43 ` Richard Sandiford
2023-06-14 9:52 ` Richard Biener
2023-06-14 10:02 ` Richard Sandiford
2023-06-14 16:08 ` Segher Boessenkool
2023-06-14 16:32 ` Segher Boessenkool
2023-06-14 9:29 ` Jiufu Guo
2023-06-14 16:38 ` Segher Boessenkool
2023-06-14 9:26 ` Jiufu Guo
2023-06-14 15:45 ` Segher Boessenkool
2023-06-14 15:38 ` Segher Boessenkool
2023-06-14 16:25 ` Richard Biener
2023-06-14 17:03 ` Segher Boessenkool
2023-06-14 15:15 ` Segher Boessenkool
2023-06-15 7:00 ` Jiufu Guo
2023-06-15 16:30 ` Segher Boessenkool
2023-06-16 2:24 ` Jiufu Guo [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-06-12 13:19 Jiufu Guo
2023-06-13 0:24 ` David Edelsohn
2023-06-13 2:15 ` Jiufu Guo
2023-06-13 18:14 ` Segher Boessenkool
2023-06-13 18:59 ` David Edelsohn
2023-06-14 3:00 ` Jiufu Guo
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=7nbkhg87px.fsf@ltcden2-lp1.aus.stglabs.ibm.com \
--to=guojiufu@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=linkw@gcc.gnu.org \
--cc=rguenther@suse.de \
--cc=richard.sandiford@arm.com \
--cc=segher@kernel.crashing.org \
/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).