From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 7A71D395A00D for ; Wed, 16 Nov 2022 13:00:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A71D395A00D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x630.google.com with SMTP id gv23so11148946ejb.3 for ; Wed, 16 Nov 2022 05:00:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uO6x2wxhPDJqMS0rIxUbxX7V5kefivNVAWJUtw4wOYw=; b=N34hAJDXdyW2CRQvw52UAsuLmhsB7/jhR5I8qdoUla1Gdo2jMofL5TaOYjRfYmdDlv QHN9vhdUQpSmpdWRjKo63yJQuzT7BHzRnrbCeqilGcAAJyMQwMD1WFh/VmDQtQO5ApcZ vwvrzI2XUosEFqNRA7E2cgr5dRayt0LhAKphBnNTnVw2NJlOL1P5jLQdJvkyKvTWlMbt oA4qGwnlNKQoy+Xc+lNbi2sqzhzy6HworL0bxm9Ul5R9M21UU9BLkxiVOh6CP0BJZtye H34KYaPl0kCCh82+05AMg/UyBaIxqCLCJX6IkTJmrvr4HabrX8j7V6erzQPTfqiwk2JI z6oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uO6x2wxhPDJqMS0rIxUbxX7V5kefivNVAWJUtw4wOYw=; b=liIdlx+1a7HzyCoKBEh+h6fI6bTTYW8szUXzVXombBCfEDtP9SIRX1SsoWg56d8YgW ZDSklKT2svAu/fWDFwnoE1/SKrYgXKWOxYtqQMgFImBZO0IG+QdEPPdalG/GA9NP0h6g 6jMb8qqRCJ/cEDf+IpXFJC+g8uaO3MQQxRutm9PUchdD5nLla5v+P/aKgHwxshQ93FEn vjJ+yqWJ4KS8swDQWAr3tUvSCRrmXPFnjHq8e2ImGD7tXlkJP3E5G5XdvM0zHPZv4lyd h5UKqTR/+QjclaVOarMjinitNtgYFi3H3a6UlV+VX4Dez+u672XW/KGUMcmCETD/XqFX DvpA== X-Gm-Message-State: ANoB5pkBWCdN+mHiet2oTAjpTNF/2AOCSbGIeKvzR3k1ilbmNL1iRLNl r2NNBhYgfkejin8KYITLr1jBflMT1M00oam13PY= X-Google-Smtp-Source: AA0mqf4l1iVMI0IcjbY5Ry0DmqPENS/T/Q738KgQv3VLDrLxXc+SiQEWOcBnuJ/9CqxeFIzbXEC3uREp9UmkGAorU1w= X-Received: by 2002:a17:906:4d95:b0:783:7020:53a7 with SMTP id s21-20020a1709064d9500b00783702053a7mr17135118eju.736.1668603601977; Wed, 16 Nov 2022 05:00:01 -0800 (PST) MIME-Version: 1.0 References: <153badc6-8afc-0695-32b2-ab5a9e0a161d@linux.ibm.com> <8bc4865a-b93f-92a2-c1b9-ac4f9d234c57@linux.ibm.com> In-Reply-To: <8bc4865a-b93f-92a2-c1b9-ac4f9d234c57@linux.ibm.com> From: David Edelsohn Date: Wed, 16 Nov 2022 07:59:22 -0500 Message-ID: Subject: Re: [rs6000, patch] Enable have_cbranchcc4 on rs6000 To: HAO CHEN GUI Cc: gcc-patches , Segher Boessenkool , "Kewen.Lin" , Peter Bergner Content-Type: multipart/alternative; boundary="000000000000f787fd05ed960c65" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: --000000000000f787fd05ed960c65 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hao cbranchcc4 is a named pattern and requires a specific operand ordering. If you change *cbranch to cbranchcc4, you must change the order of the operands, not a quick and dirty hack to *cbranch. Also, you should change *cbranch_2insn and *creturn as well so that all of the patterns are consistent. See for example the aarch64.md implementation. and the documentation in Standard Names https://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html which mentions cbranch4 and, briefly, cbranchcc4. You seemed to want to make the minimal change so that the pattern would work with ifcvt without considering the impact on the existing pattern and without understanding what a named pattern with specific operands really means. You changed the pattern predicate so that the operands in the wrong positions would match the pattern. Thanks, David On Wed, Nov 16, 2022 at 12:56 AM HAO CHEN GUI wrote: > Hi David, > I found definition of the operands in 'cbranch'. The argumnets matters. > I will create a new expand pattern for cbranchcc4. Thanks a lot for your > comments. > > 'cbranchmode4=E2=80=99 > Conditional branch instruction combined with a compare instruction. > Operand 0 is a comparison operator. Operand 1 and operand 2 are the > first and second operands of the comparison, respectively. Operand 3 > is the code_label to jump to. > > Gui Haochen > Thanks > > =E5=9C=A8 2022/11/16 11:04, David Edelsohn =E5=86=99=E9=81=93: > > It's great to add cbranchcc4 to the Power port where it definitely was > an omission, but adapting *cbranch for that purpose is the wrong approach. > The changes to the pattern are incorrect because they are covering up a > difference in ordering of the operands. One can argue that the named > pattern only enables the functionality in ifcvt and the pattern otherwise > is used in its previous role. But this is a Frankenstein monster > approach. You're trying to twist the existing pattern so that it triggers > as cbranchcc4, but creating a pattern that messes up its arguments and on= ly > works because the new, named pattern never is called. This is too ugly. > Please fix. > --000000000000f787fd05ed960c65--