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 E8D203857C41 for ; Fri, 24 Jul 2020 21:18:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E8D203857C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@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 06OLIags009315; Fri, 24 Jul 2020 16:18:37 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 06OLIZVS009300; Fri, 24 Jul 2020 16:18:35 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 24 Jul 2020 16:18:34 -0500 From: Segher Boessenkool To: Andrea Corallo Cc: gcc-patches@gcc.gnu.org, nd@arm.com, Richard Earnshaw Subject: Re: [PATCH 1/2] Add new RTX instruction class FILLER_INSN Message-ID: <20200724211834.GS32057@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jul 2020 21:18:45 -0000 Hi Andrea, On Wed, Jul 22, 2020 at 12:02:33PM +0200, Andrea Corallo wrote: > This first patch implements the addition of a new RTX instruction class > FILLER_INSN, which has been white listed to allow placement of NOPs > outside of a basic block. This is to allow padding after unconditional > branches. This is favorable so that any performance gained from > diluting branches is not paid straight back via excessive eating of > nops. > It was deemed that a new RTX class was less invasive than modifying > behavior in regards to standard UNSPEC nops. So I wonder if this cannot be done with some kind of NOTE, instead? > + /* Allow nops after branches, via FILLER_INSN. */ > + bool fail = true; > + subrtx_iterator::array_type array; > + FOR_EACH_SUBRTX (iter, array, x, ALL) > + { > + const_rtx rtx = *iter; > + if (GET_CODE (rtx) == FILLER_INSN) > + { > + fail = false; > + break; > + } > + } > + if (fail) > + fatal_insn ("insn outside basic block", x); This stops checking after finding a FILLER_INSN as first insn. Is that on purpose? > +/* Make an insn of code FILLER_INSN to > + pad out the instruction stream. > + PATTERN should be from gen_filler_insn (). > + AFTER will typically be an unconditional > + branch at the end of a basic block. */ Because it only allows one particular insn pattern, it should be pretty easy to use a NOTE for this, or even a normal INSN where the ouside-of-BB test can then just look at its pattern. As you see, I really do not like to have another RTX class, without very well defined semantics even. Not without first being shown no alternatives are acceptable, anyway :-) Segher