This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/21137] Convert (a >> 2) & 1 != 0 into a & 4 != 0
- From: "rask at sygehus dot dk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jul 2007 14:56:54 -0000
- Subject: [Bug middle-end/21137] Convert (a >> 2) & 1 != 0 into a & 4 != 0
- References: <bug-21137-5009@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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