From: Jeff Law <jeffreyalaw@gmail.com>
To: Andrew Pinski <apinski@marvell.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] Add match patterns for `a ? onezero : onezero` where one of the two operands are constant
Date: Tue, 6 Jun 2023 20:33:43 -0600 [thread overview]
Message-ID: <381f6cce-9229-0d83-2518-aac5564bc1c5@gmail.com> (raw)
In-Reply-To: <20230607001706.3000011-2-apinski@marvell.com>
On 6/6/23 18:17, Andrew Pinski via Gcc-patches wrote:
> This adds a match pattern that are for boolean values
> that optimizes `a ? onezero : 0` to `a & onezero` and
> `a ? 1 : onezero` to `a | onezero`.
>
> This was reported a few times and I thought I would finally
> add the match pattern for this.
>
> This hits a few times in GCC itself too.
>
> Notes on the testcases:
> * phi-opt-2.c: This now is optimized to `a & b` in phiopt rather than ifcombine
> * phi-opt-25b.c: The test part that was failing was parity which now gets `x & y` treatment.
> * ssa-thread-21.c: there is no longer a threading opportunity, so need to disable phiopt.
> Note PR 109957 is filed for the now missing optimization in that testcase too.
>
> gcc/ChangeLog:
>
> PR tree-optimization/89263
> PR tree-optimization/99069
> PR tree-optimization/20083
> PR tree-optimization/94898
> * match.pd: Add patterns to optimize `a ? onezero : onezero` with
> one of the operands are constant.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/tree-ssa/phi-opt-2.c: Adjust the testcase.
> * gcc.dg/tree-ssa/phi-opt-25b.c: Adjust the testcase.
> * gcc.dg/tree-ssa/ssa-thread-21.c: Disable phiopt.
> * gcc.dg/tree-ssa/phi-opt-27.c: New test.
> * gcc.dg/tree-ssa/phi-opt-28.c: New test.
> * gcc.dg/tree-ssa/phi-opt-29.c: New test.
> * gcc.dg/tree-ssa/phi-opt-30.c: New test.
> * gcc.dg/tree-ssa/phi-opt-31.c: New test.
> * gcc.dg/tree-ssa/phi-opt-32.c: New test.
OK.
tbird rendered the bool0^1 as bool0 to the first power, so I was briefly
confused before I realized what was going on.
jeff
next prev parent reply other threads:[~2023-06-07 2:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 0:17 [PATCH 1/2] Match: zero_one_valued_p should match 0 constants too Andrew Pinski
2023-06-07 0:17 ` [PATCH 2/2] Add match patterns for `a ? onezero : onezero` where one of the two operands are constant Andrew Pinski
2023-06-07 2:33 ` Jeff Law [this message]
2023-06-07 2:28 ` [PATCH 1/2] Match: zero_one_valued_p should match 0 constants too Jeff Law
2023-06-07 7:12 ` Jakub Jelinek
2023-06-07 13:03 ` Jeff Law
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=381f6cce-9229-0d83-2518-aac5564bc1c5@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@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).