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 target/109973] [13/14 Regression] Wrong code for AVX2 since 13.1 by combining VPAND and VPTEST since r13-2006-ga56c1641e9d25e
Date: Tue, 30 May 2023 13:44:01 +0000	[thread overview]
Message-ID: <bug-109973-4-KGhrgSt3hN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109973-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 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:69185294f322dd53d4e1592115014c5488302e2e

commit r14-1405-g69185294f322dd53d4e1592115014c5488302e2e
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Tue May 30 14:40:50 2023 +0100

    PR target/107172: Avoid "unusual" MODE_CC comparisons in simplify-rtx.cc

    I believe that a better (or supplementary) fix to PR target/107172 is to
    avoid producing incorrect (but valid) RTL in
    simplify_const_relational_operation when presented with questionable
    (obviously invalid) expressions, such as those produced during combine.
    Just as with the "first do no harm" clause with the Hippocratic Oath,
    simplify-rtx (probably) shouldn't unintentionally transform invalid RTL
    expressions, into incorrect (non-equivalent) but valid RTL that may be
    inappropriately recognized by recog.

    In this specific case, many GCC backends represent their flags register via
    MODE_CC, whose representation is intentionally "opaque" to the middle-end.
    The only use of MODE_CC comprehensible to the middle-end's RTL optimizers
    is relational comparisons between the result of a COMPARE rtx (op0) and
zero
    (op1).  Any other uses of MODE_CC should be left alone, and some might
argue
    indicate representational issues in the backend.

    In practice, CPUs occasionally have numerous instructions that affect the
    flags register(s) other than comparisons [AVR's setc, powerpc's mtcrf,
    x86's clc, stc and cmc and x86_64's ptest that sets C and Z flags in
    non-obvious ways, c.f. PR target/109973].  Currently care has to be taken,
    wrapping these in UNSPEC, to avoid combine inappropriately merging flags
    setters with flags consumers (such as conditional jumps).  It's safer to
    teach simplify_const_relational_operation not to modify expressions that
    it doesn't understand/recognize.

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

    gcc/ChangeLog
            PR target/107172
            * simplify-rtx.cc (simplify_const_relational_operation): Return
            early if we have a MODE_CC comparison that isn't a COMPARE against
            const0_rtx.

  parent reply	other threads:[~2023-05-30 13:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  0:38 [Bug rtl-optimization/109973] New: Wrong code for AVX2 since 13.1 by combining VPAND and VPTEST benjsith at gmail dot com
2023-05-26  0:42 ` [Bug rtl-optimization/109973] " benjsith at gmail dot com
2023-05-26  0:47 ` [Bug target/109973] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-05-26  6:31 ` [Bug target/109973] [13/14 Regression] Wrong code for AVX2 since 13.1 by combining VPAND and VPTEST since r13-2006-ga56c1641e9d25e rguenth at gcc dot gnu.org
2023-05-26  6:56 ` jakub at gcc dot gnu.org
2023-05-26 12:06 ` benjsith at gmail dot com
2023-05-29 18:24 ` roger at nextmovesoftware dot com
2023-05-30 13:44 ` cvs-commit at gcc dot gnu.org [this message]
2023-06-01 14:12 ` cvs-commit at gcc dot gnu.org
2023-06-03 18:01 ` benjsith at gmail dot com
2023-06-04 11:01 ` cvs-commit at gcc dot gnu.org
2023-06-22  6:44 ` cvs-commit at gcc dot gnu.org
2023-07-03 13:28 ` [Bug target/109973] [13 " roger at nextmovesoftware dot com
2023-07-03 13:43 ` jakub at gcc dot gnu.org
2023-07-20  7:28 ` rguenth at gcc dot gnu.org

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-109973-4-KGhrgSt3hN@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).