This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/15310] New: [tree-ssa] Optimize an addition in a bit field
- 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: 6 May 2004 08:37:46 -0000
- Subject: [Bug optimization/15310] New: [tree-ssa] Optimize an addition in a bit field
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Optimize an addition in a bit field.
struct {
unsigned int bit0:1;
unsigned int ubyte:31;
} sdata;
void foo()
{
sdata.ubyte++;
}
This testcase is inspired by
http://gcc.gnu.org/ml/gcc-patches/2004-05/msg00058.html
Currently, I get:
foo:
movl sdata, %eax
movl %eax, %edx
shrl %edx
leal 2(%edx,%edx), %edx
andl $1, %eax
orl %edx, %eax
movl %eax, sdata
ret
We should be able to get
foo:
addl $2, sdata
ret
We might want to lower bit field manipulation at tree level.
--
Summary: [tree-ssa] Optimize an addition in a bit field
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,roger at eyesopen dot
com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15310