Subject: Re: Possible bug in arm32 strongarm optimisations.
To: None <port-arm32@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: port-arm32
Date: 10/25/2000 12:44:14
On Wed, Oct 25, 2000 at 09:20:38AM -0700, Chris G. Demetriou wrote:
> chris@buzzbee.freeserve.co.uk (Chris Gilbert) writes:
> > What is this rotating thing? I don't remember coming across it before. Is
> > it documented anywhere?
>
> Take a look in the ARM architecture reference manual. It's documented
> behaviour of non-naturally aligned loads and stores.
>
> something like:
>
> 0: 0xaa
> 1: 0xbb
> 3: 0xcc
> 3: 0xdd
>
> lw from 0: 0xddccbbaa
> lw from 1: 0xaaddccbb
> etc.
>
> similarly for lh:
>
> lh from 0: 0xbbaa
> lh from 1: 0xaabb
>
> (i think i got the endianness right).
>
> for most users unexpected results, but architecturally specified ones.
>
> This comes up every so often on the list. (I suspect my standard
> response is why Jason Thorpe said "unexpected" results in his recent
> post about unaligned accesses in the in-tree ssh... People often say
> broken, or similar, but, weenie that i am, i'm prone to point out that
> they're actually quite correct and documented ... just unexpected. 8-)
And, sometimes, it can even be a win. If you have an algorithm that wants
to do rotates, and you can structure it so that it does them by way of
unaligned loads/stores -- they're "free", they take no extra cycles, since
you had to get the data in/out anyway...
Unfortunately, the compiler probably isn't smart enough to do that unless
you give it some very explicit help, or just write the code in assembler.
--
Thor Lancelot Simon tls@rek.tjls.com
the effort to perceive simply the cruel radiance of what is