This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14796] New: [tree-ssa] combine two shifts into one
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Mar 2004 09:51:41 -0000
- Subject: [Bug optimization/14796] New: [tree-ssa] combine two shifts into one
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
void bar (void);
unsigned int
foo (unsigned int a)
{
a <<= 16;
a >>= 16;
return a;
}
unsigned int
baz (unsigned int a)
{
a >>= 1;
a >>= 1;
return a;
}
I get:
;; Function foo (foo)
foo (a)
{
<bb 0>:
a_2 = a_1 << 16;
a_3 = a_2 >> 16;
return a_3;
}
;; Function baz (baz)
baz (a)
{
unsigned int pretmp.0;
<bb 0>:
a_2 = a_1 >> 1;
a_3 = a_2 >> 1;
return a_3;
}
foo() could use an AND. baz() could simply say "a_3 = a_1 >> 2;".
--
Summary: [tree-ssa] combine two shifts into one
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14796