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 B9F0A386FC04 for ; Thu, 3 Jun 2021 09:19:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B9F0A386FC04 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail 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 1539IHAU021333; Thu, 3 Jun 2021 04:18:17 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 1539IG8s021332; Thu, 3 Jun 2021 04:18:16 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 3 Jun 2021 04:18:16 -0500 From: Segher Boessenkool To: "Kewen.Lin" Cc: Jakub Jelinek , richard.sandiford@arm.com, Bill Schmidt , GCC Patches Subject: Re: [RFC/PATCH 00/11] Fix up some unexpected empty split conditions Message-ID: <20210603091816.GT18427@gate.crashing.org> References: <0a03d10f-522d-cf22-6c66-4e0b9c5d042f@linux.ibm.com> <20210602235217.GN18427@gate.crashing.org> <96822c0f-0ff6-c1d4-99e7-47fc0e44b95c@linux.ibm.com> <20210603080044.GS18427@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210603080044.GS18427@gate.crashing.org> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=ham 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: Thu, 03 Jun 2021 09:19:23 -0000 On Thu, Jun 03, 2021 at 03:00:44AM -0500, Segher Boessenkool wrote: > On Thu, Jun 03, 2021 at 01:22:38PM +0800, Kewen.Lin wrote: > The whole point of requiring the split condition to start with && is so > it will become harder to mess things up (it will make the gen* code a > tiny little bit simpler as well). And there is no transition period or > anything like that needed either. Just the bunch that will break will > need fixing. So let's find out how many of those there are :-) > > > > How many such cases *are* there? There are no users exposed to this, > > > and when the split condition is required to start with "&&" (instead of > > > getting that implied) it is not a silent change ever, either. > > > > If I read the proposal right, the explicit "&&" is only required when going > > to find all potential problematic places for final implied "&&" change. > > But one explicit "&&" does offer good readability. > > My proposal is to always require && (or maybe identical insn and split > conditions should be allowed as well, if people still use that -- that > is how we wrote "&& 1" before that existed). I prototyped this. There are very many errors. Iterators often modify the insn condition (for one iteration of it), but that does not work if the split condition does not start with "&&"! See attached prototype. Segher = = = diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 2cb760ffb90f..05d46fd3775c 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -590,7 +590,6 @@ process_rtx (rtx desc, file_location loc) case DEFINE_INSN_AND_SPLIT: case DEFINE_INSN_AND_REWRITE: { - const char *split_cond; rtx split; rtvec attr; int i; @@ -611,15 +610,20 @@ process_rtx (rtx desc, file_location loc) /* If the split condition starts with "&&", append it to the insn condition to create the new split condition. */ - split_cond = XSTR (desc, 4); - if (split_cond[0] == '&' && split_cond[1] == '&') + const char *insn_cond = XSTR (desc, 2); + const char *split_cond = XSTR (desc, 4); + if (!strncmp (split_cond, "&&", 2)) { rtx_reader_ptr->copy_md_ptr_loc (split_cond + 2, split_cond); - split_cond = rtx_reader_ptr->join_c_conditions (XSTR (desc, 2), + split_cond = rtx_reader_ptr->join_c_conditions (insn_cond, split_cond + 2); + } else if (insn_cond[0]) { + if (GET_CODE (desc) == DEFINE_INSN_AND_REWRITE) + error_at (loc, "the rewrite condition must start with `&&'"); + else + error_at (loc, "the split condition must start with `&&' [%s]", insn_cond); } - else if (GET_CODE (desc) == DEFINE_INSN_AND_REWRITE) - error_at (loc, "the rewrite condition must start with `&&'"); + XSTR (split, 1) = split_cond; if (GET_CODE (desc) == DEFINE_INSN_AND_REWRITE) XVEC (split, 2) = gen_rewrite_sequence (XVEC (desc, 1));