This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Emit cld instruction when stringops are used
On Fri, Mar 07, 2008 at 08:47:10PM +0100, Richard Guenther wrote:
> On Fri, Mar 7, 2008 at 8:15 PM, Chris Lattner <clattner@apple.com> wrote:
> > That is pretty unambiguous. GCC always preserves this property as
> > well, in absence of the kernel bug.
>
> Nothin prevents GCC from doing
>
> std;
> backward string op;
> asm("...");
> another backward string op;
> cld;
Given that there is tons of inline asm that has cld in it or
"std; ...; cld", I'd say that if GCC tries that, it will break a lot of
code. Perhaps not so much through starting inline asm with DF=1
(though even that is a bad idea), but relying on inline asm preserving DF=1.
I doubt any inline asm in the wild uses
pushf
cld
string ops
popf
or
pushf
std
string ops
popf
Jakub