This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Ways to fill the stack
On Mon, Feb 11, 2013 at 1:25 PM, <sztfg@yandex.ru> wrote:
> 11.02.2013, 20:28, "Ian Lance Taylor" <iant@google.com>:
>
>> Still, you may be right that in this case it would be slightly more
>> efficient to construct the local arrays using push instructions.
>
> I did some tests for clang v 2.3 and gcc v 4.5.4 http://yadi.sk/d/_F00QtcN2YJsE
> Clang uses xmm in case of small chunks and calls memcpy in case of large chunk. Most likely it is faster than push.
> It does not write const string in stack, it builds the array separately and transfers address into the function.
GCC does that in some cases as well. If you think GCC should make
different choices about when to use memcpy and when to write the
values directly, please file a bug report as described at
http://gcc.gnu.org/bugs/ . Thanks.
Ian