RE: [PATCH 9/9] x86/lib/memset_64.S: Optimize memset by enhanced REPMOVSB/STOSB
From: Andi Kleen
Date: Wed May 18 2011 - 00:05:34 EST
>
> Only memcpy are generated by gcc when gcc version >=4.3. Other functions
> are defined by kernel lib.
Are you sure? AFAIK it supports more.
> I would leave gcc optimization for most memcpy cases instead of forcing
> memcpy to call the kernel lib memcpy. I hope gcc will catch up and
> implement a good enhanced rep movsb/stosb solution soon. If turns out gcc
> can not generate good memcpy, it's easy to switch to the patching kernel
> lib memcpy.
The problem is that gcc can only do that if you tell it to generate
code for that. But it has no mechanism to patch in/out different
variants for the same binary. So it would only work for a specially
optimized kernel for that CPU.
I suspect for smaller copies it won't make too much different anyways
and gcc's code is probably fine. But gcc won't know that you
can do better on large copies, so using a macro would be a way
to tell it that.
-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/