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/91029] missed optimization regarding value of modulo operation
Date: Thu, 19 Nov 2020 23:03:04 +0000	[thread overview]
Message-ID: <bug-91029-4-aS5AcXLeT8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-91029-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r11-5186-gd3f293348768667c07770e433ff00af51fee73a2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Nov 20 00:02:21 2020 +0100

    ranger: Improve a % b operand ranges [PR91029]

    As mentioned in the PR, the previous PR91029 patch was testing
    op2 >= 0 which is unnecessary, even negative op2 values will work the same,
    furthermore, from if a % b > 0 we can deduce a > 0 rather than just a >= 0
    (0 % b would be 0), and it actually valid even for other constants than 0,
    a % b > 5 means a > 5 (a % b has the same sign as a and a in [0, 5] would
    result in a % b in [0, 5].  Also, we can deduce a range for the other
    operand, if we know
    a % b >= 20, then b must be (in absolute value for signed modulo) > 20,
    for a % [0, 20] the result would be [0, 19].

    2020-11-19  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/91029
            * range-op.cc (operator_trunc_mod::op1_range): Don't require signed
            types, nor require that op2 >= 0.  Implement (a % b) >= x && x > 0
            implies a >= x and (a % b) <= x && x < 0 implies a <= x.
            (operator_trunc_mod::op2_range): New method.

            * gcc.dg/tree-ssa/pr91029-1.c: New test.
            * gcc.dg/tree-ssa/pr91029-2.c: New test.

  parent reply	other threads:[~2020-11-19 23:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-91029-4@http.gcc.gnu.org/bugzilla/>
2020-11-17 22:01 ` cvs-commit at gcc dot gnu.org
2020-11-17 23:07 ` amacleod at redhat dot com
2020-11-18  0:50 ` bruno at clisp dot org
2020-11-18 21:17 ` cvs-commit at gcc dot gnu.org
2020-11-18 22:23 ` jakub at gcc dot gnu.org
2020-11-19  1:16 ` bruno at clisp dot org
2020-11-19 12:22 ` jakub at gcc dot gnu.org
2020-11-19 15:32 ` amacleod at redhat dot com
2020-11-19 19:55 ` jakub at gcc dot gnu.org
2020-11-19 23:03 ` cvs-commit at gcc dot gnu.org [this message]
2023-11-26 13:16 ` 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-91029-4-aS5AcXLeT8@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).