From: Richard Biener <rguenther@suse.de>
To: Jiufu Guo <guojiufu@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org, segher@kernel.crashing.org,
dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com,
richard.sandiford@arm.com, jeffreyalaw@gmail.com
Subject: Re: [PATCH] Check SCALAR_INT_MODE_P in try_const_anchors
Date: Fri, 16 Jun 2023 08:46:00 +0000 (UTC) [thread overview]
Message-ID: <nycvar.YFH.7.77.849.2306160845530.4723@jbgna.fhfr.qr> (raw)
In-Reply-To: <20230616081455.1697928-1-guojiufu@linux.ibm.com>
On Fri, 16 Jun 2023, Jiufu Guo wrote:
> Hi,
>
> The const_anchor in cse.cc supports integer constants only.
> There is a "gcc_assert (SCALAR_INT_MODE_P (mode))" in
> try_const_anchors.
>
> In the latest code, some non-integer modes are used with const int.
> For examples:
> "set (mem/c:BLK (xx) (const_int 0 [0])" occur in md files of
> rs6000, i386, arm, and pa. For this, the mode may be BLKmode.
> Pattern "(set (strict_low_part (xx)) (const_int xx))" could
> be generated in a few ports. For this, the mode may be VOIDmode.
>
> So, avoid mode other than SCALAR_INT_MODE in try_const_anchors
> would be needed.
>
> Some discussions in the previous thread:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621097.html
>
> Bootstrap ®test pass on ppc64{,le} and x86_64.
> Is this ok for trunk?
OK.
Richard.
>
> BR,
> Jeff (Jiufu Guo)
>
> gcc/ChangeLog:
>
> * cse.cc (try_const_anchors): Check SCALAR_INT_MODE.
>
> ---
> gcc/cse.cc | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/cse.cc b/gcc/cse.cc
> index 2bb63ac4105..ddb76fd281d 100644
> --- a/gcc/cse.cc
> +++ b/gcc/cse.cc
> @@ -1312,11 +1312,10 @@ try_const_anchors (rtx src_const, machine_mode mode)
> rtx lower_exp = NULL_RTX, upper_exp = NULL_RTX;
> unsigned lower_old, upper_old;
>
> - /* CONST_INT is used for CC modes, but we should leave those alone. */
> - if (GET_MODE_CLASS (mode) == MODE_CC)
> + /* CONST_INT may be in various modes, avoid non-scalar-int mode. */
> + if (!SCALAR_INT_MODE_P (mode))
> return NULL_RTX;
>
> - gcc_assert (SCALAR_INT_MODE_P (mode));
> if (!compute_const_anchors (src_const, &lower_base, &lower_offs,
> &upper_base, &upper_offs))
> return NULL_RTX;
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)
next prev parent reply other threads:[~2023-06-16 8:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 8:14 Jiufu Guo
2023-06-16 8:46 ` Richard Biener [this message]
2023-06-19 2:49 ` Jiufu Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.YFH.7.77.849.2306160845530.4723@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=guojiufu@linux.ibm.com \
--cc=jeffreyalaw@gmail.com \
--cc=linkw@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).