From: Arnd Bergmann <arnd@arndb.de>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@tglx.de,
hpa@zytor.com, torvalds@linux-foundation.org
Subject: Re: [PATCH] x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy
Date: Tue, 29 Sep 2009 14:44:06 +0200 [thread overview]
Message-ID: <200909291444.06422.arnd@arndb.de> (raw)
In-Reply-To: <20090928113433.5e9b8ea7@infradead.org>
On Monday 28 September 2009, Arjan van de Ven wrote:
>
> 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
>
The patch looks good, but is there a reason to keep it architecture
specific? I would guess that the same logic applies to all architectures
with gcc-4.x and could be put into include/linux/compiler-gcc4.h.
Arnd <><
next prev parent reply other threads:[~2009-09-29 12:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-28 9:34 [PATCH] x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy Arjan van de Ven
2009-09-28 12:21 ` Arjan van de Ven
2009-09-28 23:47 ` [tip:x86/asm] " tip-bot for Arjan van de Ven
2009-09-29 12:44 ` Arnd Bergmann [this message]
2009-09-29 12:53 ` [PATCH] " Arjan van de Ven
2009-09-29 15:32 ` H. Peter Anvin
2009-10-02 19:19 ` Andi Kleen
2009-10-02 20:04 ` H. Peter Anvin
2009-10-02 20:12 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200909291444.06422.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=arjan@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@tglx.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.