pgubook-readers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pgubook-readers] Question on assembly code generated by gcc


From: Yannis Haralambous
Subject: [Pgubook-readers] Question on assembly code generated by gcc
Date: Tue, 13 Dec 2005 12:04:20 +0100

Hi, I have a small question:
when I compile the trivial program main () {} with gcc -O0 I get the following lines

        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp

which are very clear. But also the following lines:

        andl    $-16, %esp
        movl    $0, %eax
        addl    $15, %eax
        addl    $15, %eax
        shrl    $4, %eax
        sall    $4, %eax
        subl    %eax, %esp

of which I understand the semantics individually, but I don't see what are needed for. Why put 0 into %eax and then add 15 and again add 15? Could you tell me what is going on? Or point me to documentation or to a knowledgeable person?

Thanks in advance!!

Yannis

--
+--------------------------------------------------------------------+
| Yannis Haralambous, Ph.D.      address@hidden |
| Directeur d'Études                   http://omega.enstb.org/yannis |
|                                          Tel. +33 (0)2.29.00.14.27 |
|                                          Fax  +33 (0)2.29.00.12.82 |
| Département Informatique                                           |
| École Nationale Supérieure des Télécommunications de Bretagne      |
| Technopôle de Brest Iroise, CS 83818, 29238 Brest CEDEX 3, France  |
+--------------------------------------------------------------------+
                         ...pour distinguer l'extérieur d'un aquarium,
                                        mieux vaut n'être pas poisson

                        ...the ball I threw while playing in the park
                                       has not yet reached the ground

           Es gab eine Zeit, wo ich nur ungern über Schubert sprechen,
        nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]