From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 2222E3854561 for ; Mon, 28 Nov 2022 08:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2222E3854561 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-lf1-x135.google.com with SMTP id j4so16273006lfk.0 for ; Mon, 28 Nov 2022 00:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vXndsTa5aipABu5Gmtz+QpaTDJWgjAgVEpiDqEpkMag=; b=Azv3gC6LSTczAhaF0KkUEzxfW4DDk8FM207Vcv6OCngqkALp7cYsM1ACou9omkuYT4 /QTVqzaDEUuElT1PWjdVIwCn8ClA8aB+YeThrhwrjYccc+qvx3ErQvG3fc/XA49O49rg DunL47sOjvWN+NkVHsbzxk7d/AxfUnxkrUUfYT9KdLBjttFWbEgnjJCw+Qo49rlV3ojd Y4XvoD/vGzk6C5M5zmmbnK1BVIj1UJcQsKvDUO/kG3ojzCMc1Hpk7x/2+nToFcGvVsRH 0OjE2jJ4szzW8WCYRu8r1KojM140/pP9vtDcB9zQPzaIniiKqANEKqOcpnl7pEnkqjTV HfEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=vXndsTa5aipABu5Gmtz+QpaTDJWgjAgVEpiDqEpkMag=; b=HRBpfwF3L9S3CFVKR25xJN8ANSzVFbR7VRFRpimjjy44O8wCmJ4H5dK915nTzmyShY ixiTQRDQeWKkj2zYPI/Xs3iZG6sE4v+n0w4Wm7+8gye5xfSB/G2AccLxIhIAiPsibN3i hKsd5pigNHgV7UbwOZ51PUhZy1JY1HqtSbDpeY9UMf1Qfg+dI+HHEuWiHROB+Zy0xyYz 2lz0Bre2fdD5jorTAxI/lnZsy7oH9/ucqrwYZJrIBNCGfRx9WAfQqb5rHuXFIH2En2ad PbvGeZfILohLpSDeUwUlexGv/S0uKNvqJU9czMEJ7KpEBVw6AjWkhTPPEnwS6dlO8nXt RhtA== X-Gm-Message-State: ANoB5pm+3eSgBp6ApxV4P1Pouj3w8NkI0F8Foh33ReMxLAMeHtx6ankE UwsxIu5bbjjAe4cJLosrEKJ1oseZ73H437kx140= X-Google-Smtp-Source: AA0mqf5GEt1JJ2IPxQGFwKBM/mtcjQxRoRsX28ZViz8slmbwXRPTm3b/rk43sF+CY9ns5sQEYN1RZ4subPLGcR4sHfs= X-Received: by 2002:a05:6512:1287:b0:494:aca0:e5e5 with SMTP id u7-20020a056512128700b00494aca0e5e5mr16293032lfs.497.1669624937562; Mon, 28 Nov 2022 00:42:17 -0800 (PST) MIME-Version: 1.0 References: <4a052a62-7861-ed6f-9801-3b58ac384f81@linux.ibm.com> In-Reply-To: From: Richard Biener Date: Mon, 28 Nov 2022 09:42:05 +0100 Message-ID: Subject: Re: Ping [PATCH] Change the behavior of predicate check failure on cbranchcc4 operand0 in prepare_cmp_insn To: HAO CHEN GUI Cc: gcc-patches , Segher Boessenkool , David , Peter Bergner , "Kewen.Lin" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham 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 Mon, Nov 28, 2022 at 6:33 AM HAO CHEN GUI via Gcc-patches wrote: > > Hi, > Gentle ping this: > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607083.html > Thanks > Gui Haochen > > =E5=9C=A8 2022/11/23 10:54, HAO CHEN GUI =E5=86=99=E9=81=93: > > Hi, > > I want to enable "have_cbranchcc4" on rs6000. But not all combination= s of > > comparison codes and sub CC modes are benefited to generate cbranchcc4 = insns > > on rs6000. There is an predicate for operand0 of cbranchcc4 to bypass > > some combinations. It gets assertion failure in prepare_cmp_insn. I thi= nk > > we shouldn't suppose that all comparison codes and sub CC modes are sup= ported > > and throw an assertion failure in prepare_cmp_insn. It might check the > > predicate and go to fail if the predicate can't be satisfied. This patc= h > > changes the behavior of those codes. > > > > Bootstrapped and tested on powerpc64-linux BE/LE and x86 with no regr= essions. > > Is this okay for trunk? Any recommendations? Thanks a lot. Since the function seems to be allowed to fail the patch looks reasonable - still I wonder what the "fallback" for a MODE_CC style compare-and-branch is? There are callers of this function that do not seem to expect failure at least, some suspiciously looking like MODE_CC candiates. Richard. > > > > > > ChangeLog > > 2022-11-23 Haochen Gui > > > > gcc/ > > * optabs.cc (prepare_cmp_insn): Go to fail other than assert it w= hen > > predicate check of "cbranchcc4" operand[0] fails. > > > > patch.diff > > diff --git a/gcc/optabs.cc b/gcc/optabs.cc > > index 165f8d1fa22..3ec8f6b17ba 100644 > > --- a/gcc/optabs.cc > > +++ b/gcc/optabs.cc > > @@ -4484,8 +4484,9 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code com= parison, rtx size, > > { > > enum insn_code icode =3D optab_handler (cbranch_optab, CCmode); > > test =3D gen_rtx_fmt_ee (comparison, VOIDmode, x, y); > > - gcc_assert (icode !=3D CODE_FOR_nothing > > - && insn_operand_matches (icode, 0, test)); > > + gcc_assert (icode !=3D CODE_FOR_nothing); > > + if (!insn_operand_matches (icode, 0, test)) > > + goto fail; > > *ptest =3D test; > > return; > > }