Re: x86-64 and calling conventions

"cr88192" <cr88192@hotmail.com>
Thu, 15 May 2008 06:46:20 +1000

          From comp.compilers

Related articles
[5 earlier articles]
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-13)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-13)
Re: x86-64 and calling conventions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-05-13)
Re: x86-64 and calling conventions james.harris.1@googlemail.com (James Harris) (2008-05-14)
Re: x86-64 and calling conventions vidar.hokstad@gmail.com (Vidar Hokstad) (2008-05-14)
Re: x86-64 and calling conventions james.harris.1@googlemail.com (James Harris) (2008-05-14)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-15)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-15)
Re: x86-64 and calling conventions bc@freeuk.com (Bart) (2008-05-14)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-15)
Re: x86-64 and calling conventions bolek-compilers@curl.com (Boleslaw Ciesielski) (2008-05-23)
Re: x86-64 and calling conventions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-05-29)
| List of all articles for this month |
From: "cr88192" <cr88192@hotmail.com>
Newsgroups: comp.compilers
Date: Thu, 15 May 2008 06:46:20 +1000
Organization: Saipan Datacom
References: 08-05-031 08-05-043 08-05-052
Keywords: architecture, design
Posted-Date: 14 May 2008 22:38:59 EDT

"Vidar Hokstad" <vidar.hokstad@gmail.com> wrote in message
> On May 13, 4:10 am, Dave Parker <davepar...@flamingthunder.com> wrote:
>> Left-to-right means the arguments are evaluated in
>> the order that users expect them to be. If the function is vararg,
>> then I push the argument count on the stack last.
>
> The evaluation order and the calling convention don't need to be tied
> together, though. Gcc on i386 for example subtracts the required
> number of words from %esp and then copy the arguments into place via
> indexed indirect mov's. No idea if that is slower or faster than
> push'ing stuff onto the stack instead, but the version of gcc I've
> used "gcc -S" on will use the mov approach even if all arguments are
> constants.


on x86, sub+mov's is actually a little faster I think.


The reason is, I think push gets decomposed into a mov and a sub
internally. more so, since esp gets modified, no other instructions
can use it until the next clock (or such...).


Meanwhile, several parallel mov's can be pipelined, which is faster.


In my case, I have usually tended to use a hybrid approach...


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.