[Bug middle-end/22141] [5/6/7 Regression] Missing optimization when storing structures
ktkachov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 15 09:52:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22141
--- Comment #41 from ktkachov at gcc dot gnu.org ---
(In reply to etienne_lorrain from comment #40)
> Following my comment No 17, the optimisation could also be done for reads -
> we still have (https://gcc.godbolt.org/ -O2 -m32) that:
> struct S
> {
> char a;
> char b;
> char c;
> char d;
> } u, v;
>
> void fct (void) {
> u.a = v.a;
> u.b = v.b;
> u.c = v.c;
> u.d = v.d;
> }
>
> compiled into:
> fct():
> movzbl v, %eax
> movb %al, u
> movzbl v+1, %eax
> movb %al, u+1
> movzbl v+2, %eax
> movb %al, u+2
> movzbl v+3, %eax
> movb %al, u+3
> ret
>
> Same if fct() contains "u = (struct S) {v.a, v.b, v.c, v.d};"
> Where a single read32 / write32 could be used...
>
> Having fct() only do "u = v;" is compiled with a single read32 / write32.
> I do not know if it is important enough, if it needs another bugzilla
> number...
> Thanks.
Yeah, I separate bugzilla entry would be good here
More information about the Gcc-bugs
mailing list