GCC-2.95.3 optimisation: constant copied to registers

Etienne Lorrain etienne_lorrain@yahoo.fr
Fri May 25 02:04:00 GMT 2001


  Hello,

  Reading the assembly generated by different software on i386,
 I have noticed that sometimes the constant '0' is copied to
 a register, and the register is used to initialise other
 register. For instance you can get:

  xor %esi,%esi
  mov %esi,%eax
  push %eax
  call fct
  mov %esi,%edx
  ...

 For the constant zero, this is better:
  xor %eax,%eax
  push %eax
  call fct
  xor %edx,%edx
  ...

 So, just if someone has the time, and the knowledge of where
 this optimisation is done, it would be nice to disable this
 when the constant is zero - for all other values this optimisation
 is good.

  Thanks for reading,
  Etienne.

___________________________________________________________
Do You Yahoo!? -- Pour faire vos courses sur le Net, 
Yahoo! Shopping : http://fr.shopping.yahoo.com



More information about the Gcc mailing list