Messages in this thread |  | | Date | Thu, 30 Jan 2003 17:06:19 +0100 | From | Erik Mouw <> | Subject | Re: .align help |
| |
On Wed, Jan 29, 2003 at 11:53:22AM -0500, Pocrovsky, Lev wrote: > I am building up a library using xmm and mmx registers in Linux environment. > At the begin of this activity I was given a sample routine, which contains > a line > > .align 16 > > in a text segment. > As far as I can understand the line of the sort does not have any sense and > GCC-compiler must ignore it. Nevertheless I noticed by running test programs > that unpredictably some times the line does impact on execution time, > sometimes it does not. > > Any explanation ?
The .align directive aligns the next code (or data, depending on the use) to the value following the directive. How it is interpreted depends on the target architecture and ABI. For more information, check the "as" info pages. (hint: tkinfo and pinfo are considered better info browses than GNU info).
The impact on execution time is quite normal: modern CPUs like (and most RISC CPUs even demand) aligned memory accesses, so I bet .align 16 would at least make the execution time the consistent. Non-aligned memory accesses on the i386 family make that the CPU has to fix them up, which costs time.
Erik
-- J.A.K. (Erik) Mouw Email: J.A.K.Mouw@its.tudelft.nl mouw@nl.linux.org WWW: http://www-ict.its.tudelft.nl/~erik/ [unhandled content-type:application/pgp-signature] |  |