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 tree-optimization/96921] Failure to optimize combined boolean not patterns
Date: Tue, 14 Feb 2023 21:45:32 +0000	[thread overview]
Message-ID: <bug-96921-4-J9nOa06tGC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96921-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:a42ed1d9181d21d5cb02f131f641c0cf375eca9d

commit r13-5988-ga42ed1d9181d21d5cb02f131f641c0cf375eca9d
Author: Andrew Pinski <apinski@marvell.com>
Date:   Tue Jan 31 05:03:21 2023 +0000

    Simplify "1 - bool_val" to "bool_val ^ 1"

    For bool values, it is easier to deal with
    xor 1 rather than having 1 - a. This is because
    we are more likely to simplify the xor further in many
    cases.

    This is a special case for (MASK - b) where MASK
    is a powerof2 - 1 and b <= MASK but only for bool
    ranges ([0,1]) as that is the main case where the
    difference comes into play.

    Note this is enabled for gimple folding only
    as the ranges are only know while doing gimple
    folding and cfun is not always set when fold is called.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no
    regressions.

    gcc/ChangeLog:

            PR tree-optimization/108355
            PR tree-optimization/96921
            * match.pd: Add pattern for "1 - bool_val".

    gcc/testsuite/ChangeLog:

            PR tree-optimization/108355
            PR tree-optimization/96921
            * gcc.dg/tree-ssa/bool-minus-1.c: New test.
            * gcc.dg/tree-ssa/bool-minus-2.c: New test.
            * gcc.dg/tree-ssa/pr108354-1.c: New test.

  parent reply	other threads:[~2023-02-14 21:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 13:40 [Bug tree-optimization/96921] New: " gabravier at gmail dot com
2021-01-02 16:10 ` [Bug tree-optimization/96921] " jakub at gcc dot gnu.org
2021-07-28 20:31 ` pinskia at gcc dot gnu.org
2021-07-28 20:51 ` pinskia at gcc dot gnu.org
2021-07-28 21:20 ` pinskia at gcc dot gnu.org
2021-07-28 22:20 ` pinskia at gcc dot gnu.org
2021-07-28 22:25 ` pinskia at gcc dot gnu.org
2021-07-30 22:13 ` pinskia at gcc dot gnu.org
2021-08-03 23:17 ` pinskia at gcc dot gnu.org
2023-01-31  4:55 ` pinskia at gcc dot gnu.org
2023-02-14 21:45 ` cvs-commit at gcc dot gnu.org [this message]
2023-02-14 21:48 ` pinskia 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-96921-4-J9nOa06tGC@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).