Subject: powerpc gcc alignment problem
To: None <,>
From: Dan Winship <danw@MIT.EDU>
List: tech-toolchain
Date: 12/28/1999 12:44:48
The PowerPC requires floating point loads and stores to be at least
4-byte aligned. Gcc doesn't know this, and so will sometimes generate
bad floating point moves (possibly only for the case of 64-bit
structure copies). "As seen in PR 8952", although I didn't mention
there that it makes Gtk not work. :)

I'd like to fix this in time for 1.4.2.

#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.

#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