From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 7BDED3857BA4; Thu, 15 Jun 2023 16:31:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7BDED3857BA4 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 35FGUOJI017381; Thu, 15 Jun 2023 11:30:24 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 35FGUOfx017380; Thu, 15 Jun 2023 11:30:24 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 15 Jun 2023 11:30:24 -0500 From: Segher Boessenkool To: Jiufu Guo 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 Message-ID: <20230615163023.GE19790@gate.crashing.org> References: <20230613122335.2108620-1-guojiufu@linux.ibm.com> <20230613183320.GU19790@gate.crashing.org> <7no7liadru.fsf@ltcden2-lp1.aus.stglabs.ibm.com> <20230614151533.GW19790@gate.crashing.org> <7nwn058b1j.fsf@ltcden2-lp1.aus.stglabs.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7nwn058b1j.fsf@ltcden2-lp1.aus.stglabs.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. > 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). Segher