This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/15256] New: [tree-ssa] Optimize manual bitfield manipilation.
- 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: 3 May 2004 08:03:54 -0000
- Subject: [Bug optimization/15256] New: [tree-ssa] Optimize manual bitfield manipilation.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
It would be nice if we can convert foo into bar.
unsigned int
foo (unsigned int eax)
{
unsigned int edx = eax & 1;
edx ^= 1;
eax &= -2;
eax |= edx;
return eax;
}
unsigned int
bar (unsigned int eax)
{
return eax ^ 1;
}
The last SSA form looks like:
foo (eax)
{
unsigned int edx;
<bb 0>:
edx_2 = eax_1 & 1;
edx_3 = edx_2 ^ 1;
eax_4 = eax_1 & 0fffffffe;
eax_5 = eax_4 | edx_3;
return eax_5;
}
This testcase is inspired by
http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00058.html
This sequence of four instructions is a little too tough for the combiner to
chew as it only considers three insturctions at one time.
Note that some people manually implement bitfields
without relying on ":" in a struct.
--
Summary: [tree-ssa] Optimize manual bitfield manipilation.
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=15256