From: an0nym@gmx.de
To: linux-assembly@vger.kernel.org
Subject: Re: GCC Optimization?
Date: Tue, 23 Nov 2004 10:22:46 +0100 (MET) [thread overview]
Message-ID: <25511.1101201766@www50.gmx.net> (raw)
>> But why do they use and .... I think and does only even %esp
>> so that the last 4 Bits are set to Zero.
>> But if %esp was 0xcccccccc before it would now be 0xccccccc0
>> what happens to the 4 Bits from 0xccccccc0 to 0xcccccccc?
>> And what is this good for?
>
>The x86 push and pop instructions are much, much less efficient if the
>stack pointer is not dword-aligned. So if one function (say) pushes a
>segment register onto the stack, it can affect the performance of
>every function that is called from there.
Alright. Thanks!
>> Second question:
>> What does mov $0x0,%eax? Why dont they use xor %eax and what is it
>> good for?
>
>It zeros the accumulator, of course. As for why they don't use xor,
>why should they? What would be the advantage?
xor is imho a little bit faster than mov and xor %eax,%eax does the same
like mov $0x0,%eax. But I still don't know why the accumulator has to be
zeroed.
>> Third question:
>> What is sub %eax,%esp good for? We subtract 0 from
>> esp... mmmhh... for what?
>
>Did you try building the same code with gcc optimizations turned on?
No I didn't use any optimiziation, I just thought of 'default'
optimiziations without turning -o2 or -o3 on.
So what is this code good for? I subtracts zero from %esp and saves the
result in %esp. So this code doesn't do anything with %esp. But I think
there should be a purpose?!
Best regards
--
Geschenkt: 3 Monate GMX ProMail + 3 Top-Spielfilme auf DVD
++ Jetzt kostenlos testen http://www.gmx.net/de/go/mail ++
next reply other threads:[~2004-11-23 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-23 9:22 an0nym [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-11-23 0:26 GCC Optimization? asmfreshmeat
2004-11-23 1:06 ` Brian Raiter
2004-11-23 16:43 ` Mateusz Marzantowicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25511.1101201766@www50.gmx.net \
--to=an0nym@gmx.de \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).