This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Generate block moves for bitfield initialization


On Sun, May 13, 2012 at 10:45 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this patch has been in our tree for a while and helps in Ada where you can do
> block assignments to structures at will. ?I've attached a C testcase. ?The
> unpatch compiler generates for it on PowerPC at -O2:
>
> foo:
> ? ? ? ?lis 10,s@ha
> ? ? ? ?li 8,27
> ? ? ? ?la 9,s@l(10)
> ? ? ? ?stb 8,s@l(10)
> ? ? ? ?li 10,108
> ? ? ? ?stb 10,1(9)
> ? ? ? ?li 10,-79
> ? ? ? ?stb 10,2(9)
> ? ? ? ?li 10,-58
> ? ? ? ?stb 10,3(9)
> ? ? ? ?blr
> ? ? ? ?.size ? foo, .-foo
> ? ? ? ?.comm ? s,4,1
>
> because it isn't able to put back together the individual initializations.
>
> The patched compiler generates instead:
>
> foo:
> ? ? ? ?lis 9,.LANCHOR0@ha
> ? ? ? ?lis 10,s@ha
> ? ? ? ?lwz 9,.LANCHOR0@l(9)
> ? ? ? ?stw 9,s@l(10)
> ? ? ? ?blr
> ? ? ? ?.size ? foo, .-foo
> ? ? ? ?.comm ? s,4,1
>
> ? ? ? ?.section ? ? ? ?.rodata
> ? ? ? ?.set ? ?.LANCHOR0,. + 0
> .LC0:
> ? ? ? ?.byte ? 27
> ? ? ? ?.byte ? 108
> ? ? ? ?.byte ? 177
> ? ? ? ?.byte ? 198
>
>
> Bootstrapped/regtested on i586-suse-linux, OK for mainline?

Ok.

Thanks,
Richard.

>
> 2012-05-13 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* gimplify.c (gimplify_init_constructor): Do a block move for very
> ? ? ? ?small objects as well.
>
>
> --
> Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]