received: from rap-wct8.katowice.tpnet.pl by free.polbox.pl (5.65v3.2/1.1.10.5/30Sep97-1012PM) id AA24840; Thu, 2 Oct 1997 18:40:00 +0200 message-id: <9710021640.AA24840@free.polbox.pl> From: "=?ISO-8859-2?Q?Robert_Darmochwa=B3?=" To: "DJGPP Mailing List" subject: Re: And another question... date: Thu, 2 Oct 1997 18:23:09 +0100 x-msmail-priority: Normal x-priority: 3 x-mailer: Microsoft Internet Mail 4.70.1155 mime-version: 1.0 content-type: text/plain; charset=ISO-8859-2 content-transfer-encoding: 8bit Precedence: bulk ---------- > From: M. Schulter > To: djgpp AT delorie DOT com > Subject: Re: And another question... > Date: 2 pa > Nate Eldredge wrote: > > : The reason the ".align 4"'s are spread throughout the code is that the > : ".align" directive only aligns that part of the code. I.E. when the > : assembler is assembling, it has a location counter that keeps track of the > : address at which the code it assembles will be. When it sees a ".align X" > : directive, it increases the location counter to a multiple of X, thus making > : the next instruction or label be on an X-byte boundary. > > Hi, there, and this is just to add a fine point on the meaning of the > number following '.align' -- hoping that I've understood the docs > correctly, and inviting correction. > > According to the GAS docs, > > info as pseudo align > > when .align is invoked for the a.out format on the i386, the number > following the align statement specifies "the number of low-order > zero-level bits" required in the location counter after advancement. Thus > > .align 1 2-byte alignment xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx0 > .align 2 4-byte alignment xxxx xxxx xxxx xxxx xxxx xxxx xxxx xx00 > .align 3 8-byte alignment xxxx xxxx xxxx xxxx xxxx xxxx xxxx x000 > .align 4 16-byte alignment xxxx xxxx xxxx xxxx xxxx xxxx xxxx 0000 > .align n 2^n-byte alignment etc. > > If I read and interpret correctly, then '.align 4' aligns on a 16-byte > boundary, which as mentioned elsewhere in your post helps to optimize on > systems such as the 486. > > Anyway, thanks a great deal for the information about the advantages in > some cases of 16-byte alignment -- very valuable knowledge for an aspirant > to assembler. A friend and I were discussing the possible reasons for > using '.align 4' as opposed to '.align 2' -- which I've seen gcc use in > output from some simple C programs -- and you may have solved this > mystery. > > Most appreciatively, > > Margo Schulter > mschulter AT value DOT net > hi , as far i know aligning on dword (4b) boundary is enough. For further information i can mail you some optimize.txt file,which describes optimizations for pentiums and 486. Also, if you guyz ,have any info about 'bare metal' optimizing please mail it to me too.(maybe i am outdated?) man2die4 AT earthlig DOT net