mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Cc: Kim Walisch <kim.walisch@gmail.com>
Subject: Re: Re: musl libc, memcpy
Date: Wed, 1 Aug 2012 02:19:05 -0400	[thread overview]
Message-ID: <20120801061904.GD544@brightrain.aerifal.cx> (raw)
In-Reply-To: <20120801054011.GC544@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

On Wed, Aug 01, 2012 at 01:40:11AM -0400, Rich Felker wrote:
> On Wed, Aug 01, 2012 at 12:27:22AM -0400, Rich Felker wrote:
> > I'm attaching a (possibly buggy; not heavily tested) rep-movsd-based
> > version. I'd be interested in hearing how it performs.
> 
> And here is the attachment...

And here's a version that might be faster; reportedly, rep movsd works
better when the destination address is aligned.

Rich

[-- Attachment #2: memcpy.s --]
[-- Type: text/plain, Size: 341 bytes --]

.global xmemcpy
.type xmemcpy,@function
xmemcpy:
	push %esi
	push %edi
	mov 12(%esp),%edi
	mov 16(%esp),%esi
	mov 20(%esp),%ecx
	mov %edi,%eax
	cmp $4,%ecx
	jc 1f
	test $3,%edi
	jz 1f
2:	movsb
	dec %ecx
	test $3,%edi
	jnz 2b
1:	mov %ecx,%edx
	shr $2,%ecx
	rep
	movsl
	and $3,%edx
	jz 1f
2:	movsb
	dec %edx
	jnz 2b
1:	pop %edi
	pop %esi
	ret

  reply	other threads:[~2012-08-01  6:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAE_DJ110cVdicu-wPe_Ndeg9ih+g3AXZ_hNoGgX+DftJm6q=mA@mail.gmail.com>
2012-07-30 20:41 ` Rich Felker
2012-07-31  1:25   ` Luca Barbato
     [not found]   ` <CAE_DJ1328EfKQp6t33bq0k+9Hbo0Fvu6dhvO2OOePcx2xa3QeQ@mail.gmail.com>
2012-08-01  4:27     ` Rich Felker
2012-08-01  5:40       ` Rich Felker
2012-08-01  6:19         ` Rich Felker [this message]
2012-08-03 23:22           ` John Spencer

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=20120801061904.GD544@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=kim.walisch@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).