This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: STRICT_ALIGNMENT is too strict for m68k
- To: Jim Wilson <wilson at cygnus dot com>
- Subject: Re: STRICT_ALIGNMENT is too strict for m68k
- From: Kamil Iskra <kiskra at ernie dot icslab dot agh dot edu dot pl>
- Date: Tue, 19 May 1998 14:27:52 +0200 (MET DST)
- cc: Richard Henderson <rth at cygnus dot com>, Greg McGary <gkm at eng dot ascend dot com>, Jeffrey A Law <law at cygnus dot com>, egcs at cygnus dot com
On Mon, 18 May 1998, Jim Wilson wrote:
> Seems to me that there should be a separate macro for controling
> the alignment of members in structures, leaving STRICT_ALIGNMENT
> for indicating if unaligned accesses to memory will trap.
> Actually, there is already a second macro in use by expmed.c/expr.c called
> SLOW_UNALIGNED_ACCESS, which defaults to STRICT_ALIGNMENT. He could perhaps
> make m68k.h define this macro, and modify other places if necessary to
> use SLOW_UNALIGNED_ACCESS instead of STRICT_ALIGNMENT. That would avoid
> the ABI issue without creating a new macro.
According to tm.texi:
@item SLOW_UNALIGNED_ACCESS
Define this macro to be the value 1 if unaligned accesses have a cost
many times greater than aligned accesses, for example if they are
emulated in a trap handler.
Please, let's not repeat the STRICT_ALIGNMENT problem by modifying
functionality of yet another simple macro in a confusing way.
IMHO, there is little use for SLOW_UNALIGNED_ACCESS, the way it is
currently defined, since:
1. with -m68000, unaligned access will simply crash.
2. with -m68020, unaligned access will not crash and will not be emulated
by a trap handler: it will merely run slightly slower.
The macro that SHOULD apply in this case is STRICT_ALIGNMENT. As pointed
out by the Cygnus people (thanks for the testcase, Jim: I observed the
BLKmode <-> ?Imode differences, but I wasn't aware of their consequences),
it can't be used, since (contrary to the way it is currently documented)
it is ABI unsafe.
Therefore, I think that what we need is a new macro, like
USE_STRICT_ALIGNMENT_ABI or sth, that, when defined and non-zero simulates
the ABI changes imposed by STRICT_ALIGNMENT (mode, alignment, register
arguments), but does not force unaligned accesses to be made scattered
into byte-accesses.
If done carefully, this would allow us to alter m68k.h in ABI-compatible
manner.
Does this sound OK for you guys? I am willing to contribute the necessary
changes.
/ Kamil Iskra AmigaOS Linux/i386 Linux/m68k \
| GeekGadgets GCC maintainer UNIX system administrator |
| iskra@student.uci.agh.edu.pl kiskra@ernie.icslab.agh.edu.pl |
\ kamil@dwd.interkom.pl http://student.uci.agh.edu.pl/~iskra /