public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/52254] New: VRP does not fold (~a) & N to a ^ N if a has range [0, N]
Date: Wed, 15 Feb 2012 00:21:00 -0000	[thread overview]
Message-ID: <bug-52254-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52254

             Bug #: 52254
           Summary: VRP does not fold (~a) & N to a ^ N if a has range [0,
                    N]
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


While working on moving fold-const.c bit expression optimizations to a SSA
based optimization, I found that if we optimize (a^N)&N to ~a & N, VRP does not
change that to just a ^ N.
Simple example:
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-vrp1" } */

int f(int x)
{
  if (x >= 0 && x <= 3)
    {
      x = (x ^ 3) & 3;
    }
  return x;
}

/* { dg-final { scan-tree-dump-times " & 3;" 0 "vrp1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */


             reply	other threads:[~2012-02-15  0:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15  0:21 pinskia at gcc dot gnu.org [this message]
2012-02-15  0:23 ` [Bug tree-optimization/52254] " pinskia at gcc dot gnu.org
2012-02-15 11:25 ` rguenth at gcc dot gnu.org
2012-02-16  3:05 ` pinskia at gcc dot gnu.org
2021-06-03  0:40 ` 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-52254-4@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).