mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andre Renaud <andre@bluewatersys.com>
To: musl@lists.openwall.com
Subject: Re: ARM optimisations
Date: Sun, 3 Mar 2013 09:33:54 +1300	[thread overview]
Message-ID: <CAPfzE3bLXQnybVyJXHYUzjJ4Dj3KVphRaooVyBXO3qQqWO1TbQ@mail.gmail.com> (raw)
In-Reply-To: <20130302113441.GQ6181@port70.net>

On 3 March 2013 00:34, Szabolcs Nagy <nsz@port70.net> wrote:
> * Rob Landley <rob@landley.net> [2013-03-01 22:33:19 -0600]:
>> I'd actually say that armv5 is probably the one to optimize for,
>> because it's somewhere over 80% of the installed base of arm systems
>> and generally provides an additonal 25% speedup from armv4 to armv5.
>> Anything lower than that can use C, anything newer than that can
>> benefit from an armv5 version vs C.
> ...
>> I believe armv6 was mostly just SMP extensions, so not worth
>> optimizing memcpy for. armv7 is nice but not uibiquitous the way
>> armv5 is, and armv7 brings with it the "thumb2" instruction set
>> which means you'd need 2 versions depending on what target you
>> wanted to compile for...
>
> a quick research shows that
>
> glibc has ifdefs for armv5te and armv4t optimizations
> http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/arm/memcpy.S
>
> linaro has armv7 optimized version
> http://bazaar.launchpad.net/~linaro-toolchain-dev/cortex-strings/trunk/view/head:/src/linaro-a9/memcpy.S
>
> olibc (the bionic one not the openbsd one) has armv7+neon optimized memcpy
> https://github.com/olibc/olibc/blob/master/libc/arch-arm/bionic/memcpy.S

The bionic code uses a couple of pre-processor tricks to combine the
ARMv4 & ARMv5 code, specifically around the PLD and CALIGN
instructions. Since (I assume) bionic is built at compile time for a
specific CPU, it is relatively easy to do these, however I got the
impression (and may be mistaken) that we were trying to avoid compile
time CPU detection in favour of run-time CPU detection. If that is the
case, then you would need two separate implementations (possibly with
some code sharing), and I thought that the overall code-size bloat
that this would bring wouldn't be worth it. This is especially true
when you talk about ARM NEON/v7, as it is essentially completely
different, so you'd end up with somewhere between 300% & 500% code
size increase on ARM to support all three platforms (based on the
current implementation going from 1k to 1.5k when I used the ASM
optimised version).

Having said all that, I do tend to agree that the ARMv4 platforms are
relatively archaic, and simply not having an optimised version for
them could be an acceptable alternative. ARMv5t is probably still too
popular to ignore.

Regards,
Andre


      reply	other threads:[~2013-03-02 20:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28 23:15 Andre Renaud
2013-02-28 23:30 ` Rich Felker
2013-03-02  4:33   ` Rob Landley
2013-03-02  6:21     ` Rich Felker
2013-03-04 18:55       ` Rob Landley
2013-03-02 11:34     ` Szabolcs Nagy
2013-03-02 20:33       ` Andre Renaud [this message]

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=CAPfzE3bLXQnybVyJXHYUzjJ4Dj3KVphRaooVyBXO3qQqWO1TbQ@mail.gmail.com \
    --to=andre@bluewatersys.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).