From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Add optimised swahb32() byteswap helper for v6 and above
Date: Fri, 25 Nov 2011 10:12:32 +0000 [thread overview]
Message-ID: <20111125101231.GB2098@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.02.1111231108330.17904@xanadu.home>
On Wed, Nov 23, 2011 at 11:09:00AM -0500, Nicolas Pitre wrote:
> On Wed, 23 Nov 2011, Dave Martin wrote:
>
> > ARMv6 and later processors have the REV16 instruction, which swaps
> > the bytes within each halfword of a register value.
> >
> > This is already used to implement swab16(), but since the native
> > operation performaed by REV16 is actually swahb32(), this patch
> > renames the existing swab16() helper accordingly and defines
> > __arch_swab16() in terms of it. This allows calls to both swab16()
> > and swahb32() to be optimised.
> >
> > The compiler's generated code might improve someday, but as of
> > 4.5.2 the code generated for pure C implementing these 16-bit
> > bytesswaps remains pessimal.
> >
> > swahb32() is useful for converting 32-bit Thumb instructions
> > between integer and memory representation on BE8 platforms (among
> > other uses).
> >
> > Signed-off-by: Dave Martin <dave.martin@linaro.org>
>
> Reviewed-by: Nicolas Pitre <nico@linaro.org>
Submitted to Russell's patch system as 7173/1.
Cheers
---Dave
prev parent reply other threads:[~2011-11-25 10:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 14:42 [PATCH] ARM: Add optimised swahb32() byteswap helper for v6 and above Dave Martin
2011-11-23 16:09 ` Nicolas Pitre
2011-11-25 10:12 ` Dave Martin [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=20111125101231.GB2098@localhost.localdomain \
--to=dave.martin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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