This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Function alignment and ColdFire performance


On Tue, 17 Mar 1998 09:19:39 +0000, David Fiddes <D.J.Fiddes@hw.ac.uk> wrote:
>output of gcc I noticed that all the functions are aligned on .even
>boundaries.
This should be all that is needed.

> The ColdFire works best when things are aligned on 4-byte
>boundaries as this suits it's RISC-esque design and might explain some of
>the anomolies that we've found.
For data, I agree.  The same problems shouldn't exist for code because
the I-fetch mechanism _has_ to be able to handle non-aligned instructions
because instructions vary in size.  That said, it is possible that there
is a bug in the interaction between the code prefetch and cache that
is causing the problems.  If this is true, it'll be necessary to align
all branch targets, not just function boundaries.

> Is there a way to get GCC to do this
GCC 2.8 includes a series of options (i386 and m68k backends only)
that allows you to control code alignment: -malign-loops=N,
-malign-jumps=N, -malign-functions=N `N' specifies the power of two
boundary on which to align the code (only 1 (2 byte) and 2 (4 byte)
are allowed).

Peter