public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] match.pd: Add new bitwise arithmetic pattern [PR98304]
Date: Sat, 9 Jul 2022 10:09:13 -0600	[thread overview]
Message-ID: <0f04131d-f4ea-2477-9429-81614edc2bbd@gmail.com> (raw)
In-Reply-To: <20220707135935.2249978-1-sfeifer@redhat.com>



On 7/7/2022 7:59 AM, Sam Feifer via Gcc-patches wrote:
> Hi!
>
> This patch is meant to solve a missed optimization in match.pd. It optimizes the following expression: n - (((n > 63) ? n : 63) & -64) where the constant being negated (in this case -64) is a power of 2 and the sum of the two constants is -1. For the signed case, this gets optimized to (n <= 63) ? n : (n & 63). For the unsigned case, it gets optimized to (n & 63). In both scenarios, the number of instructions produced decreases.
>
> There are also tests for this optimization making sure the optimization happens when it is supposed to, and does not happen when it isn't.
>
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
>
> 	PR tree-optimization/98304
>
> gcc/ChangeLog:
>
> 	* match.pd (n - (((n > C1) ? n : C1) & -C2)): New simplification.
>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.c-torture/execute/pr98304-2.c: New test.
> 	* gcc.dg/pr98304-1.c: New test.
OK.   I'm going to assume Red Hat's assignment covers you and/or you 
want to contribute under the DCO.    Going forward, if you're part of 
the tools team for Red Hat and expect to be contributing regularly, 
you'll probably want to get authenticated write access so that you can 
commit  approved changes (anyone on the team should be able to help with 
that).

I'll go ahead and push this one to the trunk.

Thanks,
Jeff


      reply	other threads:[~2022-07-09 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 13:59 Sam Feifer
2022-07-09 16:09 ` Jeff Law [this message]

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=0f04131d-f4ea-2477-9429-81614edc2bbd@gmail.com \
    --to=jeffreyalaw@gmail.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).