Hi, Actually, I would like to ask if all this should be tree level optimization or there would be something to do at backend. I am asking because I am trying to write a new backend.
thanks, Alex R. Prado Em 25/04/2011 14:47, Ian Lance Taylor < i...@google.com > escreveu: cirrus75 writes: > For the fllowing code: > > typedef struct { > int f1:1; > int f2:1; > int f3:1; > int f4:29; > } t1; > > typedef struct { > int f1:1; > int f2:1; > int f3:30; > } t2; > > t1 s1; > t2 s2; > > void func1(void) > { > s1.f1 = s2.f1; > s1.f2 = s2.f2; > } > > we get (x86_64 target): > > movzbl s2(%rip), %edx > movzbl s1(%rip), %eax > movl %edx, %ecx > andl $-4, %eax > andl $2, %edx > andl $1, %ecx > orl %ecx, %eax > orl %edx, %eax > movb %al, s1(%rip) > ret > > > Could gcc optimize two or more operations in adjacent bitfields into one > operation ? This question looks more appropriate for the mailing list gcc-h...@gcc.gnu.org rather than the mailing list gcc@gcc.gnu.org. I agree that this looks like suboptimal code. Please consider filing a missed-optimization bug report. See http://gcc.gnu.org/bugs/ . Thanks. Ian