This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Forcing functions to be aligned on CPU cache line boundaries with GCC
- To: help-gcc at gnu dot org
- Subject: Forcing functions to be aligned on CPU cache line boundaries with GCC
- From: michael at infortrend dot com dot tw
- Date: Thu, 6 Jan 2000 23:21:34 +0800 (CST)
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