Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130805212426.GN221@brightrain.aerifal.cx>
Date: Mon, 5 Aug 2013 17:24:27 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: ARM memcpy post-0.9.12-release thread

On Sat, Aug 03, 2013 at 10:03:14AM +1200, Andre Renaud wrote:
> Hi Rich,
> 
> On 3 August 2013 08:41, Rich Felker <dalias@...ifal.cx> wrote:
> > Andre, do you have any input on this? (Cc'ing)
> >
> > Rich
> 
> Sorry, I've been reading the emails, but haven't had a chance to get
> back to the code. I don't really have an opinion on the gcc memcpy
> issue, however I was still hopeful that we could come up with a
> relatively clean mixed C/asm solution for the misaligned/non-congruent
> copy scenario. Having said that, I haven't done anything on it yet.
> 
> To be honest, although a solution probably exists, I doubt it's ever
> going to be much better than the bionic code (with the exception of
> possibly being less to read).

Attached is a "C version of the concept in the Bionic asm". Without
spending any effort getting the compiler to optimize it better, it's
only taking about 80% longer than the asm to run on misaligned input.
I would say something like this is _potentially_ a candidate for
replacing memcpy.c in musl, since it should do well on most RISC
architectures (and does decently even on x86).

Of course this is no replacement for the asm, as it's much slower, but
it would allow us to get by longer without adding asm for new archs.

The aligned case should probably be changed to use structure copies if
we can be sure they won't generate calls to memcpy.

Rich

View attachment "memcpy_risc.c" of type "text/plain" (1902 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.