This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/35363] Missing bit field coalescing optimization
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Feb 2008 18:49:26 -0000
- Subject: [Bug target/35363] Missing bit field coalescing optimization
- References: <bug-35363-9436@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-02-25 18:49 -------
So, the same code should be generated for
union {
struct {
int b1: 3;
int b2: 3;
int b3: 2;
int b4: 17;
}a;
int b;
} a;
void foo()
{
a.a.b1 = 2;
a.a.b2 = 3;
a.a.b4 = 8;
}
void bar()
{
a.b = (a.b & (-1u >> (sizeof(a.b)*8 - 2) << 6)) | 2 | (3 << 3) | (8 << 17);
}
modulo errors I made in the bar() case ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35363