pushl vs movl + movl on x86

Menezes, Evandro evandro.menezes@amd.com
Tue Aug 23 20:30:00 GMT 2005


Dan, 

> Is there a performance difference between the movl + movl and 
> pushl code sequences? 

Not in this example, but movl is faster in some circumstances than pushl.  A sequence of pushl has an implicit dependency chain on %esp, as it changes after each pushl, whereas a sequence of movl could enjoy better ILP.  However, movl is quite longer than pushl, as you pointed out, which may affect cache efficiency.  

Therefore, the sweet spot is somewhere in the middle.  It's more important to use movl wisely in prologs and epilogs than when passing arguments though.  For, as RTH mentioned, -maccumulate-outgoing-args is desirable to avoid frequent stack maintenance.

That being said, it depends largely on the underlying architecture implementation.

HTH


-- 
_______________________________________________________
Evandro Menezes            AMD               Austin, TX



More information about the Gcc mailing list