From: viro@parcelfarce.linux.theplanet.co.uk
To: Takashi Iwai <tiwai@suse.de>
Cc: Linus Torvalds <torvalds@osdl.org>,
linux-kernel@vger.kernel.org, perex@suse.cz
Subject: Re: [RFC] ASLA design, depth of code review and lack thereof
Date: Mon, 7 Jun 2004 23:40:45 +0100 [thread overview]
Message-ID: <20040607224045.GJ12308@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <s5hfz974ijl.wl@alsa2.suse.de>
On Mon, Jun 07, 2004 at 03:14:06PM +0200, Takashi Iwai wrote:
> > and return a pointer to a (8-element) row in array of patterns. Because
> > callers end up truncating the result and then filling a large area with
> > repeated copies. All we get from use of u_int64_t is extra PITA with
> > endianness - memcpy from 1/2/4/8 element array is no less efficient than
> > assignment from u8/u16/u32/u64.
>
> Is it true? If gcc really optmizes well like this, yes, surely we can
> use memcpy for simplicity.
__builtin_memcpy() is definitely smart enough for that: e.g. on x86 (and you
don't get much more register-starved than that)
void b(char *);
void a(char *x, int count)
{
char buf[8];
int i;
b(buf);
for (i = 0; i < count; i++) {
__builtin_memcpy(x, buf, 8);
x += 8;
}
}
will result (with -O2, which is normal for kernel) in
.L6:
movl %ecx, (%ebx)
movl %edx, 4(%ebx)
addl $8, %ebx
decl %eax
jne .L6
as the main loop, which gives you what you would get from use of u64.
And yes, constant-sized memcpy() in the kernel will be expanded to
__builtin_memcpy().
next prev parent reply other threads:[~2004-06-07 22:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-04 23:08 viro
2004-06-04 23:14 ` viro
2004-06-04 23:29 ` Linus Torvalds
2004-06-05 0:04 ` viro
2004-06-07 13:14 ` Takashi Iwai
2004-06-07 22:40 ` viro [this message]
2004-06-08 12:49 ` Takashi Iwai
2004-06-07 13:10 ` Takashi Iwai
2004-06-04 23:37 ` Jeff Garzik
2004-06-07 13:24 ` Takashi Iwai
2004-06-07 13:47 ` Jeff Garzik
2004-06-07 13:57 ` Takashi Iwai
2004-06-07 14:05 ` Jeff Garzik
2004-06-07 14:12 ` Takashi Iwai
2004-06-07 14:18 ` Russell King
2004-06-08 13:27 ` Takashi Iwai
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=20040607224045.GJ12308@parcelfarce.linux.theplanet.co.uk \
--to=viro@parcelfarce.linux.theplanet.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@suse.cz \
--cc=tiwai@suse.de \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®