This is the mail archive of the gcc@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]

Re: What is exactly in O2?


Michael Meissner <meissner at cygnus dot com>  wrote:
> In terms of i386 vs. i686, things that come to mind:
>
> 1) The optimal alignment padding rules are different between the two.
>
> 2) Instruction selection is different between the two, based on which
>    instructions are faster on the machine selected.  For example, in the
>    386, if a function is called with an argument that is in memory, the
>    compiler will generate a single push operation from memory, while for
>    the 686, it will generate a load and then a push.  In some cases this
>    can cause other code to be different as it spills something else that
>    lived in a register to the stack.

 Just be curious about your 2):

 This process load/push is also used for i386 for load/call whatever
 option is selected, i.e.

void (*fct_ptr) (void) = one_fct;

void my_fct (void) ( (*fct_ptr)(); }

  will produce:
mov    fct_ptr,%eax
call   *%eax
ret

 This is probably faster, but when -Os is requested, is there a reason
 for not doing:

call   *fct_ptr
ret

  Thanks,
  Etienne.

___________________________________________________________
Do You Yahoo!? -- Pour dialoguer en direct avec vos amis, 
Yahoo! Messenger : http://fr.messenger.yahoo.com

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