[Bug target/35363] Missing bit field coalescing optimization

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Feb 25 18:50:00 GMT 2008



------- 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



More information about the Gcc-bugs mailing list