public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/109840] [14 Regression] internal compiler error: in expand_fn_using_insn, at internal-fn.cc:153 when building graphite2
Date: Wed, 24 May 2023 16:36:53 +0000	[thread overview]
Message-ID: <bug-109840-4-cUoLXfMSDi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109840-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109840

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:

https://gcc.gnu.org/g:2738955004256c2e9753364d78a7be340323b74b

commit r14-1171-g2738955004256c2e9753364d78a7be340323b74b
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Wed May 24 17:32:20 2023 +0100

    PR middle-end/109840: Preserve popcount/parity type in match.pd.

    PR middle-end/109840 is a regression introduced by my recent patch to
    fold popcount(bswap(x)) as popcount(x).  When the bswap and the popcount
    have the same precision, everything works fine, but this optimization also
    allowed a zero-extension between the two.  The oversight is that we need
    to be strict with type conversions, both to avoid accidentally changing
    the argument type to popcount, and also to reflect the effects of
    argument/return-value promotion in the call to bswap, so this zero
extension
    needs to be preserved/explicit in the optimized form.

    Interestingly, match.pd should (in theory) be able to narrow calls to
    popcount and parity, removing a zero-extension from its argument, but
    that is an independent optimization, that needs to check IFN_ support.
    Many thanks to Andrew Pinski for his help/fixes with these transformations.

    2023-05-24  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR middle-end/109840
            * match.pd <popcount optimizations>: Preserve zero-extension when
            optimizing popcount((T)bswap(x)) and popcount((T)rotate(x,y)) as
            popcount((T)x), so the popcount's argument keeps the same type.
            <parity optimizations>:  Likewise preserve extensions when
            simplifying parity((T)bswap(x)) and parity((T)rotate(x,y)) as
            parity((T)x), so that the parity's argument type is the same.

    gcc/testsuite/ChangeLog
            PR middle-end/109840
            * gcc.dg/fold-parity-8.c: New test.
            * gcc.dg/fold-popcount-11.c: Likewise.

  parent reply	other threads:[~2023-05-24 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13  6:34 [Bug middle-end/109840] New: " sjames at gcc dot gnu.org
2023-05-13  6:35 ` [Bug middle-end/109840] " sjames at gcc dot gnu.org
2023-05-13  6:53 ` [Bug middle-end/109840] [14 Regression] " pinskia at gcc dot gnu.org
2023-05-13  7:01 ` pinskia at gcc dot gnu.org
2023-05-14 18:08 ` roger at nextmovesoftware dot com
2023-05-24 16:36 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-26 13:20 ` roger at nextmovesoftware dot com

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=bug-109840-4-cUoLXfMSDi@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).