[PATCH, i386]: Insert "cld" via optimize mode switching

H. J. Lu hjl@lucon.org
Mon Dec 4 21:16:00 GMT 2006


On Mon, Dec 04, 2006 at 10:06:51PM +0100, Michael Matz wrote:
> Hi,
> 
> On Mon, 4 Dec 2006, Uros Bizjak wrote:
> 
> > >but will fail working with those changes.  IMHO such routines would be 
> > >extremely rare, if they exist at all, so that shouldn't hinder full 
> > >progress by using mode switching for the direction flag.
> >
> > Going a bit further, and based on following assumptions:
> > 
> > 1) function entry and exit modes are mandated by ABI, so we _know_ that
> > direction bit is cleared there
> > 2) asm should take care by itself to issue CLD before exit
> > 3) we never emit STD anywhere
> > 
> > it is possible to argue, that gcc _does not need to emit any_ CLD
> > instructions.
> 
> Yes, it is.  I never quite understood why we emit them anyway, the only 

FYI, icc dodsn't emit cld at all.


H.J.



More information about the Gcc-patches mailing list