Subject: Re: powerpc gcc alignment problem
To: Dan Winship <danw@MIT.EDU>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-toolchain
Date: 01/13/2000 17:10:29
On Tue, 28 Dec 1999 12:44:48 -0500 (EST)
Dan Winship <danw@MIT.EDU> wrote:
> I'd like to fix this in time for 1.4.2.
Agreed.
> #defining STRICT_ALIGNMENT in gcc makes it not generate the unaligned
> accesses, but that's an overly large hammer for this, since (a) we
> only care about 64-bit types, not smaller ones, and (b) they don't
> actually have to be fully aligned, just half-aligned.
Technically speaking, the PowerPC *does* have strict alignment, because
unaligned accesses require fixups (right? Or, did I totally misunderstand
that part of the book when I read it...)
I think STRICT_ALIGNMENT is the way to go. Although, you should make
sure it doesn't have any side-effects on e.g. how structure members are
padded. I sure hope 32-bit data types are always aligned to 32 bits, etc.
>
> #defining SLOW_UNALIGNED_ACCESS also fixes the code, but it seems to
> result in much more code than the STRICT_ALIGNMENT case in the sample
> program in PR 8952.
>
> As far as I've been able to tell, there's no way for the MD part of
> the gcc sources to express "floats must be half-aligned and other
> things don't need to be aligned" to the MI part. I have some ideas on
> how it could be done, but it would require changes to lots of files,
> so it seems like the sort of thing we'd want to get put into the real
> gcc tree and then we could import it from them.
>
>
> So... for now, does anyone object to my turning on STRICT_ALIGNMENT in
> /usr/src/gnu/dist/gcc/config/rs6000/netbsd.h and then getting that
> pulled up to the release branch?
>
> -- Dan
-- Jason R. Thorpe <thorpej@nas.nasa.gov>