This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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

Forcing functions to be aligned on CPU cache line boundaries with GCC



Hi!

We are using GCC as our primary development environment for a PPC HW
environment. We've noted that shifting code one way or the other can cause
5-10% difference in performance. We suspect that this has to do with
alignment of functions. If it happens that most of the functions that
are called are based near the head of cache lines, then the cache hit rate
will probably increase and performance go up. I'm speculating that this
may be the cause of such a difference in performance, for I can not think
of any other reason why a shift in memory location of code of a few dwords
would cause such a substantial performance impact.

So here's the questing. Is there any way to force alignment of functions
on, say, a 32-byte boundary? If so, what command line option or pragma or
whatever should we use?

Thanks much for any help you can provide!

Regards,

Michael Schnapp
Infortrend Technology, Inc.
Taiwan
email: michael@infortrend.com.tw




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