diff options
author | 2009-09-28 14:21:22 +0200 | |
---|---|---|
committer | 2009-09-28 16:43:15 -0700 | |
commit | ff60fab71bb3b4fdbf8caf57ff3739ffd0887396 (patch) | |
tree | 280ee4d949e548d06aa09983de4eef6c227ba94f /arch/sparc/lib | |
parent | x86: Use __builtin_object_size() to validate the buffer size for copy_from_us... (diff) | |
download | linux-ff60fab71bb3b4fdbf8caf57ff3739ffd0887396.tar.gz linux-ff60fab71bb3b4fdbf8caf57ff3739ffd0887396.tar.bz2 linux-ff60fab71bb3b4fdbf8caf57ff3739ffd0887396.zip |
x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy
GCC provides reasonable memset/memcpy functions itself, with __builtin_memset
and __builtin_memcpy. For the "unknown" cases, it'll fall back to our
current existing functions, but for fixed size versions it'll inline
something smart. Quite often that will be the same as we have now,
but sometimes it can do something smarter (for example, if the code
then sets the first member of a struct, it can do a shorter memset).
In addition, and this is more important, gcc knows which registers and
such are not clobbered (while for our asm version it pretty much
acts like a compiler barrier), so for various cases it can avoid reloading
values.
The effect on codesize is shown below on my typical laptop .config:
text data bss dec hex filename
5605675 2041100 6525148 14171923 d83f13 vmlinux.before
5595849 2041668 6525148 14162665 d81ae9 vmlinux.after
Due to some not-so-good behavior in the gcc 3.x series, this change
is only done for GCC 4.x and above.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
LKML-Reference: <20090928142122.6fc57e9c@infradead.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/sparc/lib')
0 files changed, 0 insertions, 0 deletions