public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: Add armv6 and armv7 optimized swab functions
Date: Sat, 18 Dec 2010 18:17:09 +0000	[thread overview]
Message-ID: <yw1xwrn72bfe.fsf@unicorn.mansr.com> (raw)
In-Reply-To: 4D0CEB67.2040502@gmail.com

Rob Herring <robherring2@gmail.com> writes:

> On 12/17/2010 03:27 PM, M?ns Rullg?rd wrote:
>> Rob Herring<robherring2@gmail.com>  writes:
>>
>>> From: Rob Herring<rob.herring@calxeda.com>
>>>
>>> swab functions are heavily used by FDT code, so enable
>>> optimized assembly code for ARMv6 and later.
>>>
>>> Signed-off-by: Rob Herring<rob.herring@calxeda.com>
>>> ---
>>>   arch/arm/include/asm/byteorder.h |   16 ++++++++++++++++
>>>   1 files changed, 16 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/include/asm/byteorder.h b/arch/arm/include/asm/byteorder.h
>>> index c3489f1..9df5844 100644
>>> --- a/arch/arm/include/asm/byteorder.h
>>> +++ b/arch/arm/include/asm/byteorder.h
>>> @@ -23,6 +23,22 @@
>>>   #  define __SWAB_64_THRU_32__
>>>   #endif
>>>
>>> +#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_6__)
>>> +static inline __u16 __attribute__((const)) ___arch_swab16(__u16 x)
>>> +{
>>> +	__asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x));
>>> +	return x;
>>> +}
>>
>> Pay close attention to what gcc does with this as it is prone to add
>> unnecessary masking of the low halfword.  If the callers are
>> well-behaved (argument having top halfword clear), making the
>> parameter and return types here plain unsigned (or u32) gives better
>> code.
>
> This straight from the Linux code and there are only a few users of 
> swab16 (none in my build).

Look at the generated code if you don't believe me.

-- 
M?ns Rullg?rd
mans at mansr.com

  reply	other threads:[~2010-12-18 18:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 15:13 [U-Boot] [PATCH] arm: Add armv6 and armv7 optimized swab functions Rob Herring
2010-12-17 20:21 ` Wolfgang Denk
2010-12-17 20:52   ` Rob Herring
2010-12-17 21:27 ` Måns Rullgård
2010-12-18 17:12   ` Rob Herring
2010-12-18 18:17     ` Måns Rullgård [this message]
2010-12-18 21:59     ` Wolfgang Denk

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=yw1xwrn72bfe.fsf@unicorn.mansr.com \
    --to=mans@mansr.com \
    --cc=u-boot@lists.denx.de \
    /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