This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/37516] New: ~(-2 - a) is not being optimized into a + 1
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Sep 2008 03:35:59 -0000
- Subject: [Bug rtl-optimization/37516] New: ~(-2 - a) is not being optimized into a + 1
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I noticed this when looking into PR 34087 with connection of a patch I wrote
for loop-doloop.c which is supposed to reduce the number of instructions.
Anyways the following two functions are equivalent but are not optimized that
way:
int f(int a)
{
a = -2 - a;
return -(a+1);
}
int f1(int a)
{
return a + 1;
}
--
Summary: ~(-2 - a) is not being optimized into a + 1
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37516