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: Optimize __builtin_mul_overflow_p (x, cst, (utype)0) to x > ~(utype)0 / cst [PR30314]
Date: Wed, 1 Jun 2022 08:07:06 -0600	[thread overview]
Message-ID: <a5a091db-2a73-855a-6905-2a0f44b5e30b@gmail.com> (raw)
In-Reply-To: <Ypdv5qrjnk87DA8p@tucnak>



On 6/1/2022 7:55 AM, Jakub Jelinek via Gcc-patches wrote:
> Hi!
>
> A comparison with a constant is most likely always faster than
> .MUL_OVERFLOW from which we only check whether it overflowed and not the
> multiplication result, and even if not, it is simpler operation on GIMPLE
> and even if a target exists where such multiplications with overflow checking
> are cheaper than comparisons, because comparisons are so much more common
> than overflow checking multiplications, it would be nice if it simply
> arranged for comparisons to be emitted like those multiplications on its
> own...
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2022-06-01  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR middle-end/30314
> 	* match.pd (__builtin_mul_overflow_p (x, cst, (utype) 0) ->
> 	x > ~(utype)0 / cst): New simplification.
>
> 	* gcc.dg/tree-ssa/pr30314.c: New test.
OK
jeff


  reply	other threads:[~2022-06-01 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 13:55 Jakub Jelinek
2022-06-01 14:07 ` Jeff Law [this message]
2022-06-02  8:36 ` Richard Biener
2022-06-02  9:18   ` Jakub Jelinek
2022-06-02  9:58     ` Richard Biener

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=a5a091db-2a73-855a-6905-2a0f44b5e30b@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).