public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rask at sygehus dot dk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/21137] Convert (a >> 2) & 1 != 0 into a & 4 != 0
Date: Tue, 24 Jul 2007 14:57:00 -0000	[thread overview]
Message-ID: <20070724145654.1721.qmail@sourceware.org> (raw)
In-Reply-To: <bug-21137-5009@http.gcc.gnu.org/bugzilla/>



------- Comment #9 from rask at sygehus dot dk  2007-07-24 14:56 -------
This is not fully fixed yet. Compile these two functions with -O2
-fdump-tree-original:

void test5_1(int e)
{
  if ((e >> 31) & 64)
    foo();
}

typedef int myint;

void test5_2(myint e)
{
  if ((e >> 31) & 64)
    foo();
}

On x86_64-unknown-linux-gnu, I get (4.2.0, 4.2.1 and mainline):

;; Function test5_1 (test5_1)
;; enabled by -tree-original


{
  if (e < 0)
    {
      foo ();
    }
}



;; Function test5_2 (test5_2)
;; enabled by -tree-original

{
  if (((int) (e >> 31) & 64) != 0)
    {
      foo ();
    }
}


We should get identical dumps for the two functions. I noticed this problem
while trying to fix the original testcase to work targets where an int is
not exactly 32 bits wide. The attached patch to fix the testcase revealed
the problem.


-- 

rask at sygehus dot dk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rask at sygehus dot dk


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


  parent reply	other threads:[~2007-07-24 14:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-21137-5009@http.gcc.gnu.org/bugzilla/>
2006-02-26 15:37 ` sayle at gcc dot gnu dot org
2006-02-26 18:47 ` roger at eyesopen dot com
2007-07-24 14:57 ` rask at sygehus dot dk [this message]
2007-07-24 15:00 ` rask at sygehus dot dk
2007-07-26  9:34 ` rask at gcc dot gnu dot org
2007-07-30  1:47 ` pinskia at gcc dot gnu dot org
     [not found] <20050421004702.21137.kazu@gcc.gnu.org>
2005-07-11  4:16 ` phython at gcc dot gnu dot org
2005-08-14 19:17 ` roger at eyesopen dot com
2005-08-14 21:56 ` phython at gcc dot gnu dot org
2005-04-21  0:47 [Bug tree-optimization/21137] New: " kazu at cs dot umass dot edu
2005-04-21  0:50 ` [Bug middle-end/21137] " pinskia at gcc dot gnu dot 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=20070724145654.1721.qmail@sourceware.org \
    --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).