Re: .align help

Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
Thu, 30 Jan 2003 17:06:19 +0100


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-8938-1043942848-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 environme=
nt.
> At the begin of this activity I was given a sample routine, which contai=
ns
> a line
>=20
> .align 16
>=20
> in a text segment.
> As far as I can understand the line of the sort does not have any sense a=
nd
> GCC-compiler must ignore it. Nevertheless I noticed by running test progr=
ams
> that unpredictably some times the line does impact on execution time,
> sometimes it does not.
>=20
> 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

--=20
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/

--=_courier-8938-1043942848-0001-2
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE+OU16/PlVHJtIto0RAr0cAJ9qjb6R4lZJuQQaJh2V9FlAqwuU9gCggccP
VBvyprItiiHRecGK8PXJBwQ=
=o66J
-----END PGP SIGNATURE-----

--=_courier-8938-1043942848-0001-2--