------- Additional Comments From vda at port dot imtp dot ilyichevsk dot odessa 
dot ua  2005-06-24 06:34 -------
>One use of this macro is to increase alignment of medium-size
>data to make it all fit in fewer cache lines.

1) This potentially makes single string fit into fewer cachelines,
but it noticeably increases the sum of all strings!
2) If cacheline is >32bytes, this optimization can even make things worse:

Unaligned string fits into 64 byte (say, Athlon64) cacheline:
[..some_string.]
^0      ^32     ^64

Same string spills over to second cacheline after alignment:
[.......some_st][ring.......]
^0      ^32     ^64

>Another is to 
>cause character arrays to be word-aligned so that `strcpy' calls
>that copy constants to character arrays can be done inline.

I do not fully understand. Is it about non-static local
char arrays initialized by string?

void f() {
    char s[] = "Long str";
}

How alignment affects this code? x86 CPUs can do unaligned loads/stores
just fine, thus 'inlinability' of implicit strcpy does not depend on alignment.
Also such local arrays are not very typical, so why optimize for this case?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22158

Reply via email to