This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, i386]: Emit cld instruction when stringops are used
On Thu, Mar 06, 2008 at 09:08:28AM -0800, Chris Lattner wrote:
> On Mar 6, 2008, at 7:55 AM, Uros Bizjak wrote:
> >This patch adds back generation of cld instructions when stringops are
> >used in the function. cld insn is emitted as unspec volatile at the
> >end of function prologue. Currently, patched gcc emits cld when
> >"-mcld" is added to compile flags.
> >Currently, there is no configure-time support, I think we should first
> >reach a consensus on how to configure this. We can
> If I understand the issue correctly, this patch is insufficient. You
> should also have GCC emit a cld instruction before any inline asm. Do
> you think it's a good idea to add a 52 cycle delay (on the P4) to any
> function that uses inline asm?
No, gcc was never doing that, and there is no point to start doing that.
If inline asm thinks it can't trust the psABI, it has to do cld on its own.
And AFAIK inline asm that uses stos*/movs* etc. typically has cld at the
beginning. If inline asm uses std, it must do cld before returning back to
compiler generated code (again, from what I've seen asm that uses std
has the corresponding cld too).