Re: .align help

From: Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
Date: Thu Jan 30 2003 - 11:06:19 EST


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/


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 31 2003 - 22:00:24 EST