Subject: Re: Strange C compiler code generation
To: Peter Teichmann <teich-p@rcs.urz.tu-dresden.de>
From: Chris Gilbert <chris@paradox.demon.co.uk>
List: port-arm32
Date: 02/25/2001 00:11:01
On Saturday 24 February 2001 10:39 pm, Peter Teichmann wrote:
> > > Many 32-Bit-Loads were not done using a LDR instruction, but using 4
> > > single LDRB instructions and 3 ORR instructions. Is that intended and
> > > if yes, why? Probably many NetBSD applications will be quite slow
> > > because of this!
> > >
> > > I could imagine one reason: 32 bit quantities are not necessarily 32
> > > bit aligned in structures, but if that is really true, well, I better
> > > do not continue this thought!
> >
> > Are your structures marked as packed?  If not, what compilation flags are
> > being used?
>
> Hm. They are. But: Still all variables are 32 bit aligned! And: Using gcc
> 2.95.2 under Linux or RiscOS I do not get this strange behaviour. Why does
> NetBSD still use egcs?
>
> One example structure looks like this:
>
> #pragma pack(1)
>
> struct test {
>   int a,b;
> };
>
> #pragma pack()
>
> If I now do access the content of this structure, the ints are accessed by
> 4 LDRBs and 3 ORRs, which is absolutely not necessary.
>
> Is there a chance that NetBSD/arm32 will soon use gcc 2.95.2?

At some point yes.  We plan to switch to ELF, and when that happens will 
probably use that compiler (it's the one Ben has been working with, and is in 
the current source tree (but isn't the default))  Of course if a later one is 
around by then we might use that one :) What optimisation level are you using?

Cheers,
Chris