This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inefficient code
> I just constructed another test case that shows the same issue more
> blatantly:
>
> struct s
> {
> char a;
> char b;
> char c;
> char d;
> int e;
> int f;
> char h;
> char i;
> };
No, it's not the same issue.
> struct s ts;
>
> void setts(void)
> {
> ts.a=2;
> ts.b=4;
> ts.c=1;
> ts.d=24;
> ts.e=5;
> ts.f=42;
> ts.h=9;
> ts.i=3;
> }
>
> Each of the fields are written separately, even though clearly the adjacent
> byte writes can and should be combined into a single HImode move. This
> happens both with -O2 and -Os.
The GIMPLE pass responsible for the optimization simply punts for the "funny-
endian ordering" of the PDP11. More generally, you shouldn't expect anything
sparkling for such a peculiar architecture as the PDP11.
--
Eric Botcazou