This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/52134] Does not fold (x * 4) & -4
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 06 Feb 2012 19:45:41 +0000
- Subject: [Bug middle-end/52134] Does not fold (x * 4) & -4
- Auto-submitted: auto-generated
- References: <bug-52134-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52134
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |TREE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-06 19:45:41 UTC ---
Short testcase:
unsigned f(unsigned t)
{
return (t*4)&-4;
}
int f1(int t)
{
return (t*4)&-4;
}
Both should be optimized to just t*4. In fact we do it on the RTL level.
*4 is changed to <<a 2 on the RTL level and simplified with the & when doing
combine.