This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Assembly Code Query


On Friday 25 February 2005 20:31, .jareeN. wrote:
> Hi all,

Hello.

> 	I am using gcc -S to generate this assembly code. The compiler
> gives:
>
> 		andl    $-16, %esp
>
> I understand that we are here basically anding 0xffff00ff with %esp. But

-16 equals 0xfffffff0, not 0xffff00ff.  So, by ANDing %esp with 0xfffffff0, 
you're actually aligning it to a 16-byte boundary and, as the code you've 
posted seems to be setting up a stack frame, this is no problem, since the 
value of %esp will only decrease.

> what I can't get is use of doing this. Could somebody tell me the
> significance of doing this.
>
>
>
> Detailed code:
>
>         pushl   %ebp
>         movl    $16, %edx
>         movl    %esp, %ebp
>         subl    $8, %esp
>         andl    $-16, %esp
>         movl    %edx, 4(%esp)
>
>
> TIA



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]